diff options
author | Ted Gould <ted@gould.cx> | 2014-09-26 14:22:31 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2014-09-26 14:22:31 -0500 |
commit | 7a446003a31252ed8211f593a413d7c206e2b0fd (patch) | |
tree | 9c5868244ff0ff6fd612c4ec386bd7caca839bcd | |
parent | 494c5dd4e52319a923402dcf338a31cccb4c9204 (diff) | |
download | ayatana-indicator-sound-7a446003a31252ed8211f593a413d7c206e2b0fd.tar.gz ayatana-indicator-sound-7a446003a31252ed8211f593a413d7c206e2b0fd.tar.bz2 ayatana-indicator-sound-7a446003a31252ed8211f593a413d7c206e2b0fd.zip |
Setup a proxy to get the property out of accounts service
-rw-r--r-- | src/accounts-service-user.vala | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/src/accounts-service-user.vala b/src/accounts-service-user.vala index 04c38cc..14d129d 100644 --- a/src/accounts-service-user.vala +++ b/src/accounts-service-user.vala @@ -21,10 +21,13 @@ public class AccountsServiceUser : Object { Act.UserManager accounts_manager = Act.UserManager.get_default(); Act.User? user = null; AccountsServiceSoundSettings? proxy = null; + AccountsServicePrivacySettings? privacyproxy = null; uint timer = 0; MediaPlayer? _player = null; GreeterBroadcast? greeter = null; + public bool showDataOnGreeter = false; + public MediaPlayer? player { set { this._player = value; @@ -124,7 +127,15 @@ public class AccountsServiceUser : Object { user.get_object_path(), DBusProxyFlags.GET_INVALIDATED_PROPERTIES, null, - new_proxy); + new_sound_proxy); + + Bus.get_proxy.begin<AccountsServicePrivacySettings> ( + BusType.SYSTEM, + "org.freedesktop.Accounts", + user.get_object_path(), + DBusProxyFlags.GET_INVALIDATED_PROPERTIES, + null, + new_privacy_proxy); } } @@ -138,7 +149,7 @@ public class AccountsServiceUser : Object { } } - void new_proxy (GLib.Object? obj, AsyncResult res) { + void new_sound_proxy (GLib.Object? obj, AsyncResult res) { try { this.proxy = Bus.get_proxy.end (res); this.player = _player; @@ -148,6 +159,24 @@ public class AccountsServiceUser : Object { } } + void new_privacy_proxy (GLib.Object? obj, AsyncResult res) { + try { + this.privacyproxy = Bus.get_proxy.end (res); + + (this.privacyproxy as DBusProxy).g_properties_changed.connect((proxy, changed, invalid) => { + var welcomeval = changed.lookup("MessagesWelcomeScreen", "b", null); + if (welcomeval) { + this.showDataOnGreeter = welcomeval; + } + }); + + this.showDataOnGreeter = this.privacyproxy.messages_welcome_screen; + } catch (Error e) { + this.privacyproxy = null; + warning("Unable to get proxy to user privacy settings: %s", e.message); + } + } + void greeter_proxy_new (GLib.Object? obj, AsyncResult res) { try { this.greeter = Bus.get_proxy.end (res); |