aboutsummaryrefslogtreecommitdiff
path: root/src/service.vala
diff options
context:
space:
mode:
Diffstat (limited to 'src/service.vala')
-rw-r--r--src/service.vala23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/service.vala b/src/service.vala
index 2a65492..fd0c08d 100644
--- a/src/service.vala
+++ b/src/service.vala
@@ -49,6 +49,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 | SoundMenu.DisplayFlags.GREETER_PLAYERS));
@@ -60,6 +61,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);
+ });
+
this.sync_preferred_players ();
this.settings.changed["interested-media-players"].connect ( () => {
this.sync_preferred_players ();
@@ -69,7 +74,7 @@ public class IndicatorSound.Service: Object {
List<string> caps = Notify.get_server_caps ();
if (caps.find_custom ("x-canonical-private-synchronous", strcmp) != null) {
this.notification = new Notify.Notification ("indicator-sound", "", "");
- this.notification.set_hint_string ("x-canonical-private-synchronous", "indicator-sound");
+ this.notification.set_hint ("x-canonical-private-synchronous", "indicator-sound");
}
}
@@ -126,6 +131,9 @@ public class IndicatorSound.Service: Object {
}
set {
+ if (this.allow_amplified_volume == value)
+ return;
+
if (value) {
/* from pulse/volume.h: #define PA_VOLUME_UI_MAX (pa_sw_volume_from_dB(+11.0)) */
this.max_volume = (double)PulseAudio.Volume.sw_from_dB(11.0) / PulseAudio.Volume.NORM;
@@ -174,6 +182,8 @@ public class IndicatorSound.Service: Object {
double v = this.volume_control.get_volume () + volume_step_percentage * delta;
this.volume_control.set_volume (v.clamp (0.0, this.max_volume));
+ /* TODO: Don't want to mess up the desktop today, but we should remove this
+ scrolling change and merge that into volume control's notification */
if (this.notification != null) {
string icon;
if (v <= 0.0)
@@ -186,7 +196,7 @@ public class IndicatorSound.Service: Object {
icon = "notification-audio-volume-high";
this.notification.update ("indicator-sound", "", icon);
- this.notification.set_hint_int32 ("value", ((int32) (100 * v / this.max_volume)).clamp (-1, 101));
+ this.notification.set_hint ("value", ((int32) (100 * v / this.max_volume)).clamp (-1, 101));
try {
this.notification.show ();
}
@@ -388,6 +398,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);