aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-10-28 21:08:18 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-11-09 16:04:35 +0800
commit877ea6bc7673b4a3a31be2528a3f6e4bcad4262e (patch)
tree5ebbe7c4ef01ce97ac424385697ce7edbf5ec90e /src
parent2d91d86e1638f3c9a9be8be63ff974a8fc28d9ce (diff)
downloadgsoc2013-empathy-877ea6bc7673b4a3a31be2528a3f6e4bcad4262e.tar
gsoc2013-empathy-877ea6bc7673b4a3a31be2528a3f6e4bcad4262e.tar.gz
gsoc2013-empathy-877ea6bc7673b4a3a31be2528a3f6e4bcad4262e.tar.bz2
gsoc2013-empathy-877ea6bc7673b4a3a31be2528a3f6e4bcad4262e.tar.lz
gsoc2013-empathy-877ea6bc7673b4a3a31be2528a3f6e4bcad4262e.tar.xz
gsoc2013-empathy-877ea6bc7673b4a3a31be2528a3f6e4bcad4262e.tar.zst
gsoc2013-empathy-877ea6bc7673b4a3a31be2528a3f6e4bcad4262e.zip
Add Accept/Decline button in subscription notifications (#630706)
Diffstat (limited to 'src')
-rw-r--r--src/empathy-status-icon.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/empathy-status-icon.c b/src/empathy-status-icon.c
index e61e0cfd4..6bfb2f3a0 100644
--- a/src/empathy-status-icon.c
+++ b/src/empathy-status-icon.c
@@ -35,6 +35,7 @@
#include <telepathy-glib/account-manager.h>
#include <telepathy-glib/util.h>
+#include <libempathy/empathy-contact-manager.h>
#include <libempathy/empathy-gsettings.h>
#include <libempathy/empathy-utils.h>
@@ -130,6 +131,48 @@ notification_decline_cb (NotifyNotification *notification,
}
static void
+notification_decline_subscription_cb (NotifyNotification *notification,
+ gchar *action,
+ EmpathyStatusIcon *icon)
+{
+ EmpathyStatusIconPriv *priv = GET_PRIV (icon);
+ EmpathyContactManager *manager;
+
+ if (priv->event == NULL)
+ return;
+
+
+ manager = empathy_contact_manager_dup_singleton ();
+ empathy_contact_list_remove (EMPATHY_CONTACT_LIST (manager),
+ priv->event->contact, "");
+
+ empathy_event_remove (priv->event);
+
+ g_object_unref (manager);
+}
+
+static void
+notification_accept_subscription_cb (NotifyNotification *notification,
+ gchar *action,
+ EmpathyStatusIcon *icon)
+{
+ EmpathyStatusIconPriv *priv = GET_PRIV (icon);
+ EmpathyContactManager *manager;
+
+ if (priv->event == NULL)
+ return;
+
+
+ manager = empathy_contact_manager_dup_singleton ();
+ empathy_contact_list_add (EMPATHY_CONTACT_LIST (manager),
+ priv->event->contact, "");
+
+ empathy_event_remove (priv->event);
+
+ g_object_unref (manager);
+}
+
+static void
add_notification_actions (EmpathyStatusIcon *self,
NotifyNotification *notification)
{
@@ -163,6 +206,17 @@ add_notification_actions (EmpathyStatusIcon *self,
self, NULL);
break;
+ case EMPATHY_EVENT_TYPE_SUBSCRIPTION:
+ notify_notification_add_action (notification,
+ "decline", _("Decline"),
+ (NotifyActionCallback) notification_decline_subscription_cb,
+ self, NULL);
+
+ notify_notification_add_action (notification,
+ "accept", _("Accept"),
+ (NotifyActionCallback) notification_accept_subscription_cb,
+ self, NULL);
+
default:
break;
}