[empathy/gnome-2-28] Add a "Respond" button to notifications to provide a positive action (#589408)



commit e2e96275266ab5c3435d5a68750ac358b6ec3580
Author: Rob Bradford <rob linux intel com>
Date:   Fri Oct 2 12:27:23 2009 +0100

    Add a "Respond" button to notifications to provide a positive action (#589408)
    
    The positive action is the same positive action that would be
    accomplished by clicking on the status icon.

 src/empathy-status-icon.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/src/empathy-status-icon.c b/src/empathy-status-icon.c
index 430c933..df89f0f 100644
--- a/src/empathy-status-icon.c
+++ b/src/empathy-status-icon.c
@@ -27,6 +27,7 @@
 
 #include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
+#include <glib/gi18n.h>
 
 #include <libnotify/notification.h>
 
@@ -126,6 +127,17 @@ notification_close_helper (EmpathyStatusIconPriv *priv)
 }
 
 static void
+notification_action_cb (NotifyNotification *notification,
+			gchar              *action,
+			EmpathyStatusIcon  *icon)
+{
+	EmpathyStatusIconPriv *priv = GET_PRIV (icon);
+
+	if (priv->event)
+		empathy_event_activate (priv->event);
+}
+
+static void
 status_icon_update_notification (EmpathyStatusIcon *icon)
 {
 	EmpathyStatusIconPriv *priv = GET_PRIV (icon);
@@ -153,6 +165,13 @@ status_icon_update_notification (EmpathyStatusIcon *icon)
 			notify_notification_set_timeout (priv->notification,
 							 NOTIFY_EXPIRES_DEFAULT);
 
+			notify_notification_add_action (priv->notification,
+							"respond",
+							_("Respond"),
+							(NotifyActionCallback) notification_action_cb,
+							icon,
+							NULL);
+
 			g_signal_connect (priv->notification, "closed",
 					  G_CALLBACK (status_icon_notification_closed_cb), icon);
 		}



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