aboutsummaryrefslogtreecommitdiff
path: root/src/music-player-bridge.vala
diff options
context:
space:
mode:
Diffstat (limited to 'src/music-player-bridge.vala')
-rw-r--r--src/music-player-bridge.vala19
1 files changed, 16 insertions, 3 deletions
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){