aboutsummaryrefslogtreecommitdiff
path: root/src/music-player-bridge.vala
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2010-12-06 15:33:58 +0000
committerConor Curran <conor.curran@canonical.com>2010-12-06 15:33:58 +0000
commitaef17a4810d3480b64b20dd6aebd8b12e104778a (patch)
treeb7faa7c5b470cead9caf8e722a6b8078ce0171c0 /src/music-player-bridge.vala
parent65127a75569ae72173423510dedbc639f71cd9ba (diff)
downloadayatana-indicator-sound-aef17a4810d3480b64b20dd6aebd8b12e104778a.tar.gz
ayatana-indicator-sound-aef17a4810d3480b64b20dd6aebd8b12e104778a.tar.bz2
ayatana-indicator-sound-aef17a4810d3480b64b20dd6aebd8b12e104778a.zip
registration working perfectly and operational all over gdbus
Diffstat (limited to 'src/music-player-bridge.vala')
-rw-r--r--src/music-player-bridge.vala34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/music-player-bridge.vala b/src/music-player-bridge.vala
index c905c12..d1c2334 100644
--- a/src/music-player-bridge.vala
+++ b/src/music-player-bridge.vala
@@ -114,19 +114,18 @@ public class MusicPlayerBridge : GLib.Object
}
}
- /*public void on_server_removed(Indicate.ListenerServer object, string type)
+ public void client_has_vanished ( string mpris_root_interface )
{
- debug("MusicPlayerBridge -> on_server_removed with value %s", type);
- if(server_is_not_of_interest(type)) return;
- if (root_menu != null){
- var tmp = type.split(".");
- debug("attempt to remove %s", tmp[tmp.length-1]);
- if(tmp.length > 0){
- registered_clients[tmp[tmp.length - 1]].hibernate();
- debug("Successively offlined client %s", tmp[tmp.length - 1]);
+ debug("MusicPlayerBridge -> on_server_removed with value %s", mpris_root_interface);
+ if (root_menu != null){
+ debug("attempt to remove %s", mpris_root_interface);
+ var mpris_key = determine_key ( mpris_root_interface );
+ if ( mpris_key != null ){
+ registered_clients[mpris_key].hibernate();
+ debug("Successively offlined client %s", mpris_key);
}
- }
- }*/
+ }
+ }
public void set_root_menu_item(Dbusmenu.Menuitem menu)
{
@@ -134,7 +133,7 @@ public class MusicPlayerBridge : GLib.Object
this.try_to_add_inactive_familiar_clients();
this.watcher = new Mpris2Watcher ();
this.watcher.client_appeared += this.client_has_become_available;
- //this.watcher.client_appeared += this.client_has_become_available;
+ this.watcher.client_disappeared += this.client_has_vanished;
}
public static AppInfo? create_app_info ( string path )
@@ -150,8 +149,15 @@ public class MusicPlayerBridge : GLib.Object
private static string? determine_key(owned string path)
{
- var tokens = path.split("/");
- if ( tokens.length < 2) return null;
+ var tokens = path.split( "/" );
+ if ( tokens.length < 2 ){
+ // try to split on "."
+ tokens = path.split(".");
+ if ( tokens.length < 2 ){
+ // don't know what this is
+ return null;
+ }
+ }
var filename = tokens[tokens.length - 1];
var result = filename.split(".")[0];
var temp = result.split("-");