aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2014-10-06 21:20:44 -0500
committerTed Gould <ted@gould.cx>2014-10-06 21:20:44 -0500
commit76bf922cf4a630cdad5dc0b3948337bb1ea4efeb (patch)
tree4e5769c67b7609ddfab34efd22c49cd728d99b43 /src
parent6fd3e934029a47e7ec8818dc21b7f127863eda56 (diff)
downloadayatana-indicator-messages-76bf922cf4a630cdad5dc0b3948337bb1ea4efeb.tar.gz
ayatana-indicator-messages-76bf922cf4a630cdad5dc0b3948337bb1ea4efeb.tar.bz2
ayatana-indicator-messages-76bf922cf4a630cdad5dc0b3948337bb1ea4efeb.zip
Ensure we can cancel getting the proxy and that if we do we can handle it without getting the private section
Diffstat (limited to 'src')
-rw-r--r--src/im-accounts-service.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/im-accounts-service.c b/src/im-accounts-service.c
index 40c269c..dc80826 100644
--- a/src/im-accounts-service.c
+++ b/src/im-accounts-service.c
@@ -30,6 +30,7 @@ typedef struct _ImAccountsServicePrivate ImAccountsServicePrivate;
struct _ImAccountsServicePrivate {
ActUserManager * user_manager;
GDBusProxy * touch_settings;
+ GCancellable * cancel;
};
#define IM_ACCOUNTS_SERVICE_GET_PRIVATE(o) \
@@ -61,6 +62,8 @@ im_accounts_service_init (ImAccountsService *self)
{
ImAccountsServicePrivate * priv = IM_ACCOUNTS_SERVICE_GET_PRIVATE(self);
+ priv->cancel = g_cancellable_new();
+
priv->user_manager = act_user_manager_get_default();
g_signal_connect(priv->user_manager, "user-changed", G_CALLBACK(user_changed), self);
g_signal_connect(priv->user_manager, "notify::is-loaded", G_CALLBACK(is_loaded), self);
@@ -77,6 +80,11 @@ im_accounts_service_dispose (GObject *object)
{
ImAccountsServicePrivate * priv = IM_ACCOUNTS_SERVICE_GET_PRIVATE(object);
+ if (priv->cancel != NULL) {
+ g_cancellable_cancel(priv->cancel);
+ g_clear_object(&priv->cancel);
+ }
+
g_clear_object(&priv->user_manager);
G_OBJECT_CLASS (im_accounts_service_parent_class)->dispose (object);
@@ -109,7 +117,7 @@ user_changed (ActUserManager * manager, ActUser * user, gpointer user_data)
"org.freedesktop.Accounts",
act_user_get_object_path(user),
"com.ubuntu.touch.AccountsService.SecurityPrivacy",
- NULL,
+ priv->cancel,
security_privacy_ready,
user_data);
}
@@ -118,16 +126,17 @@ user_changed (ActUserManager * manager, ActUser * user, gpointer user_data)
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);
+ GDBusProxy * proxy = 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_warning("Unable to get a proxy on accounts service for touch settings: %s", error->message);
g_error_free(error);
return;
}
+
+ ImAccountsServicePrivate * priv = IM_ACCOUNTS_SERVICE_GET_PRIVATE(user_data);
+ priv->touch_settings = proxy;
}
static void
@@ -182,7 +191,7 @@ im_accounts_service_set_draws_attention (ImAccountsService * service, gboolean d
NULL, /* reply */
G_DBUS_CALL_FLAGS_NONE,
-1, /* timeout */
- NULL, /* cancellable */
+ priv->cancel, /* cancellable */
NULL, NULL); /* cb */
}