aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/notifier.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/notifier.c b/src/notifier.c
index 93ab461..e6c511f 100644
--- a/src/notifier.c
+++ b/src/notifier.c
@@ -95,6 +95,7 @@ typedef struct
GCancellable * cancellable;
#ifdef HAS_UT_ACCTSERVICE_SYSTEMSOUND_SETTINGS
DbusAccountsServiceSound * accounts_service_sound_proxy;
+ gboolean accounts_service_sound_proxy_pending;
#endif
}
IndicatorPowerNotifierPrivate;
@@ -168,7 +169,10 @@ on_sound_proxy_ready (GObject * source_object G_GNUC_UNUSED,
if (error != NULL)
{
if (!g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
- g_warning("%s Couldn't find accounts service sound proxy: %s", G_STRLOC, error->message);
+ {
+ get_priv(gself)->accounts_service_sound_proxy_pending = FALSE;
+ g_warning("%s Couldn't find accounts service sound proxy: %s", G_STRLOC, error->message);
+ }
g_clear_error(&error);
}
@@ -178,6 +182,7 @@ on_sound_proxy_ready (GObject * source_object G_GNUC_UNUSED,
priv_t * const p = get_priv (self);
g_clear_object (&p->accounts_service_sound_proxy);
p->accounts_service_sound_proxy = proxy;
+ p->accounts_service_sound_proxy_pending = FALSE;
}
}
@@ -189,10 +194,11 @@ silent_mode (IndicatorPowerNotifier * self)
/* if we don't have a proxy yet, assume we're in silent mode
as a "do no harm" level of response */
- if (p->accounts_service_sound_proxy == NULL)
+ if (p->accounts_service_sound_proxy_pending)
return TRUE;
- return dbus_accounts_service_sound_get_silent_mode(p->accounts_service_sound_proxy);
+ return (p->accounts_service_sound_proxy != NULL)
+ && dbus_accounts_service_sound_get_silent_mode(p->accounts_service_sound_proxy);
}
#endif
@@ -515,6 +521,7 @@ indicator_power_notifier_init (IndicatorPowerNotifier * self)
g_critical("Unable to initialize libnotify! Notifications might not be shown.");
#ifdef HAS_UT_ACCTSERVICE_SYSTEMSOUND_SETTINGS
+ p->accounts_service_sound_proxy_pending = TRUE;
gchar* object_path = g_strdup_printf("/org/freedesktop/Accounts/User%lu", (gulong)getuid());
dbus_accounts_service_sound_proxy_new_for_bus(
G_BUS_TYPE_SYSTEM,