]> git.0d.be Git - empathy.git/commitdiff
Also add Answer with video to the notification dialogs
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>
Tue, 22 Mar 2011 16:41:51 +0000 (16:41 +0000)
committerEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Thu, 9 Jun 2011 09:20:07 +0000 (10:20 +0100)
Conflicts:

src/empathy-status-icon.c

src/empathy-event-manager.c
src/empathy-event-manager.h
src/empathy-notifications-approver.c

index 5c17d7e7a289ba7402d81b9d14019caa27d6345f..c413be020c666160db3c6e43f2f9ef5482a8dac2 100644 (file)
@@ -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;
index fd474234987b753aae3b9f1a021d06730232eedf..91c6e1f9903cc5cf3176d39ced329779b6eb1fa6 100644 (file)
@@ -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;
index 8939ecb1d310d7e9b65c3cdcbfc778210a99b441..b4d7a1b552507b5ce9800cff407cc2bfda8e66e4 100644 (file)
 #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>
 
@@ -118,6 +121,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,
@@ -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;