From d9c023fd1ba9e5630755634d7f0e983081cbc195 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 5 Jan 2011 12:41:18 +0000 Subject: blacklisting in place --- src/settings-manager.vala | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/settings-manager.vala b/src/settings-manager.vala index f7bb3b6..57b4487 100644 --- a/src/settings-manager.vala +++ b/src/settings-manager.vala @@ -35,9 +35,16 @@ public class SettingsManager : GLib.Object return this.settings.get_strv ("blacklisted-media-players"); } - public string[] fetch_interested() + public ArrayList fetch_interested() { - return this.settings.get_strv ("interested-media-players"); + var blacklisted = this.settings.get_strv ("blacklisted-media-players"); + var interested = this.settings.get_strv ("interested-media-players"); + var list = new ArrayList(); + foreach(var s in interested){ + if ( s in blacklisted ) continue; + list.add(s); + } + return list; } public void clear_list() @@ -47,7 +54,7 @@ public class SettingsManager : GLib.Object public void add_interested(string app_desktop_name) { - var already_interested = fetch_interested(); + var already_interested = this.settings.get_strv ("interested-media-players"); foreach ( var s in already_interested){ if ( s == app_desktop_name ) return; } -- cgit v1.2.3 From f43f3cc7f9f5d762bff2dcd7062cafe554581e20 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 5 Jan 2011 12:56:02 +0000 Subject: block start ups that are blacklisted --- src/music-player-bridge.vala | 7 ++++++- src/sound-service.c | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/music-player-bridge.vala b/src/music-player-bridge.vala index 2d112cd..7a56ede 100644 --- a/src/music-player-bridge.vala +++ b/src/music-player-bridge.vala @@ -81,6 +81,11 @@ public class MusicPlayerBridge : GLib.Object dbus_name); return; } + if (desktop in this.settings_manager.fetch_blacklist()) { + debug ("Client %s attempting to register but it has been blacklisted", + desktop); + } + debug ( "client_has_become_available %s", desktop ); AppInfo? app_info = create_app_info ( desktop.concat( ".desktop" ) ); if ( app_info == null ){ @@ -117,7 +122,7 @@ public class MusicPlayerBridge : GLib.Object if (root_menu != null){ debug("attempt to remove %s", mpris_root_interface); var mpris_key = determine_key ( mpris_root_interface ); - if ( mpris_key != null ){ + if ( mpris_key != null && this.registered_clients.has_key(mpris_key)){ registered_clients[mpris_key].hibernate(); debug("Successively offlined client %s", mpris_key); } diff --git a/src/sound-service.c b/src/sound-service.c index 98f1881..defcb94 100644 --- a/src/sound-service.c +++ b/src/sound-service.c @@ -40,8 +40,8 @@ service_shutdown (IndicatorService *service, gpointer user_data) { if (mainloop != NULL) { g_debug("Service shutdown !"); - close_pulse_activites(); - g_main_loop_quit(mainloop); + //close_pulse_activites(); + //g_main_loop_quit(mainloop); } return; } -- cgit v1.2.3 From b8e5c4267c5c5db7889b18441a2fc733dd48cbdd Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 5 Jan 2011 16:06:52 +0000 Subject: blacklisting working plus bug fixed --- src/music-player-bridge.vala | 1 + src/player-controller.vala | 5 ++--- src/sound-service.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/music-player-bridge.vala b/src/music-player-bridge.vala index 7a56ede..c7391cf 100644 --- a/src/music-player-bridge.vala +++ b/src/music-player-bridge.vala @@ -141,6 +141,7 @@ public class MusicPlayerBridge : GLib.Object private static AppInfo? create_app_info ( string desktop ) { DesktopAppInfo info = new DesktopAppInfo ( desktop ) ; + if ( desktop == null || info == null ){ warning ( "Could not create a desktopappinfo instance from app: %s", desktop ); return null; diff --git a/src/player-controller.vala b/src/player-controller.vala index 58e3b47..3922ecf 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -44,7 +44,6 @@ public class PlayerController : GLib.Object public int current_state = state.OFFLINE; private Dbusmenu.Menuitem root_menu; - //public string name { get; set;} public string dbus_name { get; set;} public ArrayList custom_items; public Mpris2Controller mpris_bridge; @@ -62,7 +61,6 @@ public class PlayerController : GLib.Object this.root_menu = root; this.app_info = app; this.dbus_name = dbus_name; - //this.name = this.app_info.get_name(); this.icon_name = icon_name; this.custom_items = new ArrayList(); this.current_state = initial_state; @@ -128,7 +126,8 @@ public class PlayerController : GLib.Object this.custom_items[widget_order.TRANSPORT].reset(TransportMenuitem.attributes_format()); this.custom_items[widget_order.METADATA].reset(MetadataMenuitem.attributes_format()); TitleMenuitem title = this.custom_items[widget_order.TITLE] as TitleMenuitem; - title.toggle_active_triangle(false); + title.toggle_active_triangle(false); + this.mpris_bridge = null; } public void update_layout() diff --git a/src/sound-service.c b/src/sound-service.c index defcb94..98f1881 100644 --- a/src/sound-service.c +++ b/src/sound-service.c @@ -40,8 +40,8 @@ service_shutdown (IndicatorService *service, gpointer user_data) { if (mainloop != NULL) { g_debug("Service shutdown !"); - //close_pulse_activites(); - //g_main_loop_quit(mainloop); + close_pulse_activites(); + g_main_loop_quit(mainloop); } return; } -- cgit v1.2.3