aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2011-03-23 00:41:51 +0800
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>2011-03-23 23:12:06 +0800
commit0ed251dffae40e2585a0e1fd96243ce713c84480 (patch)
treec7d20d4446d49acbf315269d35a7ead2498f515c
parent19c4cd220e3f21147cb4c73fa0d62de2c40eaf7f (diff)
downloadgsoc2013-empathy-0ed251dffae40e2585a0e1fd96243ce713c84480.tar
gsoc2013-empathy-0ed251dffae40e2585a0e1fd96243ce713c84480.tar.gz
gsoc2013-empathy-0ed251dffae40e2585a0e1fd96243ce713c84480.tar.bz2
gsoc2013-empathy-0ed251dffae40e2585a0e1fd96243ce713c84480.tar.lz
gsoc2013-empathy-0ed251dffae40e2585a0e1fd96243ce713c84480.tar.xz
gsoc2013-empathy-0ed251dffae40e2585a0e1fd96243ce713c84480.tar.zst
gsoc2013-empathy-0ed251dffae40e2585a0e1fd96243ce713c84480.zip
Also add Answer with video to the notification dialogs
-rw-r--r--src/empathy-event-manager.c1
-rw-r--r--src/empathy-event-manager.h1
-rw-r--r--src/empathy-status-icon.c36
3 files changed, 37 insertions, 1 deletions
diff --git a/src/empathy-event-manager.c b/src/empathy-event-manager.c
index f00d2b7ec..5b2174a55 100644
--- a/src/empathy-event-manager.c
+++ b/src/empathy-event-manager.c
@@ -233,6 +233,7 @@ event_manager_add (EmpathyEventManager *manager,
event->public.header = g_strdup (header);
event->public.message = g_strdup (message);
event->public.must_ack = (func != NULL);
+ event->public.handler_instance = approval->handler_instance;
event->inhibit = FALSE;
event->func = func;
event->user_data = user_data;
diff --git a/src/empathy-event-manager.h b/src/empathy-event-manager.h
index 09b146582..0c0e5d990 100644
--- a/src/empathy-event-manager.h
+++ b/src/empathy-event-manager.h
@@ -67,6 +67,7 @@ typedef struct {
gchar *header;
gchar *message;
gboolean must_ack;
+ GObject *handler_instance;
} EmpathyEvent;
GType empathy_event_manager_get_type (void) G_GNUC_CONST;
diff --git a/src/empathy-status-icon.c b/src/empathy-status-icon.c
index 7468bcc2a..6d54534c8 100644
--- a/src/empathy-status-icon.c
+++ b/src/empathy-status-icon.c
@@ -34,9 +34,11 @@
#include <telepathy-glib/account-manager.h>
#include <telepathy-glib/util.h>
+#include <telepathy-yell/telepathy-yell.h>
#include <libempathy/empathy-gsettings.h>
#include <libempathy/empathy-utils.h>
+#include <libempathy/empathy-tp-streamed-media.h>
#include <libempathy-gtk/empathy-presence-chooser.h>
#include <libempathy-gtk/empathy-ui-utils.h>
@@ -108,6 +110,22 @@ notification_close_helper (EmpathyStatusIconPriv *priv)
}
static void
+notification_approve_no_video_cb (NotifyNotification *notification,
+ gchar *action,
+ EmpathyStatusIcon *icon)
+{
+ EmpathyStatusIconPriv *priv = GET_PRIV (icon);
+
+ if (priv->event)
+ {
+ tpy_call_channel_send_video (
+ TPY_CALL_CHANNEL (priv->event->handler_instance),
+ FALSE);
+ empathy_event_approve (priv->event);
+ }
+}
+
+static void
notification_approve_cb (NotifyNotification *notification,
gchar *action,
EmpathyStatusIcon *icon)
@@ -134,6 +152,7 @@ add_notification_actions (EmpathyStatusIcon *self,
NotifyNotification *notification)
{
EmpathyStatusIconPriv *priv = GET_PRIV (self);
+ gboolean video;
switch (priv->event->type) {
case EMPATHY_EVENT_TYPE_CHAT:
@@ -144,12 +163,27 @@ add_notification_actions (EmpathyStatusIcon *self,
case EMPATHY_EVENT_TYPE_VOIP:
case EMPATHY_EVENT_TYPE_CALL:
+ if (priv->event->type == EMPATHY_EVENT_TYPE_VOIP)
+ video = empathy_tp_streamed_media_has_initial_video (
+ EMPATHY_TP_STREAMED_MEDIA (priv->event->handler_instance));
+ else
+ video = tpy_call_channel_has_initial_video (
+ TPY_CALL_CHANNEL (priv->event->handler_instance));
+
notify_notification_add_action (notification,
"reject", _("Reject"), (NotifyActionCallback) notification_decline_cb,
self, NULL);
+
+ if (video && priv->event->type == EMPATHY_EVENT_TYPE_CALL)
+ notify_notification_add_action (notification,
+ "answer", _("Answer"), (NotifyActionCallback)
+ notification_approve_no_video_cb,
+ self, NULL);
+
notify_notification_add_action (notification,
- "answer", _("Answer"), (NotifyActionCallback) notification_approve_cb,
+ "answer", video ? _("Answer with video") : _("Answer"),
+ (NotifyActionCallback) notification_approve_cb,
self, NULL);
break;