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

galago-commits at freedesktop.org galago-commits at freedesktop.org
Sun Jan 22 23:39:05 PST 2006


Author: chipx86
Date: 2006-01-22 23:39:03 -0800 (Sun, 22 Jan 2006)
New Revision: 2468

Modified:
   trunk/notification-daemon/ChangeLog
   trunk/notification-daemon/src/daemon.c
Log:
Fix several bugs (placement and possible crashers) in notification replacement.


Modified: trunk/notification-daemon/ChangeLog
===================================================================
--- trunk/notification-daemon/ChangeLog	2006-01-23 07:31:54 UTC (rev 2467)
+++ trunk/notification-daemon/ChangeLog	2006-01-23 07:39:03 UTC (rev 2468)
@@ -1,3 +1,9 @@
+Sun Jan 22 23:38:31 PST 2006  Christian Hammond <chipx86 at chipx86.com>
+
+	* src/daemon.c:
+	  - Fix several bugs (placement and possible crashers) in notification
+	    replacement.
+
 Sun Jan 22 23:31:36 PST 2006  Christian Hammond <chipx86 at chipx86.com>
 
 	* themes/standard/theme.c:

Modified: trunk/notification-daemon/src/daemon.c
===================================================================
--- trunk/notification-daemon/src/daemon.c	2006-01-23 07:31:54 UTC (rev 2467)
+++ trunk/notification-daemon/src/daemon.c	2006-01-23 07:39:03 UTC (rev 2468)
@@ -611,7 +611,8 @@
 
 static void
 _notify_daemon_add_bubble_to_poptart_stack(NotifyDaemon *daemon,
-										   GtkWindow *nw)
+										   GtkWindow *nw,
+										   gboolean new_notification)
 {
 	NotifyDaemonPrivate *priv = daemon->priv;
 	GtkRequisition req;
@@ -632,15 +633,22 @@
 	{
 		GtkWindow *nw2 = GTK_WINDOW(link->data);
 
-		gtk_widget_size_request(GTK_WIDGET(nw2), &req);
-		x = workarea.x + workarea.width - req.width;
-		y = y - req.height;
-		theme_move_notification(nw2, x, y);
+		if (nw2 != nw)
+		{
+			gtk_widget_size_request(GTK_WIDGET(nw2), &req);
+			x = workarea.x + workarea.width - req.width;
+			y = y - req.height;
+			theme_move_notification(nw2, x, y);
+		}
 	}
 
-	g_signal_connect(G_OBJECT(nw), "destroy",
-					 G_CALLBACK(_remove_bubble_from_poptart_stack), daemon);
-	priv->poptart_stack = g_slist_prepend(priv->poptart_stack, nw);
+	if (new_notification)
+	{
+		g_signal_connect(G_OBJECT(nw), "destroy",
+						 G_CALLBACK(_remove_bubble_from_poptart_stack),
+						 daemon);
+		priv->poptart_stack = g_slist_prepend(priv->poptart_stack, nw);
+	}
 }
 
 static void
@@ -706,6 +714,7 @@
 	GtkWindow *nw = NULL;
 	GValue *data;
 	gboolean use_pos_data = FALSE;
+	gboolean new_notification = FALSE;
 	gint x = 0;
 	gint y = 0;
 	guint return_id;
@@ -716,12 +725,16 @@
 	{
 		nt = (NotifyTimeout *)g_hash_table_lookup(priv->notification_hash,
 												  &id);
-		nw = nt->nw;
+
+		if (nt != NULL)
+			nw = nt->nw;
 	}
-	else
+
+	if (nw == NULL)
 	{
 		nw = theme_create_notification(url_clicked_cb);
 		g_object_set_data(G_OBJECT(nw), "_notify_daemon", daemon);
+		new_notification = TRUE;
 	}
 
 	theme_set_notification_text(nw, summary, body);
@@ -774,7 +787,8 @@
 	else
 	{
 		theme_set_notification_arrow(nw, FALSE, 0, 0);
-		_notify_daemon_add_bubble_to_poptart_stack(daemon, nw);
+		_notify_daemon_add_bubble_to_poptart_stack(daemon, nw,
+												   new_notification);
 	}
 
 	/* check for icon_data if icon == "" */



More information about the galago-commits mailing list