Merge lp:~cjcurran/indicator-sound/blacklisted into lp:~indicator-applet-developers/indicator-sound/trunk_3

Proposed by Conor Curran
Status: Merged
Merged at revision: 107
Proposed branch: lp:~cjcurran/indicator-sound/blacklisted
Merge into: lp:~indicator-applet-developers/indicator-sound/trunk_3
Diff against target: 94 lines (+19/-7)
3 files modified
src/music-player-bridge.vala (+7/-1)
src/player-controller.vala (+2/-3)
src/settings-manager.vala (+10/-3)
To merge this branch: bzr merge lp:~cjcurran/indicator-sound/blacklisted
Reviewer Review Type Date Requested Status
Mikkel Kamstrup Erlandsen (community) Approve
Review via email: mp+45255@code.launchpad.net

Description of the change

Implements the checks inorder to ensure any app added to the blacklists will not get added to the menu.

To post a comment you must log in.
Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

Looks good to me

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/music-player-bridge.vala'
--- src/music-player-bridge.vala 2011-01-04 17:40:15 +0000
+++ src/music-player-bridge.vala 2011-01-05 16:16:25 +0000
@@ -81,6 +81,11 @@
81 dbus_name);81 dbus_name);
82 return;82 return;
83 }83 }
84 if (desktop in this.settings_manager.fetch_blacklist()) {
85 debug ("Client %s attempting to register but it has been blacklisted",
86 desktop);
87 }
88
84 debug ( "client_has_become_available %s", desktop );89 debug ( "client_has_become_available %s", desktop );
85 AppInfo? app_info = create_app_info ( desktop.concat( ".desktop" ) );90 AppInfo? app_info = create_app_info ( desktop.concat( ".desktop" ) );
86 if ( app_info == null ){91 if ( app_info == null ){
@@ -117,7 +122,7 @@
117 if (root_menu != null){122 if (root_menu != null){
118 debug("attempt to remove %s", mpris_root_interface);123 debug("attempt to remove %s", mpris_root_interface);
119 var mpris_key = determine_key ( mpris_root_interface );124 var mpris_key = determine_key ( mpris_root_interface );
120 if ( mpris_key != null ){125 if ( mpris_key != null && this.registered_clients.has_key(mpris_key)){
121 registered_clients[mpris_key].hibernate();126 registered_clients[mpris_key].hibernate();
122 debug("Successively offlined client %s", mpris_key); 127 debug("Successively offlined client %s", mpris_key);
123 }128 }
@@ -136,6 +141,7 @@
136 private static AppInfo? create_app_info ( string desktop )141 private static AppInfo? create_app_info ( string desktop )
137 {142 {
138 DesktopAppInfo info = new DesktopAppInfo ( desktop ) ;143 DesktopAppInfo info = new DesktopAppInfo ( desktop ) ;
144
139 if ( desktop == null || info == null ){145 if ( desktop == null || info == null ){
140 warning ( "Could not create a desktopappinfo instance from app: %s", desktop );146 warning ( "Could not create a desktopappinfo instance from app: %s", desktop );
141 return null;147 return null;
142148
=== modified file 'src/player-controller.vala'
--- src/player-controller.vala 2011-01-04 15:16:04 +0000
+++ src/player-controller.vala 2011-01-05 16:16:25 +0000
@@ -44,7 +44,6 @@
44 public int current_state = state.OFFLINE;44 public int current_state = state.OFFLINE;
45 45
46 private Dbusmenu.Menuitem root_menu;46 private Dbusmenu.Menuitem root_menu;
47 //public string name { get; set;}
48 public string dbus_name { get; set;}47 public string dbus_name { get; set;}
49 public ArrayList<PlayerItem> custom_items; 48 public ArrayList<PlayerItem> custom_items;
50 public Mpris2Controller mpris_bridge;49 public Mpris2Controller mpris_bridge;
@@ -62,7 +61,6 @@
62 this.root_menu = root;61 this.root_menu = root;
63 this.app_info = app;62 this.app_info = app;
64 this.dbus_name = dbus_name;63 this.dbus_name = dbus_name;
65 //this.name = this.app_info.get_name();
66 this.icon_name = icon_name;64 this.icon_name = icon_name;
67 this.custom_items = new ArrayList<PlayerItem>();65 this.custom_items = new ArrayList<PlayerItem>();
68 this.current_state = initial_state;66 this.current_state = initial_state;
@@ -128,7 +126,8 @@
128 this.custom_items[widget_order.TRANSPORT].reset(TransportMenuitem.attributes_format());126 this.custom_items[widget_order.TRANSPORT].reset(TransportMenuitem.attributes_format());
129 this.custom_items[widget_order.METADATA].reset(MetadataMenuitem.attributes_format());127 this.custom_items[widget_order.METADATA].reset(MetadataMenuitem.attributes_format());
130 TitleMenuitem title = this.custom_items[widget_order.TITLE] as TitleMenuitem;128 TitleMenuitem title = this.custom_items[widget_order.TITLE] as TitleMenuitem;
131 title.toggle_active_triangle(false); 129 title.toggle_active_triangle(false);
130 this.mpris_bridge = null;
132 }131 }
133132
134 public void update_layout()133 public void update_layout()
135134
=== modified file 'src/settings-manager.vala'
--- src/settings-manager.vala 2010-12-23 19:33:42 +0000
+++ src/settings-manager.vala 2011-01-05 16:16:25 +0000
@@ -35,9 +35,16 @@
35 return this.settings.get_strv ("blacklisted-media-players");35 return this.settings.get_strv ("blacklisted-media-players");
36 }36 }
3737
38 public string[] fetch_interested()38 public ArrayList<string> fetch_interested()
39 {39 {
40 return this.settings.get_strv ("interested-media-players");40 var blacklisted = this.settings.get_strv ("blacklisted-media-players");
41 var interested = this.settings.get_strv ("interested-media-players");
42 var list = new ArrayList<string>();
43 foreach(var s in interested){
44 if ( s in blacklisted ) continue;
45 list.add(s);
46 }
47 return list;
41 }48 }
4249
43 public void clear_list()50 public void clear_list()
@@ -47,7 +54,7 @@
47 54
48 public void add_interested(string app_desktop_name)55 public void add_interested(string app_desktop_name)
49 {56 {
50 var already_interested = fetch_interested();57 var already_interested = this.settings.get_strv ("interested-media-players");
51 foreach ( var s in already_interested){58 foreach ( var s in already_interested){
52 if ( s == app_desktop_name ) return;59 if ( s == app_desktop_name ) return;
53 }60 }

Subscribers

People subscribed via source and target branches