[notification-daemon] Send Close when notification isn't shown
- From: William Jon McCann <mccann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [notification-daemon] Send Close when notification isn't shown
- Date: Thu, 24 Jun 2010 04:31:42 +0000 (UTC)
commit 41afd913dacbe935b3b76e4efb2d1a5443c36e08
Author: Bastien Nocera <hadess hadess net>
Date: Thu Jun 24 02:30:03 2010 +0100
Send Close when notification isn't shown
When a notification comes in and we have the screensaver or a
fullscreen application showing, we never actually show the
popup, and the application will not receive a "Close" notification.
Change this so that the close notification is the first thing
we send out after being done dealing with the requested notification.
https://bugzilla.gnome.org/show_bug.cgi?id=622021
src/daemon/daemon.c | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c
index 8fff1e3..b9f6af2 100644
--- a/src/daemon/daemon.c
+++ b/src/daemon/daemon.c
@@ -112,6 +112,12 @@ struct _NotifyDaemonPrivate
int n_screens;
};
+typedef struct
+{
+ guint id;
+ NotifyDaemon *daemon;
+} _NotifyPendingClose;
+
static DBusConnection *dbus_conn = NULL;
#define CHECK_DBUS_VERSION(major, minor) \
@@ -549,6 +555,16 @@ _close_notification (NotifyDaemon *daemon,
}
}
+static gboolean
+_close_notification_not_shown (_NotifyPendingClose *data)
+{
+ _close_notification (data->daemon, data->id, TRUE, NOTIFYD_CLOSED_RESERVED);
+ g_object_unref (data->daemon);
+ g_free (data);
+
+ return FALSE;
+}
+
static void
_notification_destroyed_cb (GtkWindow *nw,
NotifyDaemon *daemon)
@@ -1572,6 +1588,15 @@ notify_daemon_notify_handler (NotifyDaemon *daemon,
theme_show_notification (nw);
if (sound_file != NULL)
sound_play_file (GTK_WIDGET (nw), sound_file);
+ } else {
+ _NotifyPendingClose *data;
+
+ /* The notification was not shown, so queue up a close
+ * for it */
+ data = g_new0 (_NotifyPendingClose, 1);
+ data->id = id;
+ data->daemon = g_object_ref (daemon);
+ g_idle_add ((GSourceFunc) _close_notification_not_shown, data);
}
g_free (sound_file);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]