diff options
-rw-r--r-- | src/mpris2-controller.vala | 12 | ||||
-rw-r--r-- | src/music-player-bridge.vala | 19 | ||||
-rw-r--r-- | src/play-button.c | 16 |
3 files changed, 32 insertions, 15 deletions
diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala index dab5e2c..5f284b2 100644 --- a/src/mpris2-controller.vala +++ b/src/mpris2-controller.vala @@ -53,7 +53,9 @@ public interface MprisPlayer : DBus.Object { [DBus (name = "org.freedesktop.DBus.Properties")] public interface FreeDesktopProperties : DBus.Object{ // signals - public signal void PropertiesChanged(string source, HashTable<string, Value?> changed_properties, string[] invalid); + public signal void PropertiesChanged(string source, HashTable<string, + Value?> changed_properties, + string[] invalid); } /* @@ -85,8 +87,7 @@ public class Mpris2Controller : GLib.Object this.player.Seeked += onSeeked; this.properties_interface = (FreeDesktopProperties) connection.get_object(root_interface.concat(".").concat(this.owner.name.down()), - "/org/mpris/MediaPlayer2", - "org.freedesktop.DBus.Properties"); + "/org/mpris/MediaPlayer2"); this.properties_interface.PropertiesChanged += property_changed_cb; } catch (DBus.Error e) { @@ -97,7 +98,10 @@ public class Mpris2Controller : GLib.Object public void property_changed_cb(string interface_source, HashTable<string, Value?> changed_properties, string[] invalid ) { debug("properties-changed for interface %s and owner %s", interface_source, this.owner.name.down()); - if(changed_properties == null || interface_source.has_prefix(this.root_interface) == false){ + debug("is the invalid array null : %s", (invalid == null).to_string()); + debug("invalid length : %i", invalid.length); + + if(changed_properties == null || interface_source.has_prefix(this.root_interface) == false ){ warning("Property-changed hash is null or this is an interface that concerns us"); return; } diff --git a/src/music-player-bridge.vala b/src/music-player-bridge.vala index c677d15..3929916 100644 --- a/src/music-player-bridge.vala +++ b/src/music-player-bridge.vala @@ -59,14 +59,27 @@ public class MusicPlayerBridge : GLib.Object } GLib.AppInfo app_info = info as GLib.AppInfo; PlayerController ctrl = new PlayerController(this.root_menu, - app_info.get_name(), + truncate_player_name(app_info.get_name()), calculate_menu_position(), PlayerController.state.OFFLINE); - ctrl.set("app_info", app_info); - this.registered_clients.set(app_info.get_name().down().strip(), ctrl); + ctrl.app_info = app_info; + this.registered_clients.set(truncate_player_name(app_info.get_name()), ctrl); } } + private static string truncate_player_name(string app_info_name) + { + string result = app_info_name.down().strip(); + + var tokens = result.split(" "); + + if(tokens.length > 1){ + result = tokens[0]; + } + debug("truncate player name %s", result); + return result; + } + private int calculate_menu_position() { if(this.registered_clients.size == 0){ diff --git a/src/play-button.c b/src/play-button.c index 0c934e5..a40b683 100644 --- a/src/play-button.c +++ b/src/play-button.c @@ -733,15 +733,15 @@ draw (GtkWidget* button, cairo_t *cr) //double INNER_START[] = {229.0f/255.0f, 223.0f/255.0f, 215.0f/255.0f, 1.0f}; //double INNER_END[] = {183.0f / 255.0f, 178.0f / 255.0f, 172.0f / 255.0f, 1.0f}; - double MIDDLE_START[] = {61.0f / 255.0f, 60.0f / 255.0f, 57.0f / 255.0f, 1.0f}; - double MIDDLE_END[] = {94.0f / 255.0f,93.0f / 255.0f, 90.0f / 255.0f,1.0f}; - double OUTER_START[] = {36.0f / 255.0f, 35.0f / 255.0f, 33.0f / 255.0f, 1.0f}; - double OUTER_END[] = {123.0f / 255.0f, 123.0f / 255.0f, 120.0f / 255.0f, 1.0f}; - double BUTTON_START[] = {252.0f / 255.0f, 251.0f / 255.0f, 251.0f / 255.0f,1.0f}; - double BUTTON_END[] = {186.0f / 255.0f,180.0f / 255.0f, 170.0f / 255.0f, 1.0f}; + double MIDDLE_END[] = {61.0f / 255.0f, 60.0f / 255.0f, 57.0f / 255.0f, 1.0f}; + double MIDDLE_START[] = {94.0f / 255.0f,93.0f / 255.0f, 90.0f / 255.0f,1.0f}; + double OUTER_END[] = {36.0f / 255.0f, 35.0f / 255.0f, 33.0f / 255.0f, 1.0f}; + double OUTER_START[] = {123.0f / 255.0f, 123.0f / 255.0f, 120.0f / 255.0f, 1.0f}; + double BUTTON_END[] = {252.0f / 255.0f, 251.0f / 255.0f, 251.0f / 255.0f,1.0f}; + double BUTTON_START[] = {186.0f / 255.0f,180.0f / 255.0f, 170.0f / 255.0f, 1.0f}; double BUTTON_SHADOW[] = {0.0f / 255.0f, 0.0f / 255.0f, 0.0f / 255.0f, 0.75f}; - double INNER_COMPRESSED_END[] = {61.0f / 255.0f, 60.0f / 255.0f, 57.0f / 255.0f, 1.0f}; - double INNER_COMPRESSED_START[] = {36.0f / 255.0f, 35.0f / 255.0f, 33.0f / 255.0f, 1.0f}; + double INNER_COMPRESSED_START[] = {61.0f / 255.0f, 60.0f / 255.0f, 57.0f / 255.0f, 1.0f}; + double INNER_COMPRESSED_END[] = {36.0f / 255.0f, 35.0f / 255.0f, 33.0f / 255.0f, 1.0f}; // prev/next-background draw_gradient (cr, |