empathy r2274 - in trunk: . src



Author: xclaesse
Date: Fri Jan 30 17:06:57 2009
New Revision: 2274
URL: http://svn.gnome.org/viewvc/empathy?rev=2274&view=rev

Log:
Require latest libnotify. Don't crash when clicking the notification.

Modified:
   trunk/configure.ac
   trunk/src/empathy-status-icon.c

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Fri Jan 30 17:06:57 2009
@@ -34,6 +34,7 @@
 MISSION_CONTROL_REQUIRED=4.61
 ENCHANT_REQUIRED=1.2.0
 ISO_CODES_REQUIRED=0.35
+LIBNOTIFY_REQUIRED=0.4.5
 
 # Uncomment that to build with deprecated symbols disabled
 #AC_DEFINE(G_DISABLE_DEPRECATED, [], [Disable deprecated GLib symbols])
@@ -108,7 +109,7 @@
    libglade-2.0 >= $LIBGLADE_REQUIRED
    libebook-1.2
    libcanberra-gtk >= 0.4
-   libnotify
+   libnotify >= $LIBNOTIFY_REQUIRED
 ])
 
 # -----------------------------------------------------------

Modified: trunk/src/empathy-status-icon.c
==============================================================================
--- trunk/src/empathy-status-icon.c	(original)
+++ trunk/src/empathy-status-icon.c	Fri Jan 30 17:06:57 2009
@@ -71,39 +71,33 @@
 G_DEFINE_TYPE (EmpathyStatusIcon, empathy_status_icon, G_TYPE_OBJECT);
 
 static gboolean
-status_icon_idle_event_activate (gpointer data)
+activate_event (EmpathyEvent *event)
 {
-	EmpathyStatusIcon     *icon = EMPATHY_STATUS_ICON (data);
-	EmpathyStatusIconPriv *priv = GET_PRIV (icon);
-
-	if (priv->event) {
-		empathy_event_activate (priv->event);
-	}
+	empathy_event_activate (event);
 
 	return FALSE;
 }
 
 static void
-status_icon_notification_cb (NotifyNotification *notification,
-			     gchar *action_id,
-			     gpointer data)
-{
-	EmpathyStatusIcon *icon = EMPATHY_STATUS_ICON (data);
-
-	g_idle_add (status_icon_idle_event_activate, icon);
-}
-
-static void
 status_icon_notification_closed_cb (NotifyNotification *notification,
-				    gpointer            data)
+				    EmpathyStatusIcon  *icon)
 {
-	EmpathyStatusIcon *icon = EMPATHY_STATUS_ICON (data);
 	EmpathyStatusIconPriv *priv = GET_PRIV (icon);
+	int reason;
+
+	reason = notify_notification_get_closed_reason (notification);
 
 	if (priv->notification) {
 		g_object_unref (priv->notification);
 		priv->notification = NULL;
 	}
+
+	/* the notification has been closed by the user, see the
+	 * DesktopNotification spec.
+	 */
+	if (reason == 2 && priv->event) {
+		g_idle_add ((GSourceFunc) activate_event, priv->event);
+	}
 }
 
 static void
@@ -112,15 +106,12 @@
 	EmpathyStatusIconPriv *priv = GET_PRIV (icon);
 
 	if (priv->event) {
-		priv->notification = notify_notification_new_with_status_icon ("New Event", priv->event->message, priv->event->icon_name, priv->icon);
-		notify_notification_add_action (priv->notification,
-						"activate",
-						"Activate",
-						status_icon_notification_cb,
-						icon, NULL);
+		priv->notification = notify_notification_new_with_status_icon
+			("New Event", priv->event->message, priv->event->icon_name, priv->icon);
 		notify_notification_set_timeout (priv->notification,
 						 NOTIFY_EXPIRES_DEFAULT);
-		g_signal_connect (priv->notification, "closed", G_CALLBACK (status_icon_notification_closed_cb), (gpointer) icon);
+		g_signal_connect (priv->notification, "closed",
+				  G_CALLBACK (status_icon_notification_closed_cb), icon);		
 		notify_notification_show (priv->notification, NULL);
 	} else {
 		if (priv->notification) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]