]> git.0d.be Git - empathy.git/commitdiff
Add a "Respond" button to notifications to provide a positive action (#589408)
authorRob Bradford <rob@linux.intel.com>
Fri, 2 Oct 2009 11:27:23 +0000 (12:27 +0100)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 2 Oct 2009 14:41:48 +0000 (15:41 +0100)
The positive action is the same positive action that would be
accomplished by clicking on the status icon.

src/empathy-status-icon.c

index 430c9334393778c00d2f4538ed8736f97b264ca1..df89f0fb13863fa9baca52e7d8bbf26d0155a52a 100644 (file)
@@ -27,6 +27,7 @@
 
 #include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
+#include <glib/gi18n.h>
 
 #include <libnotify/notification.h>
 
@@ -125,6 +126,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)
 {
@@ -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);
                }