aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorXavi Garcia Mena <xavi.garcia.mena@canonical.com>2016-03-03 09:59:37 +0100
committerXavi Garcia Mena <xavi.garcia.mena@canonical.com>2016-03-03 09:59:37 +0100
commit3aa67455801c7db139be5a9293ddb6d7d703a981 (patch)
treeb8186a4701bbafcf9fc9a71bbcb35fd9b3ee81d1 /src
parent7604867025faaf3b015193ca89454b72d981bd58 (diff)
downloadayatana-indicator-sound-3aa67455801c7db139be5a9293ddb6d7d703a981.tar.gz
ayatana-indicator-sound-3aa67455801c7db139be5a9293ddb6d7d703a981.tar.bz2
ayatana-indicator-sound-3aa67455801c7db139be5a9293ddb6d7d703a981.zip
Added Cancellable to AccountsServiceAccess
Diffstat (limited to 'src')
-rw-r--r--src/accounts-service-access.vala9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/accounts-service-access.vala b/src/accounts-service-access.vala
index aa9622d..2c73922 100644
--- a/src/accounts-service-access.vala
+++ b/src/accounts-service-access.vala
@@ -36,14 +36,17 @@ public class AccountsServiceAccess : Object
private double _volume = 0.0;
private string _last_running_player = "";
private bool _mute = false;
+ private Cancellable _dbus_call_cancellable;
public AccountsServiceAccess ()
{
+ _dbus_call_cancellable = new Cancellable ();
setup_accountsservice.begin ();
}
~AccountsServiceAccess ()
{
+ _dbus_call_cancellable.cancel ();
}
public string last_running_player
@@ -197,7 +200,7 @@ public class AccountsServiceAccess : Object
return;
try {
- yield _user_proxy.get_connection ().call (_user_proxy.get_name (), _user_proxy.get_object_path (), "org.freedesktop.DBus.Properties", "Set", new Variant ("(ssv)", _user_proxy.get_interface_name (), "LastRunningPlayer", new Variant ("s", last_running_player)), null, DBusCallFlags.NONE, -1);
+ yield _user_proxy.get_connection ().call (_user_proxy.get_name (), _user_proxy.get_object_path (), "org.freedesktop.DBus.Properties", "Set", new Variant ("(ssv)", _user_proxy.get_interface_name (), "LastRunningPlayer", new Variant ("s", last_running_player)), null, DBusCallFlags.NONE, -1, _dbus_call_cancellable);
} catch (GLib.Error e) {
warning ("unable to sync last running player %s to AccountsService: %s",last_running_player, e.message);
}
@@ -210,7 +213,7 @@ public class AccountsServiceAccess : Object
return;
try {
- yield _user_proxy.get_connection ().call (_user_proxy.get_name (), _user_proxy.get_object_path (), "org.freedesktop.DBus.Properties", "Set", new Variant ("(ssv)", _user_proxy.get_interface_name (), "Volume", new Variant ("d", volume)), null, DBusCallFlags.NONE, -1);
+ yield _user_proxy.get_connection ().call (_user_proxy.get_name (), _user_proxy.get_object_path (), "org.freedesktop.DBus.Properties", "Set", new Variant ("(ssv)", _user_proxy.get_interface_name (), "Volume", new Variant ("d", volume)), null, DBusCallFlags.NONE, -1, _dbus_call_cancellable);
} catch (GLib.Error e) {
warning ("unable to sync volume %f to AccountsService: %s", volume, e.message);
}
@@ -222,7 +225,7 @@ public class AccountsServiceAccess : Object
return;
try {
- yield _user_proxy.get_connection ().call (_user_proxy.get_name (), _user_proxy.get_object_path (), "org.freedesktop.DBus.Properties", "Set", new Variant ("(ssv)", _user_proxy.get_interface_name (), "Muted", new Variant ("b", mute)), null, DBusCallFlags.NONE, -1);
+ yield _user_proxy.get_connection ().call (_user_proxy.get_name (), _user_proxy.get_object_path (), "org.freedesktop.DBus.Properties", "Set", new Variant ("(ssv)", _user_proxy.get_interface_name (), "Muted", new Variant ("b", mute)), null, DBusCallFlags.NONE, -1, _dbus_call_cancellable);
} catch (GLib.Error e) {
warning ("unable to sync mute %s to AccountsService: %s", mute ? "true" : "false", e.message);
}