diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2014-07-22 11:27:07 -0500 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2014-07-22 11:27:07 -0500 |
commit | 7ecf18c675f4cc65d6e8314e492dba214ec6ae9c (patch) | |
tree | d73692087dee398c4e6c7a5d6994b79e8761f695 | |
parent | 399eab24252eb7c83042de726ebbc4cf9fbb7637 (diff) | |
download | ayatana-indicator-power-7ecf18c675f4cc65d6e8314e492dba214ec6ae9c.tar.gz ayatana-indicator-power-7ecf18c675f4cc65d6e8314e492dba214ec6ae9c.tar.bz2 ayatana-indicator-power-7ecf18c675f4cc65d6e8314e492dba214ec6ae9c.zip |
for now, only show Ephemeral notifications when the battery gets low.
-rw-r--r-- | src/notifier.c | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/src/notifier.c b/src/notifier.c index bf52739..2d2730e 100644 --- a/src/notifier.c +++ b/src/notifier.c @@ -100,45 +100,35 @@ notification_clear (IndicatorPowerNotifier * self) } static void -on_notification_clicked(NotifyNotification * notify_notification G_GNUC_UNUSED, - char * action G_GNUC_UNUSED, - gpointer gself G_GNUC_UNUSED) -{ - /* no-op: notify_notification_add_action() doesn't like NULL callbacks */ -} - -static void notification_show(IndicatorPowerNotifier * self) { priv_t * p; char * body; - NotifyNotification * nn; GError * error; notification_clear (self); +#if 0 /* using Ephemeral no-button notifications for right now; + however this will likely change so I'm not tearing the + NotifierClass.interactive code out just yet */ + /* only show clickable notifications if the Notify server supports them */ if (!INDICATOR_POWER_NOTIFIER_GET_CLASS(self)->interactive) return; +#endif p = self->priv; /* create the notification */ body = g_strdup_printf(_("%.0f%% charge remaining"), indicator_power_device_get_percentage(p->battery)); - nn = notify_notification_new(_("Battery Low"), body, NULL); - p->notify_notification = nn; - notify_notification_set_hint(nn, "x-canonical-snap-decisions", - g_variant_new_boolean(TRUE)); - notify_notification_set_hint(nn, "x-canonical-private-button-tint", - g_variant_new_boolean(TRUE)); - notify_notification_add_action(nn, "OK", _("OK"), - on_notification_clicked, self, NULL); - g_signal_connect_swapped(nn, "closed", G_CALLBACK(notification_clear), self); + p->notify_notification = notify_notification_new(_("Battery Low"), body, NULL); + g_signal_connect_swapped(p->notify_notification, "closed", + G_CALLBACK(notification_clear), self); /* show the notification */ error = NULL; - notify_notification_show(nn, &error); + notify_notification_show(p->notify_notification, &error); if (error != NULL) { g_critical("Unable to show snap decision for '%s': %s", body, error->message); |