[Galago-commits] r2448 - in trunk/notification-daemon: . src

galago-commits at freedesktop.org galago-commits at freedesktop.org
Fri Jan 20 00:09:41 PST 2006


Author: chipx86
Date: 2006-01-20 00:09:40 -0800 (Fri, 20 Jan 2006)
New Revision: 2448

Modified:
   trunk/notification-daemon/ChangeLog
   trunk/notification-daemon/src/daemon.c
Log:
Add a little hack to prevent the notification from closing when a link is clicked.


Modified: trunk/notification-daemon/ChangeLog
===================================================================
--- trunk/notification-daemon/ChangeLog	2006-01-20 08:01:58 UTC (rev 2447)
+++ trunk/notification-daemon/ChangeLog	2006-01-20 08:09:40 UTC (rev 2448)
@@ -1,3 +1,9 @@
+Fri Jan 20 00:09:12 PST 2006  Christian Hammond <chipx86 at chipx86.com>
+
+	* src/daemon.c:
+	  - Add a little hack to prevent the notification from closing when a
+	    link is clicked.
+
 Fri Jan 20 00:01:04 PST 2006  Christian Hammond <chipx86 at chipx86.com>
 
 	* src/daemon.c:

Modified: trunk/notification-daemon/src/daemon.c
===================================================================
--- trunk/notification-daemon/src/daemon.c	2006-01-20 08:01:58 UTC (rev 2447)
+++ trunk/notification-daemon/src/daemon.c	2006-01-20 08:09:40 UTC (rev 2448)
@@ -55,6 +55,7 @@
 	guint timeout_source;
 	GHashTable *notification_hash;
 	GSList *poptart_stack;
+	gboolean url_clicked_lock;
 };
 
 static GConfClient *gconf_client = NULL;
@@ -509,10 +510,15 @@
 }
 
 static void
-_notification_daemon_handle_bubble_widget_default(GtkWindow *nw,
-												  GdkEventButton *button,
-												  NotifyDaemon *daemon)
+window_clicked_cb(GtkWindow *nw, GdkEventButton *button, NotifyDaemon *daemon)
 {
+	if (daemon->priv->url_clicked_lock)
+	{
+		daemon->priv->url_clicked_lock = FALSE;
+		return;
+	}
+
+	printf("Window clicked\n");
 	_close_notification(daemon,
 		GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(nw), "_notify_id")));
 }
@@ -601,9 +607,13 @@
 static void
 url_clicked_cb(GtkWindow *nw, const char *url)
 {
+	NotifyDaemon *daemon = g_object_get_data(G_OBJECT(nw), "_notify_daemon");
 	char *escaped_url;
 	char *cmd = NULL;
 
+	/* Somewhat of a hack.. */
+	daemon->priv->url_clicked_lock = TRUE;
+
 	escaped_url = g_shell_quote(url);
 
 	/*
@@ -672,6 +682,7 @@
 	else
 	{
 		nw = theme_create_notification(url_clicked_cb);
+		g_object_set_data(G_OBJECT(nw), "_notify_daemon", daemon);
 	}
 
 	theme_set_notification_text(nw, summary, body);
@@ -764,9 +775,8 @@
 		}
 	}
 
-	g_signal_connect(
-		G_OBJECT(nw), "button-release-event",
-		G_CALLBACK(_notification_daemon_handle_bubble_widget_default), daemon);
+	g_signal_connect(G_OBJECT(nw), "button-release-event",
+					 G_CALLBACK(window_clicked_cb), daemon);
 
 	theme_show_notification(nw);
 



More information about the galago-commits mailing list