aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2010-06-21 23:28:31 +0100
committerConor Curran <conor.curran@canonical.com>2010-06-21 23:28:31 +0100
commit3c42ee89d903f2bd1a239f2e3e8c236bfe2ef2ba (patch)
treeab04e6c242c3dfd34b835c9a798d22efcaf33a57
parent39e811f976a80011703e7b0c04b891a1f1abdd68 (diff)
downloadayatana-indicator-sound-3c42ee89d903f2bd1a239f2e3e8c236bfe2ef2ba.tar.gz
ayatana-indicator-sound-3c42ee89d903f2bd1a239f2e3e8c236bfe2ef2ba.tar.bz2
ayatana-indicator-sound-3c42ee89d903f2bd1a239f2e3e8c236bfe2ef2ba.zip
trying for support
-rw-r--r--src/mpris-controller.vala22
-rw-r--r--src/player-item.vala5
-rw-r--r--src/transport-menu-item.vala7
-rw-r--r--src/transport-widget.c2
4 files changed, 22 insertions, 14 deletions
diff --git a/src/mpris-controller.vala b/src/mpris-controller.vala
index c71662a..62077d1 100644
--- a/src/mpris-controller.vala
+++ b/src/mpris-controller.vala
@@ -20,7 +20,6 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
using Gee;
-
public class MprisController : GLib.Object
{
private DBus.Connection connection;
@@ -33,7 +32,6 @@ public class MprisController : GLib.Object
public int32 endless;
}
-
public MprisController(string name, PlayerController controller, string mpris_interface="org.freedesktop.MediaPlayer"){
try {
this.connection = DBus.Bus.get (DBus.BusType.SESSION);
@@ -44,18 +42,13 @@ public class MprisController : GLib.Object
this.mpris_player = this.connection.get_object ("org.mpris.".concat(name.down()) , "/Player", mpris_interface);
this.mpris_player.TrackChange += onTrackChange;
this.mpris_player.StatusChange += onStatusChange;
- //this.controller.update_playing_info(get_track_data());
}
- //public HashMap<string, string> get_track_data()
- //{
- //return format_metadata(this.mpris_player.GetMetadata());
- //}
private void onTrackChange(dynamic DBus.Object mpris_client, HashTable<string,Value?> ht)
{
this.controller.custom_items[this.controller.METADATA].update(ht,
- MetadataMenuitem.attributes_format());
+ MetadataMenuitem.attributes_format());
}
/**
@@ -80,11 +73,14 @@ public class MprisController : GLib.Object
status* status = &st;
unowned ValueArray ar = (ValueArray)status;
- int playback = ar.get_nth(0).get_int();
- debug("onStatusChange - play %i", ar.get_nth(0).get_int());
-
- //int repeat = ar.get_nth(2).get_int();
- //int endless = ar.get_nth(3).get_int();
+ bool play_state = (ar.get_nth(0).get_int() == 1);
+ debug("onStatusChange - play state %s", play_state.to_string());
+ HashTable<string, Value?> ht = new HashTable<string, Value?>(str_hash, str_equal);
+ Value v = Value(typeof(bool));
+ v.set_boolean(play_state);
+ ht.insert("state", play_state);
+ 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 7bf1063..fe1eeab 100644
--- a/src/player-item.vala
+++ b/src/player-item.vala
@@ -44,6 +44,11 @@ public class PlayerItem : Dbusmenu.Menuitem
int r = *v;
this.property_set_int(property, r);
}
+ 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);
+ }
}
}
diff --git a/src/transport-menu-item.vala b/src/transport-menu-item.vala
index 3c49e1c..aae07cc 100644
--- a/src/transport-menu-item.vala
+++ b/src/transport-menu-item.vala
@@ -36,5 +36,12 @@ public class TransportMenuitem : PlayerItem
{
debug("handle_event with bool value %s", input_value.get_boolean().to_string());
this.mpris_adaptor.toggle_playback(input_value.get_boolean());
+ }
+
+ public static HashSet<string> attributes_format()
+ {
+ HashSet<string> attrs = new HashSet<string>();
+ attrs.add(MENUITEM_STATE);
+ return attrs;
}
} \ No newline at end of file
diff --git a/src/transport-widget.c b/src/transport-widget.c
index 10b96df..e1baa68 100644
--- a/src/transport-widget.c
+++ b/src/transport-widget.c
@@ -222,7 +222,7 @@ transport_widget_property_update(DbusmenuMenuitem* item, gchar* property,
TransportWidget* bar = (TransportWidget*)userdata;
TransportWidgetPrivate *priv = TRANSPORT_WIDGET_GET_PRIVATE(bar);
- gtk_button_set_label(GTK_BUTTON(priv->play_button), g_strdup(transport_widget_toggle_play_label(property)));
+ gtk_button_set_label(GTK_BUTTON(priv->play_button), transport_widget_toggle_play_label(property));
}
// will be needed for image swapping