aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2014-09-22 13:51:16 -0500
committerTed Gould <ted@gould.cx>2014-09-22 13:51:16 -0500
commite44aeafe24ab18e07a23e8fc7f3cf53a7b1431f8 (patch)
tree86b40b6ec40405bc54db4a225cd63b1f5b938c09 /src
parentb255d5ab480f889d96d9b4fc42ba3e0977975660 (diff)
downloadayatana-indicator-messages-e44aeafe24ab18e07a23e8fc7f3cf53a7b1431f8.tar.gz
ayatana-indicator-messages-e44aeafe24ab18e07a23e8fc7f3cf53a7b1431f8.tar.bz2
ayatana-indicator-messages-e44aeafe24ab18e07a23e8fc7f3cf53a7b1431f8.zip
Setup and get our proxy
Diffstat (limited to 'src')
-rw-r--r--src/im-accounts-service.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/im-accounts-service.c b/src/im-accounts-service.c
index 1dcce7f..cea5866 100644
--- a/src/im-accounts-service.c
+++ b/src/im-accounts-service.c
@@ -29,6 +29,7 @@ typedef struct _ImAccountsServicePrivate ImAccountsServicePrivate;
struct _ImAccountsServicePrivate {
ActUserManager * user_manager;
+ GDBusProxy * touch_settings;
};
#define IM_ACCOUNTS_SERVICE_GET_PRIVATE(o) \
@@ -40,6 +41,7 @@ static void im_accounts_service_dispose (GObject *object);
static void im_accounts_service_finalize (GObject *object);
static void user_changed (ActUserManager * manager, ActUser * user, gpointer user_data);
static void is_loaded (ActUserManager * manager, GParamSpec * pspect, gpointer user_data);
+static void security_privacy_ready (GObject * obj, GAsyncResult * res, gpointer user_data);
G_DEFINE_TYPE (ImAccountsService, im_accounts_service, G_TYPE_OBJECT);
@@ -88,7 +90,38 @@ user_changed (ActUserManager * manager, ActUser * user, gpointer user_data)
return;
}
+ ImAccountsServicePrivate * priv = IM_ACCOUNTS_SERVICE_GET_PRIVATE(user_data);
g_debug("User Updated");
+
+ /* Clear old proxies */
+ g_clear_object(&priv->touch_settings);
+
+ /* Start getting a new proxy */
+ g_dbus_proxy_new_for_bus(G_BUS_TYPE_SYSTEM,
+ G_DBUS_PROXY_FLAGS_NONE,
+ NULL,
+ "org.freedesktop.Accounts",
+ act_user_get_object_path(user),
+ "com.ubuntu.touch.AccountsService.SecurityPrivacy",
+ NULL,
+ security_privacy_ready,
+ user_data);
+}
+
+/* Respond to the async of setting up the proxy. Mostly we get it or we error. */
+static void
+security_privacy_ready (GObject * obj, GAsyncResult * res, gpointer user_data)
+{
+ ImAccountsServicePrivate * priv = IM_ACCOUNTS_SERVICE_GET_PRIVATE(user_data);
+ GError * error = NULL;
+
+ priv->touch_settings = g_dbus_proxy_new_for_bus_finish(res, &error);
+
+ if (error != NULL) {
+ g_warning("Unable to get a proxy on accounts service for touch settings");
+ g_error_free(error);
+ return;
+ }
}
static void