From 7a446003a31252ed8211f593a413d7c206e2b0fd Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 26 Sep 2014 14:22:31 -0500 Subject: Setup a proxy to get the property out of accounts service --- src/accounts-service-user.vala | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'src/accounts-service-user.vala') 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 ( + 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); -- cgit v1.2.3