~mterry/indicator-sound/snap-root

« back to all changes in this revision

Viewing changes to src/sound-menu.vala

  • Committer: CI Train Bot
  • Author(s): Xavi Garcia Mena
  • Date: 2016-01-05 15:08:24 UTC
  • mfrom: (509.2.16 indicator-sound-action-sync)
  • Revision ID: ci-train-bot@canonical.com-20160105150824-1njwom14qewljjlh
Adds an action to signal the UI to sync the current volume when we are waiting for the user to confirm or reject the high volume notification. Fixes: #1512798, #1520548
Approved by: PS Jenkins bot, Charles Kerr, Nick Dedekind

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
 
47
47
                volume_section.append_item (this.create_slider_menu_item (_("Volume"), "indicator.volume(0)", 0.0, 1.0, 0.01,
48
48
                                                                                                                                  "audio-volume-low-zero-panel",
49
 
                                                                                                                                  "audio-volume-high-panel"));
 
49
                                                                                                                                  "audio-volume-high-panel", true));
50
50
 
51
51
                this.menu = new Menu ();
52
52
                this.menu.append_section (null, volume_section);
101
101
                        if (value && !this.mic_volume_shown) {
102
102
                                var slider = this.create_slider_menu_item (_("Microphone Volume"), "indicator.mic-volume", 0.0, 1.0, 0.01,
103
103
                                                                                                                   "audio-input-microphone-low-zero-panel",
104
 
                                                                                                                   "audio-input-microphone-high-panel");
 
104
                                                                                                                   "audio-input-microphone-high-panel", false);
105
105
                                volume_section.append_item (slider);
106
106
                                this.mic_volume_shown = true;
107
107
                        }
227
227
                        this.volume_section.remove (index);
228
228
                        this.volume_section.insert_item (index, this.create_slider_menu_item (_(label), "indicator.volume(0)", 0.0, 1.0, 0.01,
229
229
                                                                                                                                  "audio-volume-low-zero-panel",
230
 
                                                                                                                                  "audio-volume-high-panel"));
 
230
                                                                                                                                  "audio-volume-high-panel", true));
231
231
                }
232
232
        }
233
233
 
386
386
                }
387
387
        }
388
388
 
389
 
        MenuItem create_slider_menu_item (string label, string action, double min, double max, double step, string min_icon_name, string max_icon_name) {
 
389
        MenuItem create_slider_menu_item (string label, string action, double min, double max, double step, string min_icon_name, string max_icon_name, bool sync_action) {
390
390
                var min_icon = new ThemedIcon.with_default_fallbacks (min_icon_name);
391
391
                var max_icon = new ThemedIcon.with_default_fallbacks (max_icon_name);
392
392
 
397
397
                slider.set_attribute ("min-value", "d", min);
398
398
                slider.set_attribute ("max-value", "d", max);
399
399
                slider.set_attribute ("step", "d", step);
 
400
                if (sync_action) {
 
401
                        slider.set_attribute ("x-canonical-sync-action", "s", "indicator.volume-sync");
 
402
                }
400
403
 
401
404
                return slider;
402
405
        }