aboutsummaryrefslogtreecommitdiff
path: root/src/mpris2-controller.vala
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2011-02-01 12:24:38 -0600
committerConor Curran <conor.curran@canonical.com>2011-02-01 12:24:38 -0600
commit8507423eb5b7acaf1089fdaa4fc57cdca554abeb (patch)
treec77a731f7ba3a496312d80ecf7947d72fb70f003 /src/mpris2-controller.vala
parent9e8c509c0f321f322c3b9d0a0a23050cb3b30a3f (diff)
downloadayatana-indicator-sound-8507423eb5b7acaf1089fdaa4fc57cdca554abeb.tar.gz
ayatana-indicator-sound-8507423eb5b7acaf1089fdaa4fc57cdca554abeb.tar.bz2
ayatana-indicator-sound-8507423eb5b7acaf1089fdaa4fc57cdca554abeb.zip
the title on the player menu item can now be dynamically changed using the Identity prop on the root MPRIS interface
Diffstat (limited to 'src/mpris2-controller.vala')
-rw-r--r--src/mpris2-controller.vala20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala
index 03571e6..b9e7551 100644
--- a/src/mpris2-controller.vala
+++ b/src/mpris2-controller.vala
@@ -103,6 +103,11 @@ public class Mpris2Controller : GLib.Object
this.fetch_playlists.begin();
this.fetch_active_playlist();
}
+ Variant? identity_v = changed_properties.lookup("Identity");
+ if (identity_v != null){
+ TitleMenuitem title = this.owner.custom_items[PlayerController.widget_order.TITLE] as TitleMenuitem;
+ title.alter_label (identity_v.get_string());
+ }
}
private bool ensure_correct_playback_status(){
@@ -144,15 +149,20 @@ public class Mpris2Controller : GLib.Object
public void initial_update()
{
TransportMenuitem.state update;
+
if(this.player.PlaybackStatus == null){
update = TransportMenuitem.state.PAUSED;
}
-
- update = determine_play_state(null);
-
- (this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state(TransportMenuitem.state.PAUSED);
+ else{
+ update = determine_play_state (this.player.PlaybackStatus);
+ }
+ if (this.mpris2_root.Identity != null){
+ TitleMenuitem title = this.owner.custom_items[PlayerController.widget_order.TITLE] as TitleMenuitem;
+ title.alter_label (this.mpris2_root.Identity);
+ }
+ (this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state (update);
GLib.HashTable<string, Value?>? cleaned_metadata = this.clean_metadata();
- this.owner.custom_items[PlayerController.widget_order.METADATA].update(cleaned_metadata,
+ this.owner.custom_items[PlayerController.widget_order.METADATA].update (cleaned_metadata,
MetadataMenuitem.attributes_format());
if ( this.owner.use_playlists == true ){