]> git.0d.be Git - empathy.git/blobdiff - src/empathy-call-window.c
roster-window: fix crash if empathy_chatroom_manager_find() failed
[empathy.git] / src / empathy-call-window.c
index cac15bc662b0dcbe4499991b94cd34204602f563..a54346c6de9d87b451a7c26ef0354dfab267ad2b 100644 (file)
 #include <farstream/fs-utils.h>
 #include <tp-account-widgets/tpaw-builder.h>
 #include <tp-account-widgets/tpaw-camera-monitor.h>
+#include <tp-account-widgets/tpaw-images.h>
+#include <tp-account-widgets/tpaw-pixbuf-utils.h>
+#include <tp-account-widgets/tpaw-utils.h>
+#include <telepathy-glib/telepathy-glib-dbus.h>
 
 #include "empathy-about-dialog.h"
 #include "empathy-audio-sink.h"
@@ -593,25 +597,29 @@ empathy_call_window_swap_camera_cb (GtkAction *action,
 }
 
 static void
-empathy_call_window_camera_added_cb (TpawCameraMonitor *monitor,
-    TpawCamera *camera,
-    EmpathyCallWindow *self)
+empathy_call_window_update_swap_camera (EmpathyCallWindow *self)
 {
-  const GList *cameras = tpaw_camera_monitor_get_cameras (monitor);
+  const GList *cameras = tpaw_camera_monitor_get_cameras (
+      self->priv->camera_monitor);
 
   gtk_action_set_visible (self->priv->menu_swap_camera,
       g_list_length ((GList *) cameras) >= 2);
 }
 
 static void
-empathy_call_window_camera_removed_cb (TpawCameraMonitor *monitor,
+empathy_call_window_camera_added_cb (TpawCameraMonitor *monitor,
     TpawCamera *camera,
     EmpathyCallWindow *self)
 {
-  const GList *cameras = tpaw_camera_monitor_get_cameras (monitor);
+  empathy_call_window_update_swap_camera (self);
+}
 
-  gtk_action_set_visible (self->priv->menu_swap_camera,
-      g_list_length ((GList *) cameras) >= 2);
+static void
+empathy_call_window_camera_removed_cb (TpawCameraMonitor *monitor,
+    TpawCamera *camera,
+    EmpathyCallWindow *self)
+{
+  empathy_call_window_update_swap_camera (self);
 }
 
 static void
@@ -1502,8 +1510,9 @@ empathy_call_window_incoming_call_response_cb (GtkDialog *dialog,
   switch (response_id)
     {
       case GTK_RESPONSE_ACCEPT:
-        tp_channel_dispatch_operation_handle_with_async (
-            self->priv->pending_cdo, EMPATHY_CALL_BUS_NAME, NULL, NULL);
+        tp_channel_dispatch_operation_handle_with_time_async (
+            self->priv->pending_cdo, EMPATHY_CALL_TP_BUS_NAME,
+            empathy_get_current_action_time (), NULL, NULL);
 
         tp_clear_object (&self->priv->pending_cdo);
         tp_clear_object (&self->priv->pending_channel);
@@ -1682,6 +1691,7 @@ empathy_call_window_init (EmpathyCallWindow *self)
   gtk_action_set_sensitive (priv->menu_fullscreen, FALSE);
 
   priv->camera_monitor = tpaw_camera_monitor_dup_singleton ();
+  empathy_call_window_update_swap_camera (self);
 
   g_object_bind_property (priv->camera_monitor, "available",
       priv->camera_button, "sensitive",
@@ -1891,8 +1901,8 @@ init_contact_avatar_with_size (EmpathyContact *contact,
 
   if (pixbuf_avatar == NULL)
     {
-      pixbuf_avatar = empathy_pixbuf_from_icon_name_sized (
-          EMPATHY_IMAGE_AVATAR_DEFAULT, size);
+      pixbuf_avatar = tpaw_pixbuf_from_icon_name_sized (
+          TPAW_IMAGE_AVATAR_DEFAULT, size);
     }
 
   gtk_image_set_from_pixbuf (GTK_IMAGE (image_widget), pixbuf_avatar);
@@ -2463,7 +2473,7 @@ empathy_call_window_new_handler (EmpathyCallWindow *self,
   g_return_if_fail (EMPATHY_IS_CALL_HANDLER (handler));
 
   if (present)
-    empathy_window_present_with_time (GTK_WINDOW (self), x11_time);
+    tpaw_window_present_with_time (GTK_WINDOW (self), x11_time);
 
   if (self->priv->call_state == DISCONNECTED)
     {
@@ -2809,11 +2819,7 @@ empathy_call_window_get_video_sink_pad (EmpathyCallWindow *self)
   if (priv->funnel == NULL)
     {
       output = priv->video_output_sink;
-#ifdef HAVE_GST1
       priv->funnel = gst_element_factory_make ("funnel", NULL);
-#else
-      priv->funnel = gst_element_factory_make ("fsfunnel", NULL);
-#endif
 
       if (!priv->funnel)
         {
@@ -2853,11 +2859,7 @@ empathy_call_window_get_video_sink_pad (EmpathyCallWindow *self)
           goto error_output_added;
         }
     }
-#ifdef HAVE_GST1
   pad = gst_element_get_request_pad (priv->funnel, "sink_%u");
-#else
-  pad = gst_element_get_request_pad (priv->funnel, "sink%d");
-#endif
 
   if (!pad)
     g_warning ("Could not get request pad from funnel");
@@ -3338,7 +3340,6 @@ empathy_call_window_check_video_cb (gpointer data)
 }
 
 /* Called from the streaming thread */
-#ifdef HAVE_GST1
 static GstPadProbeReturn
 empathy_call_window_video_probe_cb (GstPad *pad,
     GstPadProbeInfo *info,
@@ -3358,29 +3359,6 @@ empathy_call_window_video_probe_cb (GstPad *pad,
 
   return GST_PAD_PROBE_OK;
 }
-#else
-static gboolean
-empathy_call_window_video_probe_cb (GstPad *pad,
-    GstMiniObject *mini_obj,
-    EmpathyCallWindow *self)
-{
-  /* Ignore events */
-  if (GST_IS_EVENT (mini_obj))
-    return TRUE;
-
-  if (G_UNLIKELY (!self->priv->got_video))
-    {
-      /* show the remote video */
-      g_idle_add_full (G_PRIORITY_DEFAULT_IDLE,
-          empathy_call_window_show_video_output_cb,
-          g_object_ref (self), g_object_unref);
-
-      self->priv->got_video = TRUE;
-    }
-
-  return TRUE;
-}
-#endif
 
 /* Called from the streaming thread */
 static gboolean
@@ -3407,14 +3385,10 @@ empathy_call_window_src_added_cb (EmpathyCallHandler *handler,
         g_idle_add (empathy_call_window_show_video_output_cb, self);
         pad = empathy_call_window_get_video_sink_pad (self);
 
-#ifdef HAVE_GST1
         gst_pad_add_probe (src,
             GST_PAD_PROBE_TYPE_BUFFER | GST_PAD_PROBE_TYPE_BUFFER_LIST,
             empathy_call_window_video_probe_cb, self, NULL);
-#else
-        gst_pad_add_data_probe (src,
-            G_CALLBACK (empathy_call_window_video_probe_cb), self);
-#endif
+
         if (priv->got_video_src > 0)
           g_source_remove (priv->got_video_src);
         priv->got_video_src = g_timeout_add_seconds (1,
@@ -3593,11 +3567,7 @@ empathy_call_window_content_added_cb (EmpathyCallHandler *handler,
       case FS_MEDIA_TYPE_VIDEO:
         if (priv->video_tee != NULL)
           {
-#ifdef HAVE_GST1
             pad = gst_element_get_request_pad (priv->video_tee, "src_%u");
-#else
-            pad = gst_element_get_request_pad (priv->video_tee, "src%d");
-#endif
             if (GST_PAD_LINK_FAILED (gst_pad_link (pad, sink)))
               {
                 g_warning ("Could not link video source input pipeline");