diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/metadata-menu-item.vala | 15 | ||||
-rw-r--r-- | src/mpris2-controller.vala | 26 | ||||
-rw-r--r-- | src/player-item.vala | 3 |
3 files changed, 19 insertions, 25 deletions
diff --git a/src/metadata-menu-item.vala b/src/metadata-menu-item.vala index b13196f..0bb4a85 100644 --- a/src/metadata-menu-item.vala +++ b/src/metadata-menu-item.vala @@ -29,19 +29,6 @@ public class MetadataMenuitem : PlayerItem reset(attributes_format()); } - public bool needs_reset(GLib.HashTable<string, Value?> updates) - { - if(this.property_exist(MENUITEM_ARTURL) == false){ - return true; - } - if(this.property_get_int(MENUITEM_ARTURL) == EMPTY){ - return true; - } - if(strcmp(updates.lookup("xesam:artist").get_string() ,this.property_get(MENUITEM_ARTURL)) != 0){ - return true; - } - return false; - } public static HashSet<string> attributes_format() { @@ -53,4 +40,4 @@ public class MetadataMenuitem : PlayerItem return attrs; } -}
\ No newline at end of file +} diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala index d5152c2..166d7f4 100644 --- a/src/mpris2-controller.vala +++ b/src/mpris2-controller.vala @@ -121,9 +121,9 @@ public class Mpris2Controller : GLib.Object if(meta_v != null){ GLib.HashTable<string, Value?> changed_updates = clean_metadata(); - MetadataMenuitem meta = this.owner.custom_items[PlayerController.widget_order.METADATA] as MetadataMenuitem; - meta.reset(MetadataMenuitem.attributes_format()); - + //MetadataMenuitem meta = this.owner.custom_items[PlayerController.widget_order.METADATA] as MetadataMenuitem; + //meta.reset(MetadataMenuitem.attributes_format()); + this.owner.custom_items[PlayerController.widget_order.METADATA].reset(MetadataMenuitem.attributes_format()); this.owner.custom_items[PlayerController.widget_order.METADATA].update(changed_updates, MetadataMenuitem.attributes_format()); this.owner.custom_items[PlayerController.widget_order.SCRUB].reset(ScrubMenuitem.attributes_format()); @@ -138,12 +138,18 @@ public class Mpris2Controller : GLib.Object private GLib.HashTable<string, Value?> clean_metadata() { GLib.HashTable<string, Value?> changed_updates = this.player.Metadata; - string[] artists = (string[])this.player.Metadata.lookup("xesam:artist"); - string display_artists = string.joinv(", ", artists); - changed_updates.replace("xesam:artist", display_artists); - debug("artist : %s", display_artists); - int64 duration = this.player.Metadata.lookup("mpris:length").get_int64(); - changed_updates.replace("mpris:length", duration/1000000); + Value? artist_v = this.player.Metadata.lookup("xesam:artist"); + if(artist_v != null){ + string[] artists = (string[])this.player.Metadata.lookup("xesam:artist"); + string display_artists = string.joinv(", ", artists); + changed_updates.replace("xesam:artist", display_artists); + debug("artist : %s", display_artists); + } + Value? length_v = this.player.Metadata.lookup("mpris:length"); + if(length_v != null){ + int64 duration = this.player.Metadata.lookup("mpris:length").get_int64(); + changed_updates.replace("mpris:length", duration/1000000); + } return changed_updates; } @@ -171,7 +177,7 @@ public class Mpris2Controller : GLib.Object debug("initial update - play state %i", status); (this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state(status); - var cleaned_metadata = this.clean_metadata(); + GLib.HashTable<string, Value?> cleaned_metadata = this.clean_metadata(); this.owner.custom_items[PlayerController.widget_order.METADATA].update(cleaned_metadata, MetadataMenuitem.attributes_format()); this.owner.custom_items[PlayerController.widget_order.SCRUB].update(cleaned_metadata, diff --git a/src/player-item.vala b/src/player-item.vala index fab1f85..fbfacbd 100644 --- a/src/player-item.vala +++ b/src/player-item.vala @@ -92,8 +92,9 @@ public class PlayerItem : Dbusmenu.Menuitem public bool populated(HashSet<string> attrs) { foreach(string prop in attrs){ + debug("populated ? - prop: %s", prop); int value_int = property_get_int(prop); - debug("populate - prop %s and value %i", prop, value_int); + debug("populated ? - prop %s and value %i", prop, value_int); if(property_get_int(prop) != EMPTY){ return true; } |