[Galago-commits] r2551 - in trunk/notification-daemon: . themes/bubble

galago-commits at freedesktop.org galago-commits at freedesktop.org
Sat Feb 4 16:24:36 PST 2006


Author: chipx86
Date: 2006-02-04 16:24:33 -0800 (Sat, 04 Feb 2006)
New Revision: 2551

Modified:
   trunk/notification-daemon/ChangeLog
   trunk/notification-daemon/themes/bubble/theme.c
Log:
Fixed a crash when clicking an action in the bubble theme.


Modified: trunk/notification-daemon/ChangeLog
===================================================================
--- trunk/notification-daemon/ChangeLog	2006-02-04 23:57:03 UTC (rev 2550)
+++ trunk/notification-daemon/ChangeLog	2006-02-05 00:24:33 UTC (rev 2551)
@@ -1,3 +1,8 @@
+Sat Feb 04 16:23:30 PST 2006  Christian Hammond <chipx86 at chipx86.com>
+
+	* themes/bubble/theme.c:
+	  - Fixed a crash when clicking an action in the bubble theme.
+
 Sat Feb 04 15:56:28 PST 2006  Christian Hammond <chipx86 at chipx86.com>
 
 	* src/daemon.c:

Modified: trunk/notification-daemon/themes/bubble/theme.c
===================================================================
--- trunk/notification-daemon/themes/bubble/theme.c	2006-02-04 23:57:03 UTC (rev 2550)
+++ trunk/notification-daemon/themes/bubble/theme.c	2006-02-05 00:24:33 UTC (rev 2551)
@@ -1,6 +1,8 @@
 #include <gtk/gtk.h>
 #include "eggnotificationbubblewidget.h"
 
+typedef void (*ActionInvokedCb)(GtkWindow *nw, const char *key);
+
 GtkWindow *
 create_notification(void)
 {
@@ -48,14 +50,26 @@
 		EGG_NOTIFICATION_BUBBLE_WIDGET(nw), visible);
 }
 
+static void
+action_clicked_cb(GtkWidget *w, ActionInvokedCb action_cb)
+{
+	GtkWindow *nw   = g_object_get_data(G_OBJECT(w), "_nw");
+	const char *key = g_object_get_data(G_OBJECT(w), "_action_key");
+
+	action_cb(nw, key);
+}
+
 void
 add_notification_action(GtkWindow *nw, const char *label, const char *key,
-						GCallback cb)
+						ActionInvokedCb cb)
 {
 	GtkWidget *b = egg_notification_bubble_widget_create_button(
 		EGG_NOTIFICATION_BUBBLE_WIDGET(nw), label);
+	g_object_set_data(G_OBJECT(b), "_nw", nw);
+	g_object_set_data_full(G_OBJECT(b), "_action_key", g_strdup(key), g_free);
 
-	g_signal_connect_swapped(G_OBJECT(b), "clicked", cb, (GtkWindow *)key);
+	g_signal_connect(G_OBJECT(b), "clicked",
+					 G_CALLBACK(action_clicked_cb), cb);
 }
 
 void



More information about the galago-commits mailing list