aboutsummaryrefslogtreecommitdiff
path: root/src/notifier.c
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2016-01-04 12:52:04 -0600
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2021-08-28 10:17:14 +0200
commitd2e654d53f5dbe89cce2fe08a7e6dbcae4a6d835 (patch)
tree98f9b6eac61428b71828f2f0d82081bc680a8671 /src/notifier.c
parentf829a7e9bc11614bf75dff270f161bff71c8ae4d (diff)
downloadayatana-indicator-power-d2e654d53f5dbe89cce2fe08a7e6dbcae4a6d835.tar.gz
ayatana-indicator-power-d2e654d53f5dbe89cce2fe08a7e6dbcae4a6d835.tar.bz2
ayatana-indicator-power-d2e654d53f5dbe89cce2fe08a7e6dbcae4a6d835.zip
don't disable the warning sound when AccountServices is completely unavailable
Diffstat (limited to 'src/notifier.c')
-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,