Merge lp:~ted/indicator-sound/rtm-silent-mode-item into lp:indicator-sound/rtm-14.09
- rtm-silent-mode-item
- Merge into trunk.rtm-14.09
Status: | Merged |
---|---|
Approved by: | Charles Kerr |
Approved revision: | 461 |
Merged at revision: | 462 |
Proposed branch: | lp:~ted/indicator-sound/rtm-silent-mode-item |
Merge into: | lp:indicator-sound/rtm-14.09 |
Prerequisite: | lp:~indicator-applet-developers/indicator-sound/rtm-extreme-volume-warning |
Diff against target: |
499 lines (+228/-44) 10 files modified
data/com.canonical.indicator.sound.gschema.xml (+0/-9) debian/changelog (+13/-0) src/CMakeLists.txt (+8/-0) src/accounts-service-privacy-settings.vala (+26/-0) src/accounts-service-system-sound-settings.vala (+25/-0) src/accounts-service-user.vala (+72/-2) src/media-player-mpris.vala (+1/-1) src/service.vala (+63/-29) src/sound-menu.vala (+18/-2) src/volume-control.vala (+2/-1) |
To merge this branch: | bzr merge lp:~ted/indicator-sound/rtm-silent-mode-item |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Charles Kerr (community) | Approve | ||
Review via email: mp+238332@code.launchpad.net |
Commit message
Enable silent mode checkbox on RTM
Description of the change
This landed in Utopic, got reverted from rtm, well kinda, just held up. Then another branch got determined to need to land first. So got reverted.
Selene ToyKeeper (toykeeper) wrote : | # |
New behavior needs to be covered in the test plan, or in autopilot tests, or in unit tests... depending on which is most appropriate. (and if it's a manual test, it will need to be automated eventually)
http://
This change does appear to toggle silent mode. However, there are some issues:
- Toggling the indicator checkbox does not affect the checkbox in system-settings.
- The system-settings Sound page disagrees with itself after using the indicator to change the setting: http://
- Silent mode does not silence dialpad sounds or keyboard click sounds, even though other platforms silence these.
- The test plan should specify which parts of the system should be affected by silent mode and which are not. It only silences incoming calls and incoming SMS ringtones, but has no effect on music, video playback, alarms, dialpad sounds, or keyboard sounds.
Charles Kerr (charlesk) wrote : | # |
Selene ToyKeeper (toykeeper) wrote : | # |
Thanks, just wanted to make sure the changes were written... somewhere. The complications in getting it into a published central test plan will hopefully be addressed at a meeting later today.
Preview Diff
1 | === modified file 'data/com.canonical.indicator.sound.gschema.xml' |
2 | --- data/com.canonical.indicator.sound.gschema.xml 2014-10-14 17:06:58 +0000 |
3 | +++ data/com.canonical.indicator.sound.gschema.xml 2014-10-21 20:05:15 +0000 |
4 | @@ -48,14 +48,5 @@ |
5 | Whether or not to show the sound indicator in the menu bar. |
6 | </description> |
7 | </key> |
8 | - <key name="greeter-export" type="b"> |
9 | - <default>true</default> |
10 | - <summary>Whether or not to export the currently playing song to the greeter.</summary> |
11 | - <description> |
12 | - If enabled the sound indicator will export the current player and |
13 | - song to the greeter so that it can be shown if the user is selected |
14 | - and the sound menu is shown. |
15 | - </description> |
16 | - </key> |
17 | </schema> |
18 | </schemalist> |
19 | |
20 | === modified file 'debian/changelog' |
21 | --- debian/changelog 2014-10-16 13:31:44 +0000 |
22 | +++ debian/changelog 2014-10-21 20:05:15 +0000 |
23 | @@ -1,3 +1,9 @@ |
24 | +indicator-sound (12.10.2+14.10.20141016-0ubuntu2) UNRELEASED; urgency=medium |
25 | + |
26 | + * Silent Mode checkbox in indicator (LP: #1342151) |
27 | + |
28 | + -- Ted Gould <ted@ubuntu.com> Tue, 21 Oct 2014 16:02:49 -0400 |
29 | + |
30 | indicator-sound (12.10.2+14.10.20141016-0ubuntu1) 14.09; urgency=low |
31 | |
32 | [ Lars Uebernickel ] |
33 | @@ -20,6 +26,13 @@ |
34 | |
35 | -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Fri, 10 Oct 2014 15:40:30 +0000 |
36 | |
37 | +indicator-sound (12.10.2+14.10.20141009-0ubuntu1) utopic; urgency=low |
38 | + |
39 | + [ Ted Gould ] |
40 | + * Show a silent mode checkbox (LP: #1342151) |
41 | + |
42 | + -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Thu, 09 Oct 2014 13:32:54 +0000 |
43 | + |
44 | indicator-sound (12.10.2+14.10.20141008-0ubuntu1) utopic; urgency=low |
45 | |
46 | [ Ted Gould ] |
47 | |
48 | === modified file 'src/CMakeLists.txt' |
49 | --- src/CMakeLists.txt 2014-10-14 17:06:58 +0000 |
50 | +++ src/CMakeLists.txt 2014-10-21 20:05:15 +0000 |
51 | @@ -104,12 +104,20 @@ |
52 | media-player |
53 | mpris2-interfaces |
54 | accounts-service-sound-settings |
55 | + accounts-service-privacy-settings |
56 | + accounts-service-system-sound-settings |
57 | greeter-broadcast |
58 | ) |
59 | vala_add(indicator-sound-service |
60 | accounts-service-sound-settings.vala |
61 | ) |
62 | vala_add(indicator-sound-service |
63 | + accounts-service-privacy-settings.vala |
64 | +) |
65 | +vala_add(indicator-sound-service |
66 | + accounts-service-system-sound-settings.vala |
67 | +) |
68 | +vala_add(indicator-sound-service |
69 | greeter-broadcast.vala |
70 | ) |
71 | |
72 | |
73 | === added file 'src/accounts-service-privacy-settings.vala' |
74 | --- src/accounts-service-privacy-settings.vala 1970-01-01 00:00:00 +0000 |
75 | +++ src/accounts-service-privacy-settings.vala 2014-10-21 20:05:15 +0000 |
76 | @@ -0,0 +1,26 @@ |
77 | +/* |
78 | + * Copyright 2014 © Canonical Ltd. |
79 | + * |
80 | + * This program is free software; you can redistribute it and/or modify |
81 | + * it under the terms of the GNU General Public License as published by |
82 | + * the Free Software Foundation; version 3. |
83 | + * |
84 | + * This program is distributed in the hope that it will be useful, |
85 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
86 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
87 | + * GNU General Public License for more details. |
88 | + * |
89 | + * You should have received a copy of the GNU General Public License |
90 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
91 | + * |
92 | + * Authors: |
93 | + * Ted Gould <ted@canonical.com> |
94 | + */ |
95 | + |
96 | +[DBus (name = "com.ubuntu.touch.AccountsService.SecurityPrivacy")] |
97 | +public interface AccountsServicePrivacySettings : Object { |
98 | + // properties |
99 | + public abstract bool stats_welcome_screen {owned get; set;} |
100 | + public abstract bool messages_welcome_screen {owned get; set;} |
101 | +} |
102 | + |
103 | |
104 | === added file 'src/accounts-service-system-sound-settings.vala' |
105 | --- src/accounts-service-system-sound-settings.vala 1970-01-01 00:00:00 +0000 |
106 | +++ src/accounts-service-system-sound-settings.vala 2014-10-21 20:05:15 +0000 |
107 | @@ -0,0 +1,25 @@ |
108 | +/* |
109 | + * Copyright 2014 © Canonical Ltd. |
110 | + * |
111 | + * This program is free software; you can redistribute it and/or modify |
112 | + * it under the terms of the GNU General Public License as published by |
113 | + * the Free Software Foundation; version 3. |
114 | + * |
115 | + * This program is distributed in the hope that it will be useful, |
116 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
117 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
118 | + * GNU General Public License for more details. |
119 | + * |
120 | + * You should have received a copy of the GNU General Public License |
121 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
122 | + * |
123 | + * Authors: |
124 | + * Ted Gould <ted@canonical.com> |
125 | + */ |
126 | + |
127 | +[DBus (name = "com.ubuntu.touch.AccountsService.Sound")] |
128 | +public interface AccountsServiceSystemSoundSettings : Object { |
129 | + // properties |
130 | + public abstract bool silent_mode {owned get; set;} |
131 | +} |
132 | + |
133 | |
134 | === modified file 'src/accounts-service-user.vala' |
135 | --- src/accounts-service-user.vala 2014-10-14 17:06:58 +0000 |
136 | +++ src/accounts-service-user.vala 2014-10-21 20:05:15 +0000 |
137 | @@ -21,10 +21,25 @@ |
138 | Act.UserManager accounts_manager = Act.UserManager.get_default(); |
139 | Act.User? user = null; |
140 | AccountsServiceSoundSettings? proxy = null; |
141 | + AccountsServicePrivacySettings? privacyproxy = null; |
142 | + AccountsServiceSystemSoundSettings? syssoundproxy = null; |
143 | uint timer = 0; |
144 | MediaPlayer? _player = null; |
145 | GreeterBroadcast? greeter = null; |
146 | |
147 | + public bool showDataOnGreeter { get; set; } |
148 | + |
149 | + bool _silentMode = false; |
150 | + public bool silentMode { |
151 | + get { |
152 | + return _silentMode; |
153 | + } |
154 | + set { |
155 | + if (syssoundproxy != null) |
156 | + syssoundproxy.silent_mode = value; |
157 | + } |
158 | + } |
159 | + |
160 | public MediaPlayer? player { |
161 | set { |
162 | this._player = value; |
163 | @@ -124,7 +139,23 @@ |
164 | user.get_object_path(), |
165 | DBusProxyFlags.GET_INVALIDATED_PROPERTIES, |
166 | null, |
167 | - new_proxy); |
168 | + new_sound_proxy); |
169 | + |
170 | + Bus.get_proxy.begin<AccountsServicePrivacySettings> ( |
171 | + BusType.SYSTEM, |
172 | + "org.freedesktop.Accounts", |
173 | + user.get_object_path(), |
174 | + DBusProxyFlags.GET_INVALIDATED_PROPERTIES, |
175 | + null, |
176 | + new_privacy_proxy); |
177 | + |
178 | + Bus.get_proxy.begin<AccountsServiceSystemSoundSettings> ( |
179 | + BusType.SYSTEM, |
180 | + "org.freedesktop.Accounts", |
181 | + user.get_object_path(), |
182 | + DBusProxyFlags.GET_INVALIDATED_PROPERTIES, |
183 | + null, |
184 | + new_system_sound_proxy); |
185 | } |
186 | } |
187 | |
188 | @@ -138,7 +169,7 @@ |
189 | } |
190 | } |
191 | |
192 | - void new_proxy (GLib.Object? obj, AsyncResult res) { |
193 | + void new_sound_proxy (GLib.Object? obj, AsyncResult res) { |
194 | try { |
195 | this.proxy = Bus.get_proxy.end (res); |
196 | this.player = _player; |
197 | @@ -148,6 +179,45 @@ |
198 | } |
199 | } |
200 | |
201 | + void new_privacy_proxy (GLib.Object? obj, AsyncResult res) { |
202 | + try { |
203 | + this.privacyproxy = Bus.get_proxy.end (res); |
204 | + |
205 | + (this.privacyproxy as DBusProxy).g_properties_changed.connect((proxy, changed, invalid) => { |
206 | + var welcomeval = changed.lookup_value("MessagesWelcomeScreen", new VariantType("b")); |
207 | + if (welcomeval != null) { |
208 | + debug("Messages on welcome screen changed"); |
209 | + this.showDataOnGreeter = welcomeval.get_boolean(); |
210 | + } |
211 | + }); |
212 | + |
213 | + this.showDataOnGreeter = this.privacyproxy.messages_welcome_screen; |
214 | + } catch (Error e) { |
215 | + this.privacyproxy = null; |
216 | + warning("Unable to get proxy to user privacy settings: %s", e.message); |
217 | + } |
218 | + } |
219 | + |
220 | + void new_system_sound_proxy (GLib.Object? obj, AsyncResult res) { |
221 | + try { |
222 | + this.syssoundproxy = Bus.get_proxy.end (res); |
223 | + |
224 | + (this.syssoundproxy as DBusProxy).g_properties_changed.connect((proxy, changed, invalid) => { |
225 | + var silentvar = changed.lookup_value("SilentMode", new VariantType("b")); |
226 | + if (silentvar != null) { |
227 | + debug("Silent Mode changed"); |
228 | + this._silentMode = silentvar.get_boolean(); |
229 | + this.notify_property("silentMode"); |
230 | + } |
231 | + }); |
232 | + |
233 | + this.silentMode = this.syssoundproxy.silent_mode; |
234 | + } catch (Error e) { |
235 | + this.syssoundproxy = null; |
236 | + warning("Unable to get proxy to system sound settings: %s", e.message); |
237 | + } |
238 | + } |
239 | + |
240 | void greeter_proxy_new (GLib.Object? obj, AsyncResult res) { |
241 | try { |
242 | this.greeter = Bus.get_proxy.end (res); |
243 | |
244 | === modified file 'src/media-player-mpris.vala' |
245 | --- src/media-player-mpris.vala 2014-10-14 17:06:58 +0000 |
246 | +++ src/media-player-mpris.vala 2014-10-21 20:05:15 +0000 |
247 | @@ -283,7 +283,7 @@ |
248 | this.fetch_playlists (); |
249 | } |
250 | |
251 | - void update_current_track (Variant metadata) { |
252 | + void update_current_track (Variant? metadata) { |
253 | if (metadata != null) { |
254 | this.current_track = new Track ( |
255 | sanitize_metadata_value (metadata.lookup_value ("xesam:artist", null)), |
256 | |
257 | === modified file 'src/service.vala' |
258 | --- src/service.vala 2014-10-16 13:07:51 +0000 |
259 | +++ src/service.vala 2014-10-21 20:05:15 +0000 |
260 | @@ -27,22 +27,35 @@ |
261 | |
262 | this.volume_control = new VolumeControl (); |
263 | |
264 | + /* If we're on the greeter, don't export */ |
265 | + if (GLib.Environment.get_user_name() != "lightdm") { |
266 | + this.accounts_service = new AccountsServiceUser(); |
267 | + |
268 | + this.accounts_service.notify["showDataOnGreeter"].connect(() => { |
269 | + this.export_to_accounts_service = this.accounts_service.showDataOnGreeter; |
270 | + eventually_update_player_actions(); |
271 | + }); |
272 | + |
273 | + this.export_to_accounts_service = this.accounts_service.showDataOnGreeter; |
274 | + } |
275 | + |
276 | this.players = playerlist; |
277 | this.players.player_added.connect (this.player_added); |
278 | this.players.player_removed.connect (this.player_removed); |
279 | |
280 | this.actions = new SimpleActionGroup (); |
281 | this.actions.add_action_entries (action_entries, this); |
282 | + this.actions.add_action (this.create_silent_mode_action ()); |
283 | this.actions.add_action (this.create_mute_action ()); |
284 | this.actions.add_action (this.create_volume_action ()); |
285 | this.actions.add_action (this.create_mic_volume_action ()); |
286 | this.actions.add_action (this.create_high_volume_actions ()); |
287 | |
288 | this.menus = new HashTable<string, SoundMenu> (str_hash, str_equal); |
289 | - this.menus.insert ("desktop_greeter", new SoundMenu (null, SoundMenu.DisplayFlags.SHOW_MUTE | SoundMenu.DisplayFlags.HIDE_PLAYERS)); |
290 | - this.menus.insert ("phone_greeter", new SoundMenu (null, SoundMenu.DisplayFlags.HIDE_INACTIVE_PLAYERS)); |
291 | + this.menus.insert ("desktop_greeter", new SoundMenu (null, SoundMenu.DisplayFlags.SHOW_MUTE | SoundMenu.DisplayFlags.HIDE_PLAYERS | SoundMenu.DisplayFlags.GREETER_PLAYERS)); |
292 | + this.menus.insert ("phone_greeter", new SoundMenu (null, SoundMenu.DisplayFlags.SHOW_SILENT_MODE | SoundMenu.DisplayFlags.HIDE_INACTIVE_PLAYERS | SoundMenu.DisplayFlags.GREETER_PLAYERS)); |
293 | this.menus.insert ("desktop", new SoundMenu ("indicator.desktop-settings", SoundMenu.DisplayFlags.SHOW_MUTE)); |
294 | - this.menus.insert ("phone", new SoundMenu ("indicator.phone-settings", SoundMenu.DisplayFlags.HIDE_INACTIVE_PLAYERS)); |
295 | + this.menus.insert ("phone", new SoundMenu ("indicator.phone-settings", SoundMenu.DisplayFlags.SHOW_SILENT_MODE | SoundMenu.DisplayFlags.HIDE_INACTIVE_PLAYERS)); |
296 | |
297 | this.menus.@foreach ( (profile, menu) => { |
298 | this.volume_control.bind_property ("active-mic", menu, "show-mic-volume", BindingFlags.SYNC_CREATE); |
299 | @@ -52,10 +65,6 @@ |
300 | this.volume_control.bind_property ("high-volume", menu, "show-high-volume-warning", BindingFlags.SYNC_CREATE); |
301 | }); |
302 | |
303 | - /* Setup handling for the greeter-export setting */ |
304 | - this.settings.changed["greeter-export"].connect( () => this.build_accountsservice() ); |
305 | - build_accountsservice(); |
306 | - |
307 | this.sync_preferred_players (); |
308 | this.settings.changed["interested-media-players"].connect ( () => { |
309 | this.sync_preferred_players (); |
310 | @@ -79,25 +88,8 @@ |
311 | } |
312 | } |
313 | |
314 | - void build_accountsservice () { |
315 | - clear_acts_player(); |
316 | - this.accounts_service = null; |
317 | - |
318 | - /* If we're not exporting, don't build anything */ |
319 | - if (!this.settings.get_boolean("greeter-export")) { |
320 | - debug("Accounts service export disabled due to user setting"); |
321 | - return; |
322 | - } |
323 | - |
324 | - /* If we're on the greeter, don't export */ |
325 | - if (GLib.Environment.get_user_name() == "lightdm") { |
326 | - debug("Accounts service export disabled due to being used on the greeter"); |
327 | - return; |
328 | - } |
329 | - |
330 | - this.accounts_service = new AccountsServiceUser(); |
331 | - |
332 | - this.eventually_update_player_actions(); |
333 | + bool greeter_show_track () { |
334 | + return export_to_accounts_service; |
335 | } |
336 | |
337 | void clear_acts_player () { |
338 | @@ -175,6 +167,7 @@ |
339 | Notify.Notification notification; |
340 | bool syncing_preferred_players = false; |
341 | AccountsServiceUser? accounts_service = null; |
342 | + bool export_to_accounts_service = false; |
343 | |
344 | /* Maximum volume as a scaling factor between the volume action's state and the value in |
345 | * this.volume_control. See create_volume_action(). |
346 | @@ -275,6 +268,36 @@ |
347 | root_action.set_state (builder.end()); |
348 | } |
349 | |
350 | + Action create_silent_mode_action () { |
351 | + bool silentNow = false; |
352 | + if (this.accounts_service != null) { |
353 | + silentNow = this.accounts_service.silentMode; |
354 | + } |
355 | + |
356 | + var silent_action = new SimpleAction.stateful ("silent-mode", null, new Variant.boolean (silentNow)); |
357 | + |
358 | + /* If we're not dealing with accounts service, we'll just always be out |
359 | + of silent mode and that's cool. */ |
360 | + if (this.accounts_service == null) { |
361 | + return silent_action; |
362 | + } |
363 | + |
364 | + this.accounts_service.notify["silentMode"].connect(() => { |
365 | + silent_action.set_state(new Variant.boolean(this.accounts_service.silentMode)); |
366 | + this.update_root_icon (); |
367 | + }); |
368 | + |
369 | + silent_action.activate.connect ((action, param) => { |
370 | + action.change_state (new Variant.boolean (!action.get_state().get_boolean())); |
371 | + }); |
372 | + |
373 | + silent_action.change_state.connect ((action, val) => { |
374 | + this.accounts_service.silentMode = val.get_boolean(); |
375 | + }); |
376 | + |
377 | + return silent_action; |
378 | + } |
379 | + |
380 | Action create_mute_action () { |
381 | var mute_action = new SimpleAction.stateful ("mute", null, new Variant.boolean (this.volume_control.mute)); |
382 | |
383 | @@ -398,11 +421,11 @@ |
384 | this.loop.quit (); |
385 | } |
386 | |
387 | - Variant action_state_for_player (MediaPlayer player) { |
388 | + Variant action_state_for_player (MediaPlayer player, bool show_track = true) { |
389 | var builder = new VariantBuilder (new VariantType ("a{sv}")); |
390 | builder.add ("{sv}", "running", new Variant ("b", player.is_running)); |
391 | builder.add ("{sv}", "state", new Variant ("s", player.state)); |
392 | - if (player.current_track != null) { |
393 | + if (player.current_track != null && show_track) { |
394 | builder.add ("{sv}", "title", new Variant ("s", player.current_track.title)); |
395 | builder.add ("{sv}", "artist", new Variant ("s", player.current_track.artist)); |
396 | builder.add ("{sv}", "album", new Variant ("s", player.current_track.album)); |
397 | @@ -421,8 +444,14 @@ |
398 | action.set_enabled (player.can_raise); |
399 | } |
400 | |
401 | + SimpleAction? greeter_action = this.actions.lookup_action (player.id + ".greeter") as SimpleAction; |
402 | + if (greeter_action != null) { |
403 | + greeter_action.set_state (this.action_state_for_player (player, greeter_show_track())); |
404 | + greeter_action.set_enabled (player.can_raise); |
405 | + } |
406 | + |
407 | /* If we're playing then put that data in accounts service */ |
408 | - if (player.is_running && accounts_service != null) { |
409 | + if (player.is_running && export_to_accounts_service && accounts_service != null) { |
410 | accounts_service.player = player; |
411 | clear_accounts_player = false; |
412 | } |
413 | @@ -465,6 +494,11 @@ |
414 | action.activate.connect ( () => { player.activate (); }); |
415 | this.actions.add_action (action); |
416 | |
417 | + SimpleAction greeter_action = new SimpleAction.stateful (player.id + ".greeter", null, this.action_state_for_player (player, greeter_show_track())); |
418 | + greeter_action.set_enabled (player.can_raise); |
419 | + greeter_action.activate.connect ( () => { player.activate (); }); |
420 | + this.actions.add_action (greeter_action); |
421 | + |
422 | var play_action = new SimpleAction.stateful ("play." + player.id, null, player.state); |
423 | play_action.activate.connect ( () => player.play_pause () ); |
424 | this.actions.add_action (play_action); |
425 | |
426 | === modified file 'src/sound-menu.vala' |
427 | --- src/sound-menu.vala 2014-10-14 21:03:11 +0000 |
428 | +++ src/sound-menu.vala 2014-10-21 20:05:15 +0000 |
429 | @@ -23,7 +23,9 @@ |
430 | NONE = 0, |
431 | SHOW_MUTE = 1, |
432 | HIDE_INACTIVE_PLAYERS = 2, |
433 | - HIDE_PLAYERS = 4 |
434 | + HIDE_PLAYERS = 4, |
435 | + GREETER_PLAYERS = 8, |
436 | + SHOW_SILENT_MODE = 16 |
437 | } |
438 | |
439 | public SoundMenu (string? settings_action, DisplayFlags flags) { |
440 | @@ -33,8 +35,15 @@ |
441 | */ |
442 | |
443 | this.volume_section = new Menu (); |
444 | + |
445 | if ((flags & DisplayFlags.SHOW_MUTE) != 0) |
446 | volume_section.append (_("Mute"), "indicator.mute"); |
447 | + if ((flags & DisplayFlags.SHOW_SILENT_MODE) != 0) { |
448 | + var item = new MenuItem(_("Silent Mode"), "indicator.silent-mode"); |
449 | + item.set_attribute("x-canonical-type", "s", "com.canonical.indicator.switch"); |
450 | + volume_section.append_item(item); |
451 | + } |
452 | + |
453 | volume_section.append_item (this.create_slider_menu_item (_("Volume"), "indicator.volume(0)", 0.0, 1.0, 0.01, |
454 | "audio-volume-low-zero-panel", |
455 | "audio-volume-high-panel")); |
456 | @@ -59,6 +68,8 @@ |
457 | this.hide_players = (flags & DisplayFlags.HIDE_PLAYERS) != 0; |
458 | this.hide_inactive = (flags & DisplayFlags.HIDE_INACTIVE_PLAYERS) != 0; |
459 | this.notify_handlers = new HashTable<MediaPlayer, ulong> (direct_hash, direct_equal); |
460 | + |
461 | + this.greeter_players = (flags & DisplayFlags.GREETER_PLAYERS) != 0; |
462 | } |
463 | |
464 | public void export (DBusConnection connection, string object_path) { |
465 | @@ -172,6 +183,7 @@ |
466 | bool hide_inactive; |
467 | bool hide_players = false; |
468 | HashTable<MediaPlayer, ulong> notify_handlers; |
469 | + bool greeter_players = false; |
470 | |
471 | /* returns the position in this.menu of the section that's associated with @player */ |
472 | int find_player_section (MediaPlayer player) { |
473 | @@ -205,7 +217,11 @@ |
474 | if (icon == null) |
475 | icon = new ThemedIcon.with_default_fallbacks ("application-default-icon"); |
476 | |
477 | - var player_item = new MenuItem (player.name, "indicator." + player.id); |
478 | + var base_action = "indicator." + player.id; |
479 | + if (this.greeter_players) |
480 | + base_action += ".greeter"; |
481 | + |
482 | + var player_item = new MenuItem (player.name, base_action); |
483 | player_item.set_attribute ("x-canonical-type", "s", "com.canonical.unity.media-player"); |
484 | if (icon != null) |
485 | player_item.set_attribute_value ("icon", icon.serialize ()); |
486 | |
487 | === modified file 'src/volume-control.vala' |
488 | --- src/volume-control.vala 2014-10-15 14:45:39 +0000 |
489 | +++ src/volume-control.vala 2014-10-21 20:05:15 +0000 |
490 | @@ -586,7 +586,8 @@ |
491 | |
492 | bool set_volume_internal (double volume) |
493 | { |
494 | - return_val_if_fail (context.get_state () == Context.State.READY, false); |
495 | + if (context.get_state () != Context.State.READY) |
496 | + return false; |
497 | |
498 | if (_volume != volume) { |
499 | _volume = volume; |
Code looks fine and seems to work.
I don't see any specific tests for silent mode in the manual tests, but exploratory testing conducted on mako + rtm r102.