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

Proposed by Conor Curran on 2011-01-05
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) 2011-01-05 Approve on 2011-01-06
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.

Looks good to me

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/music-player-bridge.vala'
2--- src/music-player-bridge.vala 2011-01-04 17:40:15 +0000
3+++ src/music-player-bridge.vala 2011-01-05 16:16:25 +0000
4@@ -81,6 +81,11 @@
5 dbus_name);
6 return;
7 }
8+ if (desktop in this.settings_manager.fetch_blacklist()) {
9+ debug ("Client %s attempting to register but it has been blacklisted",
10+ desktop);
11+ }
12+
13 debug ( "client_has_become_available %s", desktop );
14 AppInfo? app_info = create_app_info ( desktop.concat( ".desktop" ) );
15 if ( app_info == null ){
16@@ -117,7 +122,7 @@
17 if (root_menu != null){
18 debug("attempt to remove %s", mpris_root_interface);
19 var mpris_key = determine_key ( mpris_root_interface );
20- if ( mpris_key != null ){
21+ if ( mpris_key != null && this.registered_clients.has_key(mpris_key)){
22 registered_clients[mpris_key].hibernate();
23 debug("Successively offlined client %s", mpris_key);
24 }
25@@ -136,6 +141,7 @@
26 private static AppInfo? create_app_info ( string desktop )
27 {
28 DesktopAppInfo info = new DesktopAppInfo ( desktop ) ;
29+
30 if ( desktop == null || info == null ){
31 warning ( "Could not create a desktopappinfo instance from app: %s", desktop );
32 return null;
33
34=== modified file 'src/player-controller.vala'
35--- src/player-controller.vala 2011-01-04 15:16:04 +0000
36+++ src/player-controller.vala 2011-01-05 16:16:25 +0000
37@@ -44,7 +44,6 @@
38 public int current_state = state.OFFLINE;
39
40 private Dbusmenu.Menuitem root_menu;
41- //public string name { get; set;}
42 public string dbus_name { get; set;}
43 public ArrayList<PlayerItem> custom_items;
44 public Mpris2Controller mpris_bridge;
45@@ -62,7 +61,6 @@
46 this.root_menu = root;
47 this.app_info = app;
48 this.dbus_name = dbus_name;
49- //this.name = this.app_info.get_name();
50 this.icon_name = icon_name;
51 this.custom_items = new ArrayList<PlayerItem>();
52 this.current_state = initial_state;
53@@ -128,7 +126,8 @@
54 this.custom_items[widget_order.TRANSPORT].reset(TransportMenuitem.attributes_format());
55 this.custom_items[widget_order.METADATA].reset(MetadataMenuitem.attributes_format());
56 TitleMenuitem title = this.custom_items[widget_order.TITLE] as TitleMenuitem;
57- title.toggle_active_triangle(false);
58+ title.toggle_active_triangle(false);
59+ this.mpris_bridge = null;
60 }
61
62 public void update_layout()
63
64=== modified file 'src/settings-manager.vala'
65--- src/settings-manager.vala 2010-12-23 19:33:42 +0000
66+++ src/settings-manager.vala 2011-01-05 16:16:25 +0000
67@@ -35,9 +35,16 @@
68 return this.settings.get_strv ("blacklisted-media-players");
69 }
70
71- public string[] fetch_interested()
72+ public ArrayList<string> fetch_interested()
73 {
74- return this.settings.get_strv ("interested-media-players");
75+ var blacklisted = this.settings.get_strv ("blacklisted-media-players");
76+ var interested = this.settings.get_strv ("interested-media-players");
77+ var list = new ArrayList<string>();
78+ foreach(var s in interested){
79+ if ( s in blacklisted ) continue;
80+ list.add(s);
81+ }
82+ return list;
83 }
84
85 public void clear_list()
86@@ -47,7 +54,7 @@
87
88 public void add_interested(string app_desktop_name)
89 {
90- var already_interested = fetch_interested();
91+ var already_interested = this.settings.get_strv ("interested-media-players");
92 foreach ( var s in already_interested){
93 if ( s == app_desktop_name ) return;
94 }

Subscribers

People subscribed via source and target branches