[empathy/gnome-2-34] Also add Answer with video to the notification dialogs



commit 0ed251dffae40e2585a0e1fd96243ce713c84480
Author: Sjoerd Simons <sjoerd simons collabora co uk>
Date:   Tue Mar 22 16:41:51 2011 +0000

    Also add Answer with video to the notification dialogs

 src/empathy-event-manager.c |    1 +
 src/empathy-event-manager.h |    1 +
 src/empathy-status-icon.c   |   36 +++++++++++++++++++++++++++++++++++-
 3 files changed, 37 insertions(+), 1 deletions(-)
---
diff --git a/src/empathy-event-manager.c b/src/empathy-event-manager.c
index f00d2b7..5b2174a 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 09b1465..0c0e5d9 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 7468bcc..6d54534 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;
 



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