aboutsummaryrefslogtreecommitdiff
path: root/src/service.vala
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2014-10-14 12:08:00 -0500
committerTed Gould <ted@gould.cx>2014-10-14 12:08:00 -0500
commit2b4342f72a57c6b3d112fd6e923c544be789f6ea (patch)
treee89cd0ad054e3a94475661a67d6d89a4260caf9c /src/service.vala
parenta7ad5e0c977fbd4d1f0a3efa071bcffd0e5d6b13 (diff)
parent8e7cbaadfed452063b2d659bc679746cad5cbb14 (diff)
downloadayatana-indicator-sound-2b4342f72a57c6b3d112fd6e923c544be789f6ea.tar.gz
ayatana-indicator-sound-2b4342f72a57c6b3d112fd6e923c544be789f6ea.tar.bz2
ayatana-indicator-sound-2b4342f72a57c6b3d112fd6e923c544be789f6ea.zip
Grabbing the extreme volume warnings
Diffstat (limited to 'src/service.vala')
-rw-r--r--src/service.vala14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/service.vala b/src/service.vala
index 4e02769..94b0645 100644
--- a/src/service.vala
+++ b/src/service.vala
@@ -36,6 +36,7 @@ public class IndicatorSound.Service: Object {
this.actions.add_action (this.create_mute_action ());
this.actions.add_action (this.create_volume_action ());
this.actions.add_action (this.create_mic_volume_action ());
+ this.actions.add_action (this.create_high_volume_actions ());
this.menus = new HashTable<string, SoundMenu> (str_hash, str_equal);
this.menus.insert ("desktop_greeter", new SoundMenu (null, SoundMenu.DisplayFlags.SHOW_MUTE | SoundMenu.DisplayFlags.HIDE_PLAYERS));
@@ -47,6 +48,10 @@ public class IndicatorSound.Service: Object {
this.volume_control.bind_property ("active-mic", menu, "show-mic-volume", BindingFlags.SYNC_CREATE);
});
+ this.menus.@foreach ( (profile, menu) => {
+ this.volume_control.bind_property ("high-volume", menu, "show-high-volume-warning", BindingFlags.SYNC_CREATE);
+ });
+
/* Setup handling for the greeter-export setting */
this.settings.changed["greeter-export"].connect( () => this.build_accountsservice() );
build_accountsservice();
@@ -365,6 +370,15 @@ public class IndicatorSound.Service: Object {
return volume_action;
}
+ Action create_high_volume_actions () {
+ var high_volume_action = new SimpleAction.stateful("high-volume", null, new Variant.boolean (this.volume_control.high_volume));
+
+ this.volume_control.notify["high_volume"].connect( () =>
+ high_volume_action.set_state(new Variant.boolean (this.volume_control.high_volume)));
+
+ return high_volume_action;
+ }
+
void bus_acquired (DBusConnection connection, string name) {
try {
connection.export_action_group ("/com/canonical/indicator/sound", this.actions);