aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2011-03-23 00:41:51 +0800
committerEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-06-09 17:20:07 +0800
commitc849a5a953b0ffa1df1dc1383018dbc48254a2fa (patch)
treef567c6e9ef5904408a0b615d999ebf44ea70511c /src
parent6b6213702cba10ca28494e44990f750569856217 (diff)
downloadgsoc2013-empathy-c849a5a953b0ffa1df1dc1383018dbc48254a2fa.tar
gsoc2013-empathy-c849a5a953b0ffa1df1dc1383018dbc48254a2fa.tar.gz
gsoc2013-empathy-c849a5a953b0ffa1df1dc1383018dbc48254a2fa.tar.bz2
gsoc2013-empathy-c849a5a953b0ffa1df1dc1383018dbc48254a2fa.tar.lz
gsoc2013-empathy-c849a5a953b0ffa1df1dc1383018dbc48254a2fa.tar.xz
gsoc2013-empathy-c849a5a953b0ffa1df1dc1383018dbc48254a2fa.tar.zst
gsoc2013-empathy-c849a5a953b0ffa1df1dc1383018dbc48254a2fa.zip
Also add Answer with video to the notification dialogs
Conflicts: src/empathy-status-icon.c
Diffstat (limited to 'src')
-rw-r--r--src/empathy-event-manager.c1
-rw-r--r--src/empathy-event-manager.h1
-rw-r--r--src/empathy-notifications-approver.c35
3 files changed, 36 insertions, 1 deletions
diff --git a/src/empathy-event-manager.c b/src/empathy-event-manager.c
index 5c17d7e7a..c413be020 100644
--- a/src/empathy-event-manager.c
+++ b/src/empathy-event-manager.c
@@ -237,6 +237,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 fd4742349..91c6e1f99 100644
--- a/src/empathy-event-manager.h
+++ b/src/empathy-event-manager.h
@@ -68,6 +68,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-notifications-approver.c b/src/empathy-notifications-approver.c
index 8939ecb1d..b4d7a1b55 100644
--- a/src/empathy-notifications-approver.c
+++ b/src/empathy-notifications-approver.c
@@ -25,7 +25,10 @@
#include <libnotify/notify.h>
#include <telepathy-glib/telepathy-glib.h>
+#include <telepathy-yell/telepathy-yell.h>
+
#include <libempathy/empathy-contact-manager.h>
+#include <libempathy/empathy-tp-streamed-media.h>
#include <libempathy-gtk/empathy-notify-manager.h>
@@ -119,6 +122,20 @@ notification_close_helper (EmpathyNotificationsApprover *self)
}
static void
+notification_approve_no_video_cb (NotifyNotification *notification,
+ gchar *action,
+ EmpathyNotificationsApprover *self)
+{
+ if (self->priv->event)
+ {
+ tpy_call_channel_send_video (
+ TPY_CALL_CHANNEL (self->priv->event->handler_instance),
+ FALSE);
+ empathy_event_approve (self->priv->event);
+ }
+}
+
+static void
notification_approve_cb (NotifyNotification *notification,
gchar *action,
EmpathyNotificationsApprover *self)
@@ -178,6 +195,8 @@ static void
add_notification_actions (EmpathyNotificationsApprover *self,
NotifyNotification *notification)
{
+ gboolean video;
+
switch (self->priv->event->type) {
case EMPATHY_EVENT_TYPE_CHAT:
notify_notification_add_action (notification,
@@ -187,12 +206,26 @@ add_notification_actions (EmpathyNotificationsApprover *self,
case EMPATHY_EVENT_TYPE_VOIP:
case EMPATHY_EVENT_TYPE_CALL:
+ if (self->priv->event->type == EMPATHY_EVENT_TYPE_VOIP)
+ video = empathy_tp_streamed_media_has_initial_video (
+ EMPATHY_TP_STREAMED_MEDIA (self->priv->event->handler_instance));
+ else
+ video = tpy_call_channel_has_initial_video (
+ TPY_CALL_CHANNEL (self->priv->event->handler_instance));
+
notify_notification_add_action (notification,
"reject", _("Reject"), (NotifyActionCallback) notification_decline_cb,
self, NULL);
+ if (video && self->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;