aboutsummaryrefslogtreecommitdiff
path: root/src/volume-control.vala
diff options
context:
space:
mode:
Diffstat (limited to 'src/volume-control.vala')
-rw-r--r--src/volume-control.vala20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/volume-control.vala b/src/volume-control.vala
index 0541397..dd1128c 100644
--- a/src/volume-control.vala
+++ b/src/volume-control.vala
@@ -179,6 +179,7 @@ public class VolumeControl : Object
{
_volume = volume_to_double (i.volume.max ());
volume_changed (_volume);
+ start_local_volume_timer();
}
}
@@ -247,6 +248,7 @@ public class VolumeControl : Object
/* Someone else changed the volume for this role, reflect on the indicator */
_volume = volume_to_double (volume);
volume_changed (_volume);
+ start_local_volume_timer();
}
}
}
@@ -289,6 +291,7 @@ public class VolumeControl : Object
_volume = volume_to_double (volume);
volume_changed (_volume);
+ start_local_volume_timer();
} catch (GLib.Error e) {
warning ("unable to get volume for active role %s (%s)", sink_input_objp, e.message);
}
@@ -561,7 +564,8 @@ public class VolumeControl : Object
bool set_volume_internal (double volume)
{
- return_val_if_fail (context.get_state () == Context.State.READY, false);
+ if (context.get_state () != Context.State.READY)
+ return false;
if (_volume != volume) {
_volume = volume;
@@ -720,7 +724,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) {
@@ -778,10 +782,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)