]> git.0d.be Git - empathy.git/blobdiff - src/empathy-call-window.c
include telepathy-glib.h
[empathy.git] / src / empathy-call-window.c
index 191a238335726ea332008f18c5d30a54aa550591..db7605bfe358f28f5f365f9f3d8adfdefcaad7ca 100644 (file)
 #include <clutter-gtk/clutter-gtk.h>
 #include <clutter-gst/clutter-gst.h>
 
-#include <telepathy-glib/util.h>
 #include <telepathy-farstream/telepathy-farstream.h>
-#include <telepathy-glib/util.h>
+#include <telepathy-glib/telepathy-glib.h>
 
 #include <farstream/fs-element-added-notifier.h>
 #include <farstream/fs-utils.h>
 
 #include <libempathy/empathy-camera-monitor.h>
 #include <libempathy/empathy-gsettings.h>
-#include <libempathy/empathy-tp-contact-factory.h>
 #include <libempathy/empathy-request-util.h>
 #include <libempathy/empathy-utils.h>
 
@@ -61,7 +59,6 @@
 #include "empathy-call-window.h"
 #include "empathy-call-window-fullscreen.h"
 #include "empathy-call-factory.h"
-#include "empathy-video-widget.h"
 #include "empathy-about-dialog.h"
 #include "empathy-audio-src.h"
 #include "empathy-audio-sink.h"
 #include "empathy-rounded-texture.h"
 #include "empathy-camera-menu.h"
 
-#define CONTENT_HBOX_BORDER_WIDTH 6
 #define CONTENT_HBOX_SPACING 3
-#define CONTENT_HBOX_CHILDREN_PACKING_PADDING 3
+#define CONTENT_HBOX_CHILDREN_PACKING_PADDING 0
+#define OVERLAY_MARGIN 6
+
+#define REMOTE_VIDEO_DEFAULT_WIDTH 320
+#define REMOTE_VIDEO_DEFAULT_HEIGHT 240
 
 #define SELF_VIDEO_SECTION_WIDTH 120
 #define SELF_VIDEO_SECTION_HEIGHT 90
 #define SELF_VIDEO_SECTION_MARGIN 2
 #define SELF_VIDEO_SECTION_BORDER SELF_VIDEO_SECTION_MARGIN*2
 
-#define FLOATING_TOOLBAR_OPACITY 192
-#define FLOATING_TOOLBAR_SPACING 20
-
 /* The avatar's default width and height are set to the same value because we
    want a square icon. */
-#define REMOTE_CONTACT_AVATAR_DEFAULT_WIDTH EMPATHY_VIDEO_WIDGET_DEFAULT_HEIGHT
-#define REMOTE_CONTACT_AVATAR_DEFAULT_HEIGHT \
-  EMPATHY_VIDEO_WIDGET_DEFAULT_HEIGHT
+#define REMOTE_CONTACT_AVATAR_DEFAULT_HEIGHT REMOTE_VIDEO_DEFAULT_HEIGHT
+#define REMOTE_CONTACT_AVATAR_DEFAULT_WIDTH REMOTE_VIDEO_DEFAULT_HEIGHT
 
 #define SMALL_TOOLBAR_SIZE 36
 
@@ -161,11 +157,13 @@ struct _EmpathyCallWindowPriv
   GtkWidget *remote_user_avatar_widget;
   GtkWidget *remote_user_avatar_toolbar;
   GtkWidget *remote_user_name_toolbar;
+  GtkWidget *remote_user_status_toolbar;
   GtkWidget *status_label;
   GtkWidget *hangup_button;
   GtkWidget *audio_call_button;
   GtkWidget *video_call_button;
   GtkWidget *mic_button;
+  GtkWidget *microphone_icon;
   GtkWidget *volume_button;
   GtkWidget *camera_button;
   GtkWidget *dialpad_button;
@@ -182,9 +180,9 @@ struct _EmpathyCallWindowPriv
   ClutterActor *video_box;
   ClutterLayoutManager *video_layout;
 
-  /* A Box layout manager containing a bin for previews
+  /* A bin layout manager containing a bin for previews
    * and the floating toolbar */
-  ClutterActor *overlay_box;
+  ClutterActor *overlay_bin;
   ClutterLayoutManager *overlay_layout;
 
   /* Bin layout for the previews */
@@ -242,7 +240,7 @@ struct _EmpathyCallWindowPriv
   GTimer *timer;
   guint timer_id;
 
-  GMutex *lock;
+  GMutex lock;
   gboolean call_started;
   gboolean sending_video;
   CameraState camera_state;
@@ -274,6 +272,8 @@ struct _EmpathyCallWindowPriv
   GSettings *settings;
   EmpathyMicMenu *mic_menu;
   EmpathyCameraMenu *camera_menu;
+
+  gboolean muted;
 };
 
 #define GET_PRIV(o) (EMPATHY_CALL_WINDOW (o)->priv)
@@ -323,6 +323,8 @@ static void empathy_call_window_status_message (EmpathyCallWindow *window,
 static gboolean empathy_call_window_bus_message (GstBus *bus,
   GstMessage *message, gpointer user_data);
 
+static gboolean empathy_call_window_update_timer (gpointer user_data);
+
 static void
 make_background_transparent (GtkClutterActor *actor)
 {
@@ -385,7 +387,7 @@ empathy_call_window_show_video_output (EmpathyCallWindow *self,
 
   gtk_widget_set_visible (self->priv->remote_user_avatar_widget, !show);
 
-  clutter_actor_raise_top (self->priv->overlay_box);
+  clutter_actor_raise_top (self->priv->overlay_bin);
 }
 
 static void
@@ -460,6 +462,31 @@ element_volume_to_audio_control (GBinding *binding,
   return TRUE;
 }
 
+static void
+audio_input_mute_notify_cb (GObject *obj, GParamSpec *spec,
+  EmpathyCallWindow *self)
+{
+  gboolean muted;
+  g_object_get (obj, "mute", &muted, NULL);
+
+  self->priv->muted = muted;
+  if (muted && self->priv->transitions)
+    clutter_state_set_state (self->priv->transitions, "fade-in");
+
+  if (muted)
+    {
+      gtk_image_set_from_icon_name (GTK_IMAGE (self->priv->microphone_icon),
+          EMPATHY_IMAGE_MIC_MUTED, GTK_ICON_SIZE_MENU);
+    }
+  else
+    {
+      gtk_image_set_from_icon_name (GTK_IMAGE (self->priv->microphone_icon),
+          EMPATHY_IMAGE_MIC, GTK_ICON_SIZE_MENU);
+    }
+
+  empathy_call_window_update_timer (self);
+}
+
 static void
 create_audio_input (EmpathyCallWindow *self)
 {
@@ -469,10 +496,8 @@ create_audio_input (EmpathyCallWindow *self)
   priv->audio_input = empathy_audio_src_new ();
   gst_object_ref_sink (priv->audio_input);
 
-  g_object_bind_property (priv->mic_button, "active",
-    priv->audio_input, "mute",
-    G_BINDING_BIDIRECTIONAL |
-      G_BINDING_INVERT_BOOLEAN | G_BINDING_SYNC_CREATE);
+  g_signal_connect (priv->audio_input, "notify::mute",
+    G_CALLBACK (audio_input_mute_notify_cb), self);
 }
 
 static void
@@ -519,8 +544,8 @@ empathy_call_window_disable_camera_cb (GtkAction *action,
 {
   clutter_actor_destroy (self->priv->preview_hidden_button);
 
-  gtk_toggle_tool_button_set_active (
-      GTK_TOGGLE_TOOL_BUTTON (self->priv->camera_button), FALSE);
+  gtk_toggle_button_set_active (
+      GTK_TOGGLE_BUTTON (self->priv->camera_button), FALSE);
 }
 
 static void
@@ -653,9 +678,9 @@ empathy_call_window_create_preview_rectangles (EmpathyCallWindow *self)
       CLUTTER_BIN_ALIGNMENT_CENTER, CLUTTER_BIN_ALIGNMENT_CENTER);
   self->priv->preview_box = box = clutter_box_new (self->priv->preview_layout);
 
-  clutter_box_layout_pack (CLUTTER_BOX_LAYOUT (self->priv->overlay_layout),
-      box, TRUE, TRUE, TRUE,
-      CLUTTER_BOX_ALIGNMENT_CENTER, CLUTTER_BOX_ALIGNMENT_START);
+  clutter_bin_layout_add (CLUTTER_BIN_LAYOUT (self->priv->overlay_layout),
+      box,
+      CLUTTER_BIN_ALIGNMENT_FILL, CLUTTER_BIN_ALIGNMENT_FILL);
 
   self->priv->preview_rectangle1 =
       empathy_call_window_create_preview_rectangle (self,
@@ -843,51 +868,28 @@ empathy_call_window_move_video_preview (EmpathyCallWindow *self,
   g_settings_set_enum (self->priv->settings, "camera-position", pos);
 }
 
-static void
-_clutter_color_from_rgba (ClutterColor *color,
-                          const GdkRGBA *rgba)
-{
-  color->red = (guint8) floor (rgba->red * 255);
-  color->green = (guint8) floor (rgba->green * 255);
-  color->blue = (guint8) floor (rgba->blue * 255);
-  color->alpha = (guint8) floor (rgba->alpha * 255);
-}
-
 static void
 empathy_call_window_highlight_preview_rectangle (EmpathyCallWindow *self,
     PreviewPosition pos)
 {
   ClutterActor *rectangle;
-  GtkStyleContext *context;
-  GdkRGBA rgba;
-  ClutterColor color, highlight;
+  ClutterColor white = { 0xff, 0xff, 0xff, 0xff};
 
   rectangle = empathy_call_window_get_preview_rectangle (self, pos);
-  context = gtk_widget_get_style_context (GTK_WIDGET (self));
-  gtk_style_context_get_color (context, 0, &rgba);
-
-  _clutter_color_from_rgba (&color, &rgba);
-  clutter_color_shade (&color, 1.4, &highlight);
 
   empathy_rounded_rectangle_set_border_width (
       EMPATHY_ROUNDED_RECTANGLE (rectangle), 2 * SELF_VIDEO_SECTION_MARGIN);
   empathy_rounded_rectangle_set_border_color (
-      EMPATHY_ROUNDED_RECTANGLE (rectangle), &highlight);
+      EMPATHY_ROUNDED_RECTANGLE (rectangle), &white);
 }
 
 static void
 empathy_call_window_darken_preview_rectangle (EmpathyCallWindow *self,
     ClutterActor *rectangle)
 {
-  GtkStyleContext *context;
-  GdkRGBA rgba;
-  ClutterColor color, darker;
-
-  context = gtk_widget_get_style_context (GTK_WIDGET (self));
-  gtk_style_context_get_background_color (context, 0, &rgba);
+  ClutterColor white = { 0xff, 0xff, 0xff, 0xff}, darker;
 
-  _clutter_color_from_rgba (&color, &rgba);
-  clutter_color_shade (&color, 0.55, &darker);
+  clutter_color_shade (&white, 0.55, &darker);
 
   empathy_rounded_rectangle_set_border_width (
       EMPATHY_ROUNDED_RECTANGLE (rectangle), 1);
@@ -1310,10 +1312,10 @@ enable_camera (EmpathyCallWindow *self)
 }
 
 static void
-empathy_call_window_camera_toggled_cb (GtkToggleToolButton *toggle,
+empathy_call_window_camera_toggled_cb (GtkToggleButton *toggle,
   EmpathyCallWindow *self)
 {
-  if (gtk_toggle_tool_button_get_active (toggle))
+  if (gtk_toggle_button_get_active (toggle))
     enable_camera (self);
   else
     disable_camera (self);
@@ -1381,9 +1383,11 @@ empathy_call_window_toolbar_timeout (gpointer data)
   EmpathyCallWindow *self = data;
 
   /* We don't want to hide the toolbar if we're not in a call, as
-   * to show the call status all the time. */
+   * to show the call status all the time. Also don't hide if we're muted
+   * to prevent the awkward, talking when muted situation */
   if (self->priv->call_state != CONNECTING &&
-      self->priv->call_state != DISCONNECTED)
+      self->priv->call_state != DISCONNECTED &&
+      !self->priv->muted)
     clutter_state_set_state (self->priv->transitions, "fade-out");
 
   return TRUE;
@@ -1539,6 +1543,16 @@ empathy_call_window_start_ringing (EmpathyCallWindow *self,
   tp_add_dispatch_operation_context_accept (context);
 }
 
+static void
+mic_button_clicked (GtkWidget *button,
+    EmpathyCallWindow *self)
+{
+  /* Toggle the muted state. We rely on audio_input_mute_notify_cb to update
+   * the icon. */
+  empathy_audio_src_set_mute (EMPATHY_GST_AUDIO_SRC (self->priv->audio_input),
+      !self->priv->muted);
+}
+
 static void
 empathy_call_window_init (EmpathyCallWindow *self)
 {
@@ -1548,15 +1562,15 @@ empathy_call_window_init (EmpathyCallWindow *self)
   gchar *filename;
   ClutterConstraint *constraint;
   ClutterActor *remote_avatar;
-  GtkStyleContext *context;
-  GtkCssProvider *provider;
-  GdkRGBA rgba;
-  ClutterColor bg;
+  ClutterColor black = { 0, 0, 0, 0 };
+  ClutterMargin overlay_margin = { OVERLAY_MARGIN, OVERLAY_MARGIN,
+    OVERLAY_MARGIN, OVERLAY_MARGIN };
 
   priv = self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
     EMPATHY_TYPE_CALL_WINDOW, EmpathyCallWindowPriv);
 
   priv->settings = g_settings_new (EMPATHY_PREFS_CALL_SCHEMA);
+  priv->timer = g_timer_new ();
 
   filename = empathy_file_lookup ("empathy-call-window.ui", "src");
   gui = empathy_builder_get_file (filename,
@@ -1564,11 +1578,13 @@ empathy_call_window_init (EmpathyCallWindow *self)
     "errors_vbox", &priv->errors_vbox,
     "pane", &priv->pane,
     "remote_user_name_toolbar", &priv->remote_user_name_toolbar,
+    "remote_user_status_toolbar", &priv->remote_user_status_toolbar,
     "remote_user_avatar_toolbar", &priv->remote_user_avatar_toolbar,
     "status_label", &priv->status_label,
     "audiocall", &priv->audio_call_button,
     "videocall", &priv->video_call_button,
     "microphone", &priv->mic_button,
+    "microphone_icon", &priv->microphone_icon,
     "volume", &priv->volume_button,
     "camera", &priv->camera_button,
     "hangup", &priv->hangup_button,
@@ -1611,17 +1627,7 @@ empathy_call_window_init (EmpathyCallWindow *self)
     "menupreviewswap", "activate", empathy_call_window_swap_camera_cb,
     NULL);
 
-  /* FIXME: we should use a stock "OSD" style class for the toolbar,
-   * once it's available in GTK+/Adwaita.
-   */
-  provider = gtk_css_provider_new ();
-  gtk_css_provider_load_from_data (provider,
-      "#CallFloatingToolbar { border-radius: 6px; }", -1, NULL);
-  gtk_style_context_add_provider (
-      gtk_widget_get_style_context (priv->bottom_toolbar),
-      GTK_STYLE_PROVIDER (provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
-  g_object_unref (provider);
-
+  empathy_set_css_provider (GTK_WIDGET (self));
   gtk_action_set_sensitive (priv->menu_fullscreen, FALSE);
 
   priv->camera_monitor = empathy_camera_monitor_dup_singleton ();
@@ -1635,40 +1641,34 @@ empathy_call_window_init (EmpathyCallWindow *self)
   g_signal_connect (priv->camera_monitor, "removed",
       G_CALLBACK (empathy_call_window_camera_removed_cb), self);
 
-  priv->lock = g_mutex_new ();
+  g_signal_connect (priv->mic_button, "clicked",
+      G_CALLBACK (mic_button_clicked), self);
+
+  g_mutex_init (&priv->lock);
 
   gtk_container_add (GTK_CONTAINER (self), top_vbox);
 
   priv->content_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL,
       CONTENT_HBOX_SPACING);
-  gtk_container_set_border_width (GTK_CONTAINER (priv->content_hbox),
-                                  CONTENT_HBOX_BORDER_WIDTH);
   gtk_box_pack_start (GTK_BOX (priv->pane), priv->content_hbox,
       TRUE, TRUE, 0);
 
   /* main contents remote avatar/video box */
-  priv->video_layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER,
-      CLUTTER_BIN_ALIGNMENT_CENTER);
+  priv->video_layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_FILL,
+      CLUTTER_BIN_ALIGNMENT_FILL);
 
   priv->video_box = clutter_box_new (priv->video_layout);
 
   priv->video_container = gtk_clutter_embed_new ();
 
   gtk_widget_set_size_request (priv->video_container,
-      EMPATHY_VIDEO_WIDGET_DEFAULT_WIDTH, EMPATHY_VIDEO_WIDGET_DEFAULT_HEIGHT);
-
-  /* Set the background color to that of the rest of the window */
-  context = gtk_widget_get_style_context (priv->content_hbox);
-  gtk_style_context_get_background_color (context,
-      GTK_STATE_FLAG_NORMAL, &rgba);
-  bg.red = CLAMP (rgba.red * 255.0, 0, 255);
-  bg.green = CLAMP (rgba.green * 255.0, 0, 255);
-  bg.blue = CLAMP (rgba.blue * 255.0, 0, 255);
-  bg.alpha = CLAMP (rgba.alpha * 255.0, 0, 255);
+      REMOTE_VIDEO_DEFAULT_WIDTH, REMOTE_VIDEO_DEFAULT_HEIGHT);
+
+  /* Set the background black */
   clutter_stage_set_color (
       CLUTTER_STAGE (gtk_clutter_embed_get_stage (
           GTK_CLUTTER_EMBED (priv->video_container))),
-      &bg);
+      &black);
 
   clutter_container_add (
       CLUTTER_CONTAINER (gtk_clutter_embed_get_stage (
@@ -1684,18 +1684,21 @@ empathy_call_window_init (EmpathyCallWindow *self)
   priv->remote_user_avatar_widget = gtk_image_new ();
   remote_avatar = gtk_clutter_actor_new_with_contents (
       priv->remote_user_avatar_widget);
+  make_background_transparent (GTK_CLUTTER_ACTOR (remote_avatar));
 
   clutter_container_add_actor (CLUTTER_CONTAINER (priv->video_box),
       remote_avatar);
 
-  /* create the overlay box */
-  priv->overlay_layout = clutter_box_layout_new ();
-  clutter_box_layout_set_vertical (
-      CLUTTER_BOX_LAYOUT (priv->overlay_layout), TRUE);
-  priv->overlay_box = clutter_box_new (priv->overlay_layout);
+  /* create the overlay bin */
+  priv->overlay_layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER,
+    CLUTTER_BIN_ALIGNMENT_CENTER);
+  priv->overlay_bin = clutter_actor_new ();
+  clutter_actor_set_layout_manager (priv->overlay_bin, priv->overlay_layout);
+
+  clutter_actor_set_margin (priv->overlay_bin, &overlay_margin);
 
   clutter_bin_layout_add (CLUTTER_BIN_LAYOUT (priv->video_layout),
-      priv->overlay_box,
+      priv->overlay_bin,
       CLUTTER_BIN_ALIGNMENT_FILL, CLUTTER_BIN_ALIGNMENT_FILL);
 
   empathy_call_window_create_preview_rectangles (self);
@@ -1713,14 +1716,15 @@ empathy_call_window_init (EmpathyCallWindow *self)
   clutter_actor_set_reactive (priv->floating_toolbar, TRUE);
   make_background_transparent (GTK_CLUTTER_ACTOR (priv->floating_toolbar));
 
+  gtk_style_context_add_class (
+      gtk_widget_get_style_context (GTK_WIDGET (priv->bottom_toolbar)),
+      GTK_STYLE_CLASS_OSD);
   gtk_widget_reparent (priv->bottom_toolbar,
       gtk_clutter_actor_get_widget (GTK_CLUTTER_ACTOR (priv->floating_toolbar)));
 
-  clutter_box_layout_pack (CLUTTER_BOX_LAYOUT (priv->overlay_layout),
-      priv->floating_toolbar, FALSE, FALSE, FALSE,
-      CLUTTER_BOX_ALIGNMENT_CENTER, CLUTTER_BOX_ALIGNMENT_END);
-
-  clutter_actor_set_opacity (priv->floating_toolbar, FLOATING_TOOLBAR_OPACITY);
+  clutter_bin_layout_add (CLUTTER_BIN_LAYOUT (priv->overlay_layout),
+      priv->floating_toolbar,
+      CLUTTER_BIN_ALIGNMENT_CENTER, CLUTTER_BIN_ALIGNMENT_END);
 
   clutter_actor_raise_top (priv->floating_toolbar);
 
@@ -1739,7 +1743,7 @@ empathy_call_window_init (EmpathyCallWindow *self)
   /* transition from any state to "fade-in" state */
   clutter_state_set (priv->transitions, NULL, "fade-in",
       priv->floating_toolbar,
-      "opacity", CLUTTER_EASE_OUT_QUAD, FLOATING_TOOLBAR_OPACITY,
+      "opacity", CLUTTER_EASE_OUT_QUAD, 255,
       NULL);
 
   /* put the actor into the "fade-in" state with no animation */
@@ -1793,8 +1797,6 @@ empathy_call_window_init (EmpathyCallWindow *self)
   g_signal_connect (self, "motion-notify-event",
       G_CALLBACK (empathy_call_window_motion_notify_cb), self);
 
-  priv->timer = g_timer_new ();
-
   g_object_ref (priv->ui_manager);
   g_object_unref (gui);
 
@@ -1873,12 +1875,20 @@ set_remote_user_name (EmpathyCallWindow *self,
 {
   const gchar *alias = empathy_contact_get_alias (contact);
   const gchar *status = empathy_contact_get_status (contact);
-  gchar *label;
 
-  label = g_strdup_printf ("%s\n<small>%s</small>", alias, status);
-  gtk_label_set_markup (GTK_LABEL (self->priv->remote_user_name_toolbar),
-      label);
-  g_free (label);
+  gtk_label_set_text (GTK_LABEL (self->priv->remote_user_name_toolbar), alias);
+
+  if (status != NULL) {
+    gchar *markup;
+
+    markup = g_markup_printf_escaped ("<small>%s</small>", status);
+    gtk_label_set_markup (GTK_LABEL (self->priv->remote_user_status_toolbar),
+      markup);
+    g_free (markup);
+  } else {
+    gtk_label_set_markup (GTK_LABEL (self->priv->remote_user_status_toolbar),
+      "");
+  }
 }
 
 static void
@@ -2204,8 +2214,8 @@ empathy_call_window_constructed (GObject *object)
 
   if (!empathy_call_handler_has_initial_video (priv->handler))
     {
-      gtk_toggle_tool_button_set_active (
-          GTK_TOGGLE_TOOL_BUTTON (priv->camera_button), FALSE);
+      gtk_toggle_button_set_active (
+          GTK_TOGGLE_BUTTON (priv->camera_button), FALSE);
     }
   /* If call has InitialVideo, the preview will be started once the call has
    * been started (start_call()). */
@@ -2369,7 +2379,7 @@ empathy_call_window_finalize (GObject *object)
   disconnect_video_output_motion_handler (self);
 
   /* free any data held directly by the object here */
-  g_mutex_free (priv->lock);
+  g_mutex_clear (&priv->lock);
 
   g_timer_destroy (priv->timer);
 
@@ -2542,7 +2552,7 @@ empathy_call_window_disconnected (EmpathyCallWindow *self,
 
   if (could_reset_pipeline)
     {
-      g_mutex_lock (priv->lock);
+      g_mutex_lock (&priv->lock);
 
       g_timer_stop (priv->timer);
 
@@ -2550,7 +2560,7 @@ empathy_call_window_disconnected (EmpathyCallWindow *self,
         g_source_remove (priv->timer_id);
       priv->timer_id = 0;
 
-      g_mutex_unlock (priv->lock);
+      g_mutex_unlock (&priv->lock);
 
       if (!restart)
         /* We are about to destroy the window, no need to update it or create
@@ -2566,8 +2576,8 @@ empathy_call_window_disconnected (EmpathyCallWindow *self,
       gtk_widget_set_sensitive (priv->mic_button, FALSE);
 
       /* Be sure that the mic button is enabled */
-      gtk_toggle_tool_button_set_active (
-          GTK_TOGGLE_TOOL_BUTTON (priv->mic_button), TRUE);
+      empathy_audio_src_set_mute (
+          EMPATHY_GST_AUDIO_SRC (self->priv->audio_input), TRUE);
 
       if (priv->camera_state == CAMERA_STATE_ON)
         {
@@ -2856,8 +2866,7 @@ empathy_call_window_update_timer (gpointer user_data)
 
   if (priv->call_state == HELD)
     status = _("On hold");
-  else if (!gtk_toggle_tool_button_get_active (
-      GTK_TOGGLE_TOOL_BUTTON (priv->mic_button)))
+  else if (priv->muted)
     status = _("Mute");
   else
     status = _("Duration");
@@ -3027,7 +3036,7 @@ media_stream_error_to_txt (EmpathyCallWindow *self,
 
       case TP_MEDIA_STREAM_ERROR_INVALID_CM_BEHAVIOR:
         tp_connection_parse_object_path (
-            tp_channel_borrow_connection (TP_CHANNEL (call)),
+            tp_channel_get_connection (TP_CHANNEL (call)),
             NULL, &cm);
 
         url = g_strdup_printf ("http://bugs.freedesktop.org/enter_bug.cgi?"
@@ -3114,7 +3123,7 @@ show_balance_error (EmpathyCallWindow *self)
       "call-channel", &call,
       NULL);
 
-  conn = tp_channel_borrow_connection (call);
+  conn = tp_channel_get_connection (call);
   g_object_unref (call);
 
   uri = tp_connection_get_balance_uri (conn);
@@ -3200,12 +3209,12 @@ empathy_call_window_state_changed_cb (EmpathyCallHandler *handler,
 
   g_object_unref (call);
 
-  g_mutex_lock (priv->lock);
+  g_mutex_lock (&priv->lock);
 
   priv->timer_id = g_timeout_add_seconds (1,
     empathy_call_window_update_timer, self);
 
-  g_mutex_unlock (priv->lock);
+  g_mutex_unlock (&priv->lock);
 
   empathy_call_window_update_timer (self);
 
@@ -3221,7 +3230,7 @@ empathy_call_window_show_video_output_cb (gpointer user_data)
     {
       gtk_widget_hide (self->priv->remote_user_avatar_widget);
       clutter_actor_show (self->priv->video_output);
-      clutter_actor_raise_top (self->priv->overlay_box);
+      clutter_actor_raise_top (self->priv->overlay_bin);
     }
 
   return FALSE;
@@ -3245,6 +3254,27 @@ 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,
+    gpointer user_data)
+{
+    EmpathyCallWindow *self = user_data;
+
+  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 GST_PAD_PROBE_OK;
+}
+#else
 static gboolean
 empathy_call_window_video_probe_cb (GstPad *pad,
     GstMiniObject *mini_obj,
@@ -3266,6 +3296,7 @@ empathy_call_window_video_probe_cb (GstPad *pad,
 
   return TRUE;
 }
+#endif
 
 /* Called from the streaming thread */
 static gboolean
@@ -3279,7 +3310,7 @@ empathy_call_window_src_added_cb (EmpathyCallHandler *handler,
 
   GstPad *pad;
 
-  g_mutex_lock (priv->lock);
+  g_mutex_lock (&priv->lock);
 
   g_object_get (content, "media-type", &media_type, NULL);
 
@@ -3292,8 +3323,14 @@ 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,
@@ -3346,7 +3383,7 @@ empathy_call_window_src_added_cb (EmpathyCallHandler *handler,
     }
 
 
-  g_mutex_unlock (priv->lock);
+  g_mutex_unlock (&priv->lock);
 
   return TRUE;
 }
@@ -3472,7 +3509,11 @@ 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");
@@ -3546,13 +3587,13 @@ start_call (EmpathyCallWindow *self)
           s == TP_SENDING_STATE_SENDING)
         {
           /* Enable 'send video' buttons and display the preview */
-          gtk_toggle_tool_button_set_active (
-            GTK_TOGGLE_TOOL_BUTTON (priv->camera_button), TRUE);
+          gtk_toggle_button_set_active (
+            GTK_TOGGLE_BUTTON (priv->camera_button), TRUE);
         }
       else
         {
-          gtk_toggle_tool_button_set_active (
-            GTK_TOGGLE_TOOL_BUTTON (priv->camera_button), FALSE);
+          gtk_toggle_button_set_active (
+            GTK_TOGGLE_BUTTON (priv->camera_button), FALSE);
 
           if (priv->video_preview == NULL)
             {
@@ -3830,8 +3871,6 @@ show_borders (EmpathyCallWindow *window, gboolean set_fullscreen)
 {
   EmpathyCallWindowPriv *priv = GET_PRIV (window);
 
-  gtk_container_set_border_width (GTK_CONTAINER (priv->content_hbox),
-      set_fullscreen ? 0 : CONTENT_HBOX_BORDER_WIDTH);
   gtk_box_set_spacing (GTK_BOX (priv->content_hbox),
       set_fullscreen ? 0 : CONTENT_HBOX_SPACING);
 
@@ -4039,6 +4078,7 @@ empathy_call_window_key_press_cb (GtkWidget *video_output,
   GdkEventKey *event, EmpathyCallWindow *window)
 {
   EmpathyCallWindowPriv *priv = GET_PRIV (window);
+  gchar key;
 
   if (priv->is_fullscreen && event->keyval == GDK_KEY_Escape)
     {
@@ -4048,7 +4088,34 @@ empathy_call_window_key_press_cb (GtkWidget *video_output,
       return TRUE;
     }
 
-  return FALSE;
+  key = gdk_keyval_to_unicode (event->keyval);
+  switch (key)
+    {
+      case '0':
+      case '1':
+      case '2':
+      case '3':
+      case '4':
+      case '5':
+      case '6':
+      case '7':
+      case '8':
+      case '9':
+      case '*':
+      case '#':
+        break;
+      default:
+        return TRUE;
+        break;
+    }
+
+  gtk_toggle_tool_button_set_active (
+      GTK_TOGGLE_TOOL_BUTTON (priv->dialpad_button), TRUE);
+
+  empathy_dialpad_widget_press_key (
+      EMPATHY_DIALPAD_WIDGET (priv->dtmf_panel), key);
+
+  return TRUE;
 }
 
 static gboolean