diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/service.vala | 4 | ||||
-rw-r--r-- | src/sound-menu.vala | 3 | ||||
-rw-r--r-- | src/volume-control.vala | 25 |
3 files changed, 22 insertions, 10 deletions
diff --git a/src/service.vala b/src/service.vala index fa8bbdc..fd0c08d 100644 --- a/src/service.vala +++ b/src/service.vala @@ -74,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"); } } @@ -196,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 (); } diff --git a/src/sound-menu.vala b/src/sound-menu.vala index a9efd74..3881faf 100644 --- a/src/sound-menu.vala +++ b/src/sound-menu.vala @@ -118,7 +118,6 @@ public class SoundMenu: Object while ((location = find_action(this.volume_section, "indicator.high-volume-warning-item")) != -1) { this.volume_section.remove (location); } - this.volume_section.remove (this.volume_section.get_n_items () -1); this.high_volume_warning_shown = false; } } @@ -128,7 +127,7 @@ public class SoundMenu: Object int n = menu.get_n_items (); for (int i = 0; i < n; i++) { string action; - menu.get_item_attribute (0, "action", "s", out action); + menu.get_item_attribute (i, "action", "s", out action); if (in_action == action) return i; } diff --git a/src/volume-control.vala b/src/volume-control.vala index 6f48c5d..295ebf5 100644 --- a/src/volume-control.vala +++ b/src/volume-control.vala @@ -69,7 +69,6 @@ public class VolumeControl : Object private bool _send_next_local_volume = false; private double _account_service_volume = 0.0; private Notify.Notification _notification; - private bool _active_port_headphone = false; public signal void volume_changed (double v); @@ -605,6 +604,16 @@ public class VolumeControl : Object { /* Using this to detect whether we're on the phone or not */ if (_pulse_use_stream_restore) { +<<<<<<< TREE + if (volume == 0.0) + _notification.update (_("Volume"), "", "audio-volume-muted"); + if (volume > 0.0 && volume <= 0.33) + _notification.update (_("Volume"), "", "audio-volume-low"); + if (volume > 0.33 && volume <= 0.66) + _notification.update (_("Volume"), "", "audio-volume-medium"); + if (volume > 0.66 && volume <= 1.0) + _notification.update (_("Volume"), "", "audio-volume-high"); +======= /* Watch for extreme */ if (volume > 0.75 && _active_port_headphone) high_volume = true; @@ -776,7 +785,7 @@ public class VolumeControl : Object } /* AccountsService operations */ - private void accountsservice_props_changed_cb (DBusProxy proxy, Variant changed_properties, string[] invalidated_properties) + private void accountsservice_props_changed_cb (DBusProxy proxy, Variant changed_properties, string[]? invalidated_properties) { Variant volume_variant = changed_properties.lookup_value ("Volume", new VariantType ("d")); if (volume_variant != null) { @@ -834,10 +843,14 @@ public class VolumeControl : Object // Get current values and listen for changes _user_proxy.g_properties_changed.connect (accountsservice_props_changed_cb); - var props_variant = yield _user_proxy.get_connection ().call (_user_proxy.get_name (), _user_proxy.get_object_path (), "org.freedesktop.DBus.Properties", "GetAll", new Variant ("(s)", _user_proxy.get_interface_name ()), null, DBusCallFlags.NONE, -1); - Variant props; - props_variant.get ("(@a{sv})", out props); - accountsservice_props_changed_cb(_user_proxy, props, null); + try { + var props_variant = yield _user_proxy.get_connection ().call (_user_proxy.get_name (), _user_proxy.get_object_path (), "org.freedesktop.DBus.Properties", "GetAll", new Variant ("(s)", _user_proxy.get_interface_name ()), null, DBusCallFlags.NONE, -1); + Variant props; + props_variant.get ("(@a{sv})", out props); + accountsservice_props_changed_cb(_user_proxy, props, null); + } catch (GLib.Error e) { + debug("Unable to get properties for user %s at first try: %s", username, e.message); + } } private void greeter_user_changed (string username) |