aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2014-10-02 09:40:53 -0500
committerTed Gould <ted@gould.cx>2014-10-02 09:40:53 -0500
commit0c348ae6792e65c95983d784207b81740d09abb9 (patch)
tree42992f8470749bb1fa1c7ec8c886518f9d02e779 /src
parent9df51f4ad93a7d69d526610a6817d428003de4d3 (diff)
downloadayatana-indicator-sound-0c348ae6792e65c95983d784207b81740d09abb9.tar.gz
ayatana-indicator-sound-0c348ae6792e65c95983d784207b81740d09abb9.tar.bz2
ayatana-indicator-sound-0c348ae6792e65c95983d784207b81740d09abb9.zip
Turn the system sound proxy into a silent mode property
Diffstat (limited to 'src')
-rw-r--r--src/accounts-service-user.vala29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/accounts-service-user.vala b/src/accounts-service-user.vala
index 2e59db3..08d5221 100644
--- a/src/accounts-service-user.vala
+++ b/src/accounts-service-user.vala
@@ -22,11 +22,13 @@ public class AccountsServiceUser : Object {
Act.User? user = null;
AccountsServiceSoundSettings? proxy = null;
AccountsServicePrivacySettings? privacyproxy = null;
+ AccountsServiceSystemSoundSettings? syssoundproxy = null;
uint timer = 0;
MediaPlayer? _player = null;
GreeterBroadcast? greeter = null;
public bool showDataOnGreeter { get; set; }
+ public bool silentMode { get; set; }
public MediaPlayer? player {
set {
@@ -136,6 +138,14 @@ public class AccountsServiceUser : Object {
DBusProxyFlags.GET_INVALIDATED_PROPERTIES,
null,
new_privacy_proxy);
+
+ Bus.get_proxy.begin<AccountsServiceSystemSoundSettings> (
+ BusType.SYSTEM,
+ "org.freedesktop.Accounts",
+ user.get_object_path(),
+ DBusProxyFlags.GET_INVALIDATED_PROPERTIES,
+ null,
+ new_system_sound_proxy);
}
}
@@ -178,6 +188,25 @@ public class AccountsServiceUser : Object {
}
}
+ void new_system_sound_proxy (GLib.Object? obj, AsyncResult res) {
+ try {
+ this.syssoundproxy = Bus.get_proxy.end (res);
+
+ (this.syssoundproxy as DBusProxy).g_properties_changed.connect((proxy, changed, invalid) => {
+ var silentvar = changed.lookup_value("SilentMode", new VariantType("b"));
+ if (silentvar != null) {
+ debug("Silent Mode changed");
+ this.silentMode = silentvar.get_boolean();
+ }
+ });
+
+ this.silentMode = this.syssoundproxy.silent_mode;
+ } catch (Error e) {
+ this.syssoundproxy = null;
+ warning("Unable to get proxy to system sound settings: %s", e.message);
+ }
+ }
+
void greeter_proxy_new (GLib.Object? obj, AsyncResult res) {
try {
this.greeter = Bus.get_proxy.end (res);