Merge lp:~ted/indicator-sound/greeter-no-settings into lp:indicator-sound/13.10

Proposed by Ted Gould
Status: Merged
Approved by: Ted Gould
Approved revision: 389
Merged at revision: 387
Proposed branch: lp:~ted/indicator-sound/greeter-no-settings
Merge into: lp:indicator-sound/13.10
Diff against target: 68 lines (+14/-4)
3 files modified
data/com.canonical.indicator.sound (+1/-1)
src/service.vala (+1/-0)
src/sound-menu.vala (+12/-3)
To merge this branch: bzr merge lp:~ted/indicator-sound/greeter-no-settings
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Lars Karlitski (community) Approve
Review via email: mp+188911@code.launchpad.net

Commit message

Add a desktop_greeter menu without settings

Description of the change

Adds a greeter menu and makes it so we can configure whether menus have settings or not.

To post a comment you must log in.
389. By Ted Gould

Make sure to set the initial value of settings shown

Revision history for this message
Lars Karlitski (larsu) wrote :

That should do it. Thanks!

review: Approve
Revision history for this message
Ted Gould (ted) wrote :

Mterry verified it worked for his use-case in the greeter.

Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/com.canonical.indicator.sound'
2--- data/com.canonical.indicator.sound 2013-07-25 14:38:15 +0000
3+++ data/com.canonical.indicator.sound 2013-10-02 19:44:29 +0000
4@@ -10,4 +10,4 @@
5 ObjectPath=/com/canonical/indicator/sound/phone
6
7 [desktop_greeter]
8-ObjectPath=/com/canonical/indicator/sound/desktop
9+ObjectPath=/com/canonical/indicator/sound/desktop_greeter
10
11=== modified file 'src/service.vala'
12--- src/service.vala 2013-10-01 12:11:04 +0000
13+++ src/service.vala 2013-10-02 19:44:29 +0000
14@@ -34,6 +34,7 @@
15 this.actions.add_action (this.create_mic_volume_action ());
16
17 this.menus = new HashTable<string, SoundMenu> (str_hash, str_equal);
18+ this.menus.insert ("desktop_greeter", new SoundMenu (true, null));
19 this.menus.insert ("desktop", new SoundMenu (true, "indicator.desktop-settings"));
20 this.menus.insert ("phone", new SoundMenu (false, "indicator.phone-settings"));
21
22
23=== modified file 'src/sound-menu.vala'
24--- src/sound-menu.vala 2013-09-15 18:39:49 +0000
25+++ src/sound-menu.vala 2013-10-02 19:44:29 +0000
26@@ -22,7 +22,7 @@
27
28 class SoundMenu: Object
29 {
30- public SoundMenu (bool show_mute, string settings_action) {
31+ public SoundMenu (bool show_mute, string? settings_action) {
32 /* A sound menu always has at least two sections: the volume section (this.volume_section)
33 * at the start of the menu, and the settings section at the end. Between those two,
34 * it has a dynamic amount of player sections, one for each registered player.
35@@ -37,7 +37,11 @@
36
37 this.menu = new Menu ();
38 this.menu.append_section (null, volume_section);
39- this.menu.append (_("Sound Settingsā€¦"), settings_action);
40+
41+ if (settings_action != null) {
42+ settings_shown = true;
43+ this.menu.append (_("Sound Settingsā€¦"), settings_action);
44+ }
45
46 var root_item = new MenuItem (null, "indicator.root");
47 root_item.set_attribute ("x-canonical-type", "s", "com.canonical.indicator.root");
48@@ -96,7 +100,11 @@
49 player.notify["is-running"].connect ( () => this.update_playlists (player) );
50 update_playlists (player);
51
52- this.menu.insert_section (this.menu.get_n_items () -1, null, section);
53+ if (settings_shown) {
54+ this.menu.insert_section (this.menu.get_n_items () -1, null, section);
55+ } else {
56+ this.menu.append_section (null, section);
57+ }
58 }
59
60 public void remove_player (MediaPlayer player) {
61@@ -109,6 +117,7 @@
62 Menu menu;
63 Menu volume_section;
64 bool mic_volume_shown;
65+ bool settings_shown = false;
66
67 /* returns the position in this.menu of the section that's associated with @player */
68 int find_player_section (MediaPlayer player) {

Subscribers

People subscribed via source and target branches