aboutsummaryrefslogtreecommitdiff
path: root/src/sound-menu.vala
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2014-10-14 10:07:30 -0500
committerTed Gould <ted@gould.cx>2014-10-14 10:07:30 -0500
commit16828d0102efae82bf760097988474e434b884fd (patch)
tree730a2dac6282a7f1cff3000ea9ff2284847d16e5 /src/sound-menu.vala
parent23b3fd431a312f2b02504b998c697241c30caa0b (diff)
downloadayatana-indicator-sound-16828d0102efae82bf760097988474e434b884fd.tar.gz
ayatana-indicator-sound-16828d0102efae82bf760097988474e434b884fd.tar.bz2
ayatana-indicator-sound-16828d0102efae82bf760097988474e434b884fd.zip
Changing tact to change the menu when we want to show the warning
Diffstat (limited to 'src/sound-menu.vala')
-rw-r--r--src/sound-menu.vala27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/sound-menu.vala b/src/sound-menu.vala
index 0094c22..e1c4e98 100644
--- a/src/sound-menu.vala
+++ b/src/sound-menu.vala
@@ -25,9 +25,7 @@ public class SoundMenu: Object
HIDE_INACTIVE_PLAYERS = 2,
HIDE_PLAYERS = 4,
GREETER_PLAYERS = 8,
- SHOW_SILENT_MODE = 16,
- HIGH_VOLUME_WARNING = 32 /* Everyone should get this eventually, but we don't
- want it in the desktop initially because of freezes */
+ SHOW_SILENT_MODE = 16
}
public SoundMenu (string? settings_action, DisplayFlags flags) {
@@ -50,9 +48,6 @@ public class SoundMenu: Object
"audio-volume-low-zero-panel",
"audio-volume-high-panel"));
- if ((flags & DisplayFlags.HIGH_VOLUME_WARNING) != 0)
- volume_section.append (_("High volume can damage your hearing."), "indicator.high-volume-menu");
-
this.menu = new Menu ();
this.menu.append_section (null, volume_section);
@@ -98,12 +93,31 @@ public class SoundMenu: Object
this.mic_volume_shown = true;
}
else if (!value && this.mic_volume_shown) {
+ /* TODO: Make smarter */
this.volume_section.remove (this.volume_section.get_n_items () -1);
this.mic_volume_shown = false;
}
}
}
+ public bool show_high_volume_warning {
+ get {
+ return this.high_volume_warning_shown;
+ }
+ set {
+ if (value && !this.high_volume_warning_shown) {
+ var item = new MenuItem(_("High volume can damage your hearing."), null);
+ volume_section.append_item (item);
+ this.high_volume_warning_shown = true;
+ }
+ else if (!value && this.high_volume_warning_shown) {
+ /* TODO: Make smarter */
+ this.volume_section.remove (this.volume_section.get_n_items () -1);
+ this.high_volume_warning_shown = false;
+ }
+ }
+ }
+
public void add_player (MediaPlayer player) {
if (this.notify_handlers.contains (player))
return;
@@ -146,6 +160,7 @@ public class SoundMenu: Object
Menu volume_section;
bool mic_volume_shown;
bool settings_shown = false;
+ bool high_volume_warning_shown = false;
bool hide_inactive;
bool hide_players = false;
HashTable<MediaPlayer, ulong> notify_handlers;