From 323707648fdefd11502faf44c2aa41d9b9500078 Mon Sep 17 00:00:00 2001 From: Iain Lane Date: Tue, 28 Apr 2020 16:47:00 +0100 Subject: [PATCH] act-user-manager: Watch for the daemon going away and coming back And set is-loaded accordingly. This causes properties to be invalidated on the client side and then get re-fetched when the daemon comes back. https://gitlab.freedesktop.org/accountsservice/accountsservice/issues/55 --- src/libaccountsservice/act-user-manager.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/libaccountsservice/act-user-manager.c b/src/libaccountsservice/act-user-manager.c index 61a8719..a317507 100644 --- a/src/libaccountsservice/act-user-manager.c +++ b/src/libaccountsservice/act-user-manager.c @@ -2298,6 +2298,23 @@ act_user_manager_queue_load (ActUserManager *manager) } } +static void +on_name_owner_changed (GObject *object, + GParamSpec *pspec, + gpointer user_data) +{ + ActUserManager *manager = ACT_USER_MANAGER (user_data); + GDBusProxy *accounts_proxy = G_DBUS_PROXY (object); + g_autofree gchar *owner = NULL; + + g_return_if_fail (ACT_IS_USER_MANAGER (manager)); + g_return_if_fail (accounts_proxy != NULL); + + owner = g_dbus_proxy_get_name_owner (accounts_proxy); + + set_is_loaded (manager, owner != NULL); +} + static gboolean ensure_accounts_proxy (ActUserManager *manager) { @@ -2335,6 +2352,10 @@ ensure_accounts_proxy (ActUserManager *manager) "user-deleted", G_CALLBACK (on_user_removed_in_accounts_service), manager); + g_signal_connect (priv->accounts_proxy, + "notify::g-name-owner", + G_CALLBACK (on_name_owner_changed), + manager); return TRUE; } -- GitLab