aboutsummaryrefslogtreecommitdiff
path: root/src/music-player-bridge.vala
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2010-07-09 16:37:51 +0100
committerConor Curran <conor.curran@canonical.com>2010-07-09 16:37:51 +0100
commita7cd627d578066b3383629dee572aa6385a33281 (patch)
tree5c92ad2738bd9faed1f120ea0ee59e4bbd9a22e3 /src/music-player-bridge.vala
parentb0a09afe59a904ce4b4e90e58d933ad1f0b036d9 (diff)
downloadayatana-indicator-sound-a7cd627d578066b3383629dee572aa6385a33281.tar.gz
ayatana-indicator-sound-a7cd627d578066b3383629dee572aa6385a33281.tar.bz2
ayatana-indicator-sound-a7cd627d578066b3383629dee572aa6385a33281.zip
album art bug fixed
Diffstat (limited to 'src/music-player-bridge.vala')
-rw-r--r--src/music-player-bridge.vala47
1 files changed, 29 insertions, 18 deletions
diff --git a/src/music-player-bridge.vala b/src/music-player-bridge.vala
index d771192..03947d0 100644
--- a/src/music-player-bridge.vala
+++ b/src/music-player-bridge.vala
@@ -52,28 +52,34 @@ public class MusicPlayerBridge : GLib.Object
warning("App string in keyfile is null therefore moving on to next player");
continue;
}
- try{
- DesktopAppInfo info = new DesktopAppInfo.from_filename(app);
- if(info == null){
- warning("Could not create a desktopappinfo instance from app: %s", app);
- continue;
- }
- GLib.AppInfo app_info = info as GLib.AppInfo;
- PlayerController ctrl = new PlayerController(this.root_menu,
- app_info.get_name(),
- PlayerController.state.OFFLINE);
- ctrl.set("app_info", app_info);
- this.registered_clients.set(app_info.get_name().down().strip(), ctrl);
- debug("Created a player controller for %s which was found in the cache file", app_info.get_name().down().strip());
- count += 1;
- }
- catch(Error er){
- warning("desktop path in cache is not formatted as we have anticipated");
+ DesktopAppInfo info = new DesktopAppInfo.from_filename(app);
+ if(info == null){
+ warning("Could not create a desktopappinfo instance from app: %s", app);
+ continue;
}
+ GLib.AppInfo app_info = info as GLib.AppInfo;
+ PlayerController ctrl = new PlayerController(this.root_menu,
+ 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);
+ debug("Created a player controller for %s which was found in the cache file", app_info.get_name().down().strip());
+ count += 1;
}
break;
}
}
+
+ private int calculate_menu_position()
+ {
+ if(this.registered_clients.size == 0){
+ return 2;
+ }
+ else{
+ return (2 + (this.registered_clients.size * 3));
+ }
+ }
public void on_server_added(Indicate.ListenerServer object, string type)
{
@@ -89,8 +95,13 @@ public class MusicPlayerBridge : GLib.Object
}
//else init a new one
else{
- PlayerController ctrl = new PlayerController(root_menu, client_name, PlayerController.state.READY);
+
+ PlayerController ctrl = new PlayerController(root_menu,
+ client_name,
+ calculate_menu_position(),
+ PlayerController.state.READY);
registered_clients.set(client_name, ctrl);
+
debug("New Client of name %s has successfully registered with us", client_name);
}
// irregardless check that it has a desktop file if not kick off a request for it