diff options
-rw-r--r-- | data/com.canonical.indicator.sound | 3 | ||||
-rw-r--r-- | debian/changelog | 18 | ||||
-rw-r--r-- | src/service.vala | 11 | ||||
-rw-r--r-- | src/sound-menu.vala | 2 | ||||
-rw-r--r-- | src/volume-control.vala | 19 |
5 files changed, 49 insertions, 4 deletions
diff --git a/data/com.canonical.indicator.sound b/data/com.canonical.indicator.sound index 213be0b..eca0e4a 100644 --- a/data/com.canonical.indicator.sound +++ b/data/com.canonical.indicator.sound @@ -11,3 +11,6 @@ ObjectPath=/com/canonical/indicator/sound/phone [desktop_greeter] ObjectPath=/com/canonical/indicator/sound/desktop_greeter + +[ubiquity] +ObjectPath=/com/canonical/indicator/sound/desktop_greeter diff --git a/debian/changelog b/debian/changelog index 93b3c57..cd9a47e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,21 @@ +indicator-sound (12.10.2+13.10.20131011-0ubuntu2) UNRELEASED; urgency=low + + * Define "ubiquity" indicator profile, reusing the greeter object. (LP: + #1241539) + + -- Dmitrijs Ledkovs <xnox@ubuntu.com> Fri, 18 Oct 2013 13:10:03 +0100 + +indicator-sound (12.10.2+13.10.20131011-0ubuntu1) saucy; urgency=low + + [ Lars Uebernickel ] + * Allow activating the 'volume' action It does the same as the + 'scroll' action except showing a notification. (LP: #1236292) + + [ Ubuntu daily release ] + * Automatic snapshot from revision 389 + + -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Fri, 11 Oct 2013 04:27:50 +0000 + indicator-sound (12.10.2+13.10.20131004-0ubuntu1) saucy; urgency=low [ Pete Woods ] diff --git a/src/service.vala b/src/service.vala index 98a0bec..393a1ea 100644 --- a/src/service.vala +++ b/src/service.vala @@ -87,8 +87,9 @@ public class IndicatorSound.Service { uint player_action_update_id; Notify.Notification notification; + const double volume_step_percentage = 0.06; + void activate_scroll_action (SimpleAction action, Variant? param) { - const double volume_step_percentage = 0.06; int delta = param.get_int32(); /* positive for up, negative for down */ double v = this.volume_control.get_volume () + volume_step_percentage * delta; @@ -202,12 +203,18 @@ public class IndicatorSound.Service { } Action create_volume_action () { - var volume_action = new SimpleAction.stateful ("volume", null, this.volume_control.get_volume ()); + var volume_action = new SimpleAction.stateful ("volume", VariantType.INT32, this.volume_control.get_volume ()); volume_action.change_state.connect ( (action, val) => { volume_control.set_volume (val.get_double ()); }); + /* activating this action changes the volume by the amount given in the parameter */ + volume_action.activate.connect ( (action, param) => { + double v = volume_control.get_volume () + volume_step_percentage * param.get_int32 (); + volume_control.set_volume (v.clamp (0.0, 1.0)); + }); + this.volume_control.volume_changed.connect (volume_changed); this.volume_control.bind_property ("ready", volume_action, "enabled", BindingFlags.SYNC_CREATE); diff --git a/src/sound-menu.vala b/src/sound-menu.vala index 0168f28..e1c5c1f 100644 --- a/src/sound-menu.vala +++ b/src/sound-menu.vala @@ -37,7 +37,7 @@ class SoundMenu: Object this.volume_section = new Menu (); if ((flags & DisplayFlags.SHOW_MUTE) != 0) volume_section.append (_("Mute"), "indicator.mute"); - volume_section.append_item (this.create_slider_menu_item ("indicator.volume", 0.0, 1.0, 0.01, + volume_section.append_item (this.create_slider_menu_item ("indicator.volume(0)", 0.0, 1.0, 0.01, "audio-volume-low-zero-panel", "audio-volume-high-panel")); diff --git a/src/volume-control.vala b/src/volume-control.vala index 18c407f..4ca9537 100644 --- a/src/volume-control.vala +++ b/src/volume-control.vala @@ -27,6 +27,8 @@ public class VolumeControl : Object /* this is static to ensure it being freed after @context (loop does not have ref counting) */ private static PulseAudio.GLibMainLoop loop; + private uint _reconnect_timer = 0; + private PulseAudio.Context context; private bool _mute = true; private double _volume = 0.0; @@ -49,6 +51,13 @@ public class VolumeControl : Object this.reconnect_to_pulse (); } + ~VolumeControl () + { + if (_reconnect_timer != 0) { + Source.remove (_reconnect_timer); + } + } + /* PulseAudio logic*/ private void context_events_cb (Context c, Context.SubscriptionEventType t, uint32 index) { @@ -152,7 +161,8 @@ public class VolumeControl : Object case Context.State.FAILED: case Context.State.TERMINATED: - this.reconnect_to_pulse (); + if (_reconnect_timer == 0) + _reconnect_timer = Timeout.add_seconds (2, reconnect_timeout); break; default: @@ -161,6 +171,13 @@ public class VolumeControl : Object } } + bool reconnect_timeout () + { + _reconnect_timer = 0; + reconnect_to_pulse (); + return false; // G_SOURCE_REMOVE + } + void reconnect_to_pulse () { if (this.ready) { |