~marcustomlinson/indicator-sound/fix-scroll-wheel-step-sizes

« back to all changes in this revision

Viewing changes to src/sound-menu.vala

  • Committer: Tarmac
  • Author(s): Ted Gould
  • Date: 2013-10-02 20:37:13 UTC
  • mfrom: (386.1.3 greeter-no-settings)
  • Revision ID: tarmac-20131002203713-a8y3q72aee82mey2
Add a desktop_greeter menu without settings.

Approved by PS Jenkins bot, Lars Uebernickel.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
class SoundMenu: Object
24
24
{
25
 
        public SoundMenu (bool show_mute, string settings_action) {
 
25
        public SoundMenu (bool show_mute, string? settings_action) {
26
26
                /* A sound menu always has at least two sections: the volume section (this.volume_section)
27
27
                 * at the start of the menu, and the settings section at the end. Between those two,
28
28
                 * it has a dynamic amount of player sections, one for each registered player.
37
37
 
38
38
                this.menu = new Menu ();
39
39
                this.menu.append_section (null, volume_section);
40
 
                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
                }
41
45
 
42
46
                var root_item = new MenuItem (null, "indicator.root");
43
47
                root_item.set_attribute ("x-canonical-type", "s", "com.canonical.indicator.root");
96
100
                player.notify["is-running"].connect ( () => this.update_playlists (player) );
97
101
                update_playlists (player);
98
102
 
99
 
                this.menu.insert_section (this.menu.get_n_items () -1, null, section);
 
103
                if (settings_shown) {
 
104
                        this.menu.insert_section (this.menu.get_n_items () -1, null, section);
 
105
                } else {
 
106
                        this.menu.append_section (null, section);
 
107
                }
100
108
        }
101
109
 
102
110
        public void remove_player (MediaPlayer player) {
109
117
        Menu menu;
110
118
        Menu volume_section;
111
119
        bool mic_volume_shown;
 
120
        bool settings_shown = false;
112
121
 
113
122
        /* returns the position in this.menu of the section that's associated with @player */
114
123
        int find_player_section (MediaPlayer player) {