~ted/indicator-sound/silent-mode-startup-trunk

« back to all changes in this revision

Viewing changes to src/sound-menu.vala

  • Committer: CI bot
  • Author(s): Ted Gould
  • Date: 2014-10-21 20:06:33 UTC
  • mfrom: (456.5.3 rtm-silent-mode-item)
  • Revision ID: ps-jenkins@lists.canonical.com-20141021200633-7m609lu2zgdce7vl
Enable silent mode checkbox on RTM 

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
                NONE = 0,
24
24
                SHOW_MUTE = 1,
25
25
                HIDE_INACTIVE_PLAYERS = 2,
26
 
                HIDE_PLAYERS = 4
 
26
                HIDE_PLAYERS = 4,
 
27
                GREETER_PLAYERS = 8,
 
28
                SHOW_SILENT_MODE = 16
27
29
        }
28
30
 
29
31
        public SoundMenu (string? settings_action, DisplayFlags flags) {
33
35
                 */
34
36
 
35
37
                this.volume_section = new Menu ();
 
38
 
36
39
                if ((flags & DisplayFlags.SHOW_MUTE) != 0)
37
40
                        volume_section.append (_("Mute"), "indicator.mute");
 
41
                if ((flags & DisplayFlags.SHOW_SILENT_MODE) != 0) {
 
42
                        var item = new MenuItem(_("Silent Mode"), "indicator.silent-mode");
 
43
                        item.set_attribute("x-canonical-type", "s", "com.canonical.indicator.switch");
 
44
                        volume_section.append_item(item);
 
45
                }
 
46
 
38
47
                volume_section.append_item (this.create_slider_menu_item (_("Volume"), "indicator.volume(0)", 0.0, 1.0, 0.01,
39
48
                                                                                                                                  "audio-volume-low-zero-panel",
40
49
                                                                                                                                  "audio-volume-high-panel"));
59
68
                this.hide_players = (flags & DisplayFlags.HIDE_PLAYERS) != 0;
60
69
                this.hide_inactive = (flags & DisplayFlags.HIDE_INACTIVE_PLAYERS) != 0;
61
70
                this.notify_handlers = new HashTable<MediaPlayer, ulong> (direct_hash, direct_equal);
 
71
 
 
72
                this.greeter_players = (flags & DisplayFlags.GREETER_PLAYERS) != 0;
62
73
        }
63
74
 
64
75
        public void export (DBusConnection connection, string object_path) {
172
183
        bool hide_inactive;
173
184
        bool hide_players = false;
174
185
        HashTable<MediaPlayer, ulong> notify_handlers;
 
186
        bool greeter_players = false;
175
187
 
176
188
        /* returns the position in this.menu of the section that's associated with @player */
177
189
        int find_player_section (MediaPlayer player) {
205
217
                if (icon == null)
206
218
                        icon = new ThemedIcon.with_default_fallbacks ("application-default-icon");
207
219
 
208
 
                var player_item = new MenuItem (player.name, "indicator." + player.id);
 
220
                var base_action = "indicator." + player.id;
 
221
                if (this.greeter_players)
 
222
                        base_action += ".greeter";
 
223
 
 
224
                var player_item = new MenuItem (player.name, base_action);
209
225
                player_item.set_attribute ("x-canonical-type", "s", "com.canonical.unity.media-player");
210
226
                if (icon != null)
211
227
                        player_item.set_attribute_value ("icon", icon.serialize ());