aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common-defs.h2
-rw-r--r--src/metadata-menu-item.vala19
-rw-r--r--src/mpris-controller.vala14
-rw-r--r--src/player-item.vala23
-rw-r--r--src/transport-menu-item.vala1
5 files changed, 36 insertions, 23 deletions
diff --git a/src/common-defs.h b/src/common-defs.h
index 5fbf743..dca21cc 100644
--- a/src/common-defs.h
+++ b/src/common-defs.h
@@ -27,7 +27,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
/* DBUS Custom Items */
#define DBUSMENU_SLIDER_MENUITEM_TYPE "x-canonical-ido-slider-item"
#define DBUSMENU_TRANSPORT_MENUITEM_TYPE "x-canonical-transport-bar"
-#define DBUSMENU_TRANSPORT_MENUITEM_PLAY_STATE "x-canonical-transport-state"
+#define DBUSMENU_TRANSPORT_MENUITEM_PLAY_STATE "x-canonical-transport-play-state"
#define DBUSMENU_METADATA_MENUITEM_TYPE "x-canonical-metadata-menu-item"
#define DBUSMENU_METADATA_MENUITEM_TEXT_ARTIST "x-canonical-metadata-text-artist"
diff --git a/src/metadata-menu-item.vala b/src/metadata-menu-item.vala
index 08b1b85..f62cd46 100644
--- a/src/metadata-menu-item.vala
+++ b/src/metadata-menu-item.vala
@@ -1,3 +1,22 @@
+/*
+Copyright 2010 Canonical Ltd.
+
+Authors:
+ Conor Curran <conor.curran@canonical.com>
+
+This program is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 3, as published
+by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranties of
+MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
using Dbusmenu;
using Gee;
using DbusmenuMetadata;
diff --git a/src/mpris-controller.vala b/src/mpris-controller.vala
index 4515c00..64a46e6 100644
--- a/src/mpris-controller.vala
+++ b/src/mpris-controller.vala
@@ -80,16 +80,14 @@ public class MprisController : GLib.Object
{
debug("onStatusChange - signal received");
status* status = &st;
- unowned ValueArray ar = (ValueArray)status;
-
+ unowned ValueArray ar = (ValueArray)status;
int play_state = ar.get_nth(0).get_int();
debug("onStatusChange - play state %i", play_state);
- //HashTable<string, Value?> ht = new HashTable<string, Value?>(str_hash, str_equal);
- //int* type = &play_state;
- //Value v = Value(typeof(int*));
- //v.set_pointer(type);
- //ht.insert("state", v);
- (this.controller.custom_items[this.controller.TRANSPORT] as TransportMenuitem).change_play_state(play_state);
+ HashTable<string, Value?> ht = new HashTable<string, Value?>(str_hash, str_equal);
+ Value v = Value(typeof(int));
+ v.set_int(play_state);
+ ht.insert("state", v);
+ this.controller.custom_items[this.controller.TRANSPORT].update(ht, TransportMenuitem.attributes_format());
}
}
diff --git a/src/player-item.vala b/src/player-item.vala
index 3cac208..09b0e6b 100644
--- a/src/player-item.vala
+++ b/src/player-item.vala
@@ -1,5 +1,4 @@
/*
-This service primarily controls PulseAudio and is driven by the sound indicator menu on the panel.
Copyright 2010 Canonical Ltd.
Authors:
@@ -36,20 +35,18 @@ public class PlayerItem : Dbusmenu.Menuitem
string[] input_keys = property.split("-");
string search_key = input_keys[input_keys.length-1 : input_keys.length][0];
debug("search key = %s", search_key);
- if (data.lookup(search_key).holds (typeof (string))){
- debug("track data change player item update");
- this.property_set(property, this.sanitize_string(data.lookup(search_key) as string));
+
+ Value v = data.lookup(search_key);
+
+ if (v.holds (typeof (string))){
+ this.property_set(property, this.sanitize_string(v.get_string()));
}
- else if (data.lookup(search_key).holds (typeof (int))){
- // Circumvent weird vala bug
- int* v = (int*)data.lookup(search_key);
- int r = *v;
- this.property_set_int(property, r);
+ else if (v.holds (typeof (int))){
+ debug("with value : %i", v.get_int());
+ this.property_set_int(property, v.get_int());
}
- else if(data.lookup(search_key).holds (typeof (bool))){
- bool* b = (bool*)data.lookup(search_key);
- bool input = *b;
- this.property_set_bool(property, input);
+ else if(v.holds (typeof (bool))){
+ this.property_set_bool(property, v.get_boolean());
}
}
}
diff --git a/src/transport-menu-item.vala b/src/transport-menu-item.vala
index c8733c0..39a0cab 100644
--- a/src/transport-menu-item.vala
+++ b/src/transport-menu-item.vala
@@ -1,5 +1,4 @@
/*
-This service primarily controls PulseAudio and is driven by the sound indicator menu on the panel.
Copyright 2010 Canonical Ltd.
Authors: