]> git.0d.be Git - empathy.git/blobdiff - src/empathy-call-window.c
Add Marco Barisione to CONTRIBUTORS
[empathy.git] / src / empathy-call-window.c
index c291e70f6b719a33c2430a1018a4120dfcd56893..8edf6817c1a7c934dc38d7b873f617f8a88ea10e 100644 (file)
 
 #include <libempathy/empathy-contact.h>
 #include <libempathy/empathy-tp-call.h>
-#include <libempathy/empathy-debug.h>
+#include <libempathy/empathy-tp-group.h>
 #include <libempathy/empathy-utils.h>
 #include <libempathy-gtk/empathy-ui-utils.h>
 
 #include "empathy-call-window.h"
 
-#define DEBUG_DOMAIN "CallWindow"
+#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
+#include <libempathy/empathy-debug.h>
 
-typedef struct 
+typedef struct
 {
+  EmpathyTpCall *call;
+  GTimeVal start_time;
+  guint timeout_event_id;
+  gboolean is_drawing;
+  guint status; 
+
   GtkWidget *window;
+  GtkWidget *main_hbox;
+  GtkWidget *controls_vbox;
+  GtkWidget *volume_hbox;
   GtkWidget *status_label;
-  GtkWidget *start_call_button;
-  GtkWidget *end_call_button;
-  GtkWidget *input_volume_scale;
-  GtkWidget *output_volume_scale;
-  GtkWidget *input_mute_button;
-  GtkWidget *output_mute_button;
-  GtkWidget *preview_video_frame;
-  GtkWidget *output_video_frame;
+  GtkWidget *input_volume_button;
+  GtkWidget *output_volume_button;
   GtkWidget *preview_video_socket;
   GtkWidget *output_video_socket;
   GtkWidget *video_button;
-  GtkWidget *output_video_label;
-
-  EmpathyTpCall *call;
-
-  GTimeVal start_time;
-  guint timeout_event_id;
-
-  gboolean is_drawing;
+  GtkWidget *hang_up_button;
+  GtkWidget *confirmation_dialog;
+  GtkWidget *keypad_expander;
 } EmpathyCallWindow;
 
+static GSList *windows = NULL;
+
 static gboolean
 call_window_update_timer (gpointer data)
 {
@@ -101,7 +102,7 @@ call_window_update_timer (gpointer data)
 static void
 call_window_stop_timeout (EmpathyCallWindow *window)
 {
-  empathy_debug (DEBUG_DOMAIN, "Timer stopped");
+  DEBUG ("Timer stopped");
 
   if (window->timeout_event_id)
     {
@@ -114,33 +115,22 @@ static void
 call_window_set_output_video_is_drawing (EmpathyCallWindow *window,
                                          gboolean is_drawing)
 {
-  GtkWidget* child;
-
-  child = gtk_bin_get_child (GTK_BIN (window->output_video_frame));
-
-  empathy_debug (DEBUG_DOMAIN,
-      "Setting output video is drawing - %d", is_drawing);
+  DEBUG ("Setting output video is drawing - %d", is_drawing);
 
   if (is_drawing && !window->is_drawing)
     {
-      if (child)
-          gtk_container_remove (GTK_CONTAINER (window->output_video_frame),
-              child);
-      gtk_container_add (GTK_CONTAINER (window->output_video_frame),
-          window->output_video_socket);
-      gtk_widget_show (window->output_video_socket);
+      gtk_window_set_resizable (GTK_WINDOW (window->window), TRUE);
+      gtk_box_pack_end (GTK_BOX (window->main_hbox),
+          window->output_video_socket, TRUE, TRUE, 0);
       empathy_tp_call_add_output_video (window->call,
           gtk_socket_get_id (GTK_SOCKET (window->output_video_socket)));
     }
   if (!is_drawing && window->is_drawing)
     {
+      gtk_window_set_resizable (GTK_WINDOW (window->window), FALSE);
       empathy_tp_call_add_output_video (window->call, 0);
-      if (child)
-          gtk_container_remove (GTK_CONTAINER (window->output_video_frame),
-              child);
-      gtk_container_add (GTK_CONTAINER (window->output_video_frame),
-          window->output_video_label);
-      gtk_widget_show (window->output_video_label);
+      gtk_container_remove (GTK_CONTAINER (window->main_hbox),
+          window->output_video_socket);
     }
 
   window->is_drawing = is_drawing;
@@ -149,6 +139,13 @@ call_window_set_output_video_is_drawing (EmpathyCallWindow *window,
 static void
 call_window_finalize (EmpathyCallWindow *window)
 {
+  gtk_label_set_text (GTK_LABEL (window->status_label), _("Closed"));
+  gtk_widget_set_sensitive (window->hang_up_button, FALSE);
+  gtk_widget_set_sensitive (window->video_button, FALSE);
+  gtk_widget_set_sensitive (window->output_volume_button, FALSE);
+  gtk_widget_set_sensitive (window->input_volume_button, FALSE);
+  gtk_widget_set_sensitive (window->keypad_expander, FALSE);
+
   if (window->call)
     { 
       call_window_stop_timeout (window);
@@ -158,6 +155,9 @@ call_window_finalize (EmpathyCallWindow *window)
       g_object_unref (window->call);
       window->call = NULL;
     }
+
+  if (window->confirmation_dialog)
+      gtk_widget_destroy (window->confirmation_dialog);
 }
 
 static void
@@ -166,12 +166,12 @@ call_window_socket_realized_cb (GtkWidget *widget,
 {
   if (widget == window->preview_video_socket)
     {
-      empathy_debug (DEBUG_DOMAIN, "Preview socket realized");
+      DEBUG ("Preview socket realized");
       empathy_tp_call_add_preview_video (window->call,
           gtk_socket_get_id (GTK_SOCKET (window->preview_video_socket)));
     }
   else
-      empathy_debug (DEBUG_DOMAIN, "Output socket realized");
+      DEBUG ("Output socket realized");
 }
 
 static void
@@ -179,71 +179,58 @@ call_window_video_button_toggled_cb (GtkWidget *button,
                                      EmpathyCallWindow *window)
 {
   gboolean is_sending;
+  guint status;
 
   is_sending = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
 
-  empathy_debug (DEBUG_DOMAIN, "Send video toggled - %d", is_sending);
-
-  empathy_tp_call_request_video_stream_direction (window->call, is_sending);
-}
-
-static void
-call_window_start_call_button_clicked_cb (GtkWidget *widget,
-                                          EmpathyCallWindow *window)
-{
-  empathy_debug (DEBUG_DOMAIN, "Start call clicked");
+  DEBUG ("Send video toggled - %d", is_sending);
 
-  gtk_widget_set_sensitive (window->start_call_button, FALSE);
-  empathy_tp_call_accept_incoming_call (window->call);
+  g_object_get (window->call, "status", &status, NULL);
+  if (status == EMPATHY_TP_CALL_STATUS_ACCEPTED)
+      empathy_tp_call_request_video_stream_direction (window->call, is_sending);
 }
 
 static void
-call_window_end_call_button_clicked_cb (GtkWidget *widget,
-                                        EmpathyCallWindow *window)
+call_window_hang_up_button_clicked_cb (GtkWidget *widget,
+                                       EmpathyCallWindow *window)
 {
-  empathy_debug (DEBUG_DOMAIN, "End call clicked");
-
-  gtk_widget_set_sensitive (window->end_call_button, FALSE);
+  DEBUG ("Call clicked, end call");
   call_window_finalize (window);
 }
 
 static void
-call_window_output_volume_changed_cb (GtkWidget *scale,
+call_window_output_volume_changed_cb (GtkScaleButton *button,
+                                      gdouble value,
                                       EmpathyCallWindow *window)
 {
-  guint volume;
-
-  volume = (guint) gtk_range_get_value (GTK_RANGE (scale));
-
-  empathy_debug (DEBUG_DOMAIN, "Output volume changed - %u", volume);
-
-  empathy_tp_call_set_output_volume (window->call, volume);
-}
-
-static void
-call_window_output_mute_button_toggled_cb (GtkWidget *button,
-                                           EmpathyCallWindow *window)
-{
-  gboolean is_muted;
+  if (!window->call)
+      return;
 
-  is_muted = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
-
-  empathy_debug (DEBUG_DOMAIN, "Mute output toggled - %d", is_muted);
-
-  empathy_tp_call_mute_output (window->call, is_muted);
+  if (value <= 0)
+      empathy_tp_call_mute_output (window->call, TRUE);
+  else
+    {
+      empathy_tp_call_mute_output (window->call, FALSE);
+      empathy_tp_call_set_output_volume (window->call, value * 100);
+    }
 }
 
 static void
-call_window_input_mute_button_toggled_cb (GtkWidget *button,
-                                          EmpathyCallWindow *window)
+call_window_input_volume_changed_cb (GtkScaleButton    *button,
+                                     gdouble            value,
+                                     EmpathyCallWindow *window)
 {
-  gboolean is_muted;
+  if (!window->call)
+      return;
 
-  is_muted = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
-
-  empathy_debug (DEBUG_DOMAIN, "Mute input toggled - %d", is_muted);
-
-  empathy_tp_call_mute_input (window->call, is_muted);
+  if (value <= 0)
+      empathy_tp_call_mute_input (window->call, TRUE);
+  else
+    {
+      empathy_tp_call_mute_input (window->call, FALSE);
+      /* FIXME: Not implemented?
+      empathy_tp_call_set_input_volume (window->call, value * 100);*/
+    }
 }
 
 static gboolean
@@ -253,22 +240,27 @@ call_window_delete_event_cb (GtkWidget *widget,
 {
   GtkWidget *dialog;
   gint result;
-  guint status;
+  guint status = EMPATHY_TP_CALL_STATUS_CLOSED;
 
-  empathy_debug (DEBUG_DOMAIN, "Delete event occurred");
+  DEBUG ("Delete event occurred");
+
+  if (window->call)
+      g_object_get (window->call, "status", &status, NULL);
 
-  g_object_get (G_OBJECT (window->call), "status", &status, NULL);
   if (status == EMPATHY_TP_CALL_STATUS_ACCEPTED)
     {
       dialog = gtk_message_dialog_new (GTK_WINDOW (window->window),
           GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
-          GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,
-          "This call will be ended. Continue?");
+          GTK_MESSAGE_WARNING, GTK_BUTTONS_CANCEL, _("End this call?"));
+      gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+          _("Closing this window will end the call in progress."));
+      gtk_dialog_add_button (GTK_DIALOG (dialog), _("_End Call"), GTK_RESPONSE_OK);
+      gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
 
       result = gtk_dialog_run (GTK_DIALOG (dialog));
       gtk_widget_destroy (dialog);
 
-      if (result != GTK_RESPONSE_YES)
+      if (result != GTK_RESPONSE_OK)
           return TRUE;
     }
 
@@ -280,17 +272,71 @@ call_window_destroy_cb (GtkWidget *widget,
                         EmpathyCallWindow *window)
 {
   call_window_finalize (window);
+
   g_object_unref (window->output_video_socket);
   g_object_unref (window->preview_video_socket);
-  g_object_unref (window->output_video_label);
+
+  windows = g_slist_remove (windows, window);
   g_slice_free (EmpathyCallWindow, window);
 }
 
+static void
+call_window_confirmation_dialog_response_cb (GtkDialog *dialog,
+                                             gint response,
+                                             EmpathyCallWindow *window)
+{
+  if (response == GTK_RESPONSE_OK && window->call)
+      empathy_tp_call_accept_incoming_call (window->call);
+  else
+      call_window_finalize (window);
+
+  gtk_widget_destroy (window->confirmation_dialog);
+  window->confirmation_dialog = NULL;
+}
+
+static void
+call_window_show_confirmation_dialog (EmpathyCallWindow *window)
+{
+  EmpathyContact *contact;
+  GtkWidget *button;
+  GtkWidget *image;
+
+  if (window->confirmation_dialog)
+      return;
+
+  g_object_get (window->call, "contact", &contact, NULL);
+
+  window->confirmation_dialog = gtk_message_dialog_new (GTK_WINDOW (window->window),
+      GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+      GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, _("Incoming call"));
+  gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (window->confirmation_dialog),
+      _("%s is calling you, do you want to answer?"),
+      empathy_contact_get_name (contact));
+  gtk_dialog_set_default_response (GTK_DIALOG (window->confirmation_dialog),
+      GTK_RESPONSE_OK);
+
+  button = gtk_dialog_add_button (GTK_DIALOG (window->confirmation_dialog),
+      _("_Reject"), GTK_RESPONSE_CANCEL);
+  image = gtk_image_new_from_icon_name (GTK_STOCK_CANCEL, GTK_ICON_SIZE_BUTTON);
+  gtk_button_set_image (GTK_BUTTON (button), image);
+
+  button = gtk_dialog_add_button (GTK_DIALOG (window->confirmation_dialog),
+      _("_Answer"), GTK_RESPONSE_OK);
+  image = gtk_image_new_from_icon_name (GTK_STOCK_APPLY, GTK_ICON_SIZE_BUTTON);
+  gtk_button_set_image (GTK_BUTTON (button), image);
+
+  g_signal_connect (window->confirmation_dialog, "response",
+      G_CALLBACK (call_window_confirmation_dialog_response_cb),
+      window);
+
+  gtk_widget_show (window->confirmation_dialog);
+  g_object_unref (contact);
+}
+
 static void
 call_window_update (EmpathyCallWindow *window)
 {
   EmpathyContact *contact;
-  guint status;
   guint stream_state;
   EmpathyTpCallStream *audio_stream;
   EmpathyTpCallStream *video_stream;
@@ -298,7 +344,7 @@ call_window_update (EmpathyCallWindow *window)
   gchar *title;
 
   g_object_get (window->call,
-      "status", &status,
+      "status", &window->status,
       "audio-stream", &audio_stream,
       "video-stream", &video_stream,
       "contact", &contact,
@@ -310,46 +356,56 @@ call_window_update (EmpathyCallWindow *window)
   else
       stream_state = audio_stream->state;
 
-  empathy_debug (DEBUG_DOMAIN, "Status changed - status: %d, stream state: %d, "
+  DEBUG ("Status changed - status: %d, stream state: %d, "
       "is-incoming: %d video-stream direction: %d",
-      status, stream_state, is_incoming, video_stream->direction);
+      window->status, stream_state, is_incoming, video_stream->direction);
+
+  if (empathy_tp_call_has_dtmf (window->call))
+    {
+      gtk_widget_show (window->keypad_expander);
+    }
+  else
+    {
+      gtk_widget_hide (window->keypad_expander);
+    }
 
   /* Depending on the status we have to set:
    * - window's title
    * - status's label
    * - sensibility of all buttons
    * */
-  if (status == EMPATHY_TP_CALL_STATUS_READYING)
+  if (window->status == EMPATHY_TP_CALL_STATUS_READYING)
     {
       gtk_window_set_title (GTK_WINDOW (window->window), _("Empathy Call"));
+      /* To translators: Readying is the first state of the call, it is
+       * preparing the connection and it does not yet ring. */
       gtk_label_set_text (GTK_LABEL (window->status_label), _("Readying"));
-      gtk_widget_set_sensitive (window->start_call_button, is_incoming);
-      gtk_widget_set_sensitive (window->end_call_button, FALSE);
       gtk_widget_set_sensitive (window->video_button, FALSE);
-      gtk_widget_set_sensitive (window->input_volume_scale, FALSE);
-      gtk_widget_set_sensitive (window->output_volume_scale, FALSE);
-      gtk_widget_set_sensitive (window->input_mute_button, FALSE);
-      gtk_widget_set_sensitive (window->output_mute_button, FALSE);
+      gtk_widget_set_sensitive (window->output_volume_button, FALSE);
+      gtk_widget_set_sensitive (window->input_volume_button, FALSE);
+      gtk_widget_set_sensitive (window->hang_up_button, FALSE);
+      gtk_widget_set_sensitive (window->keypad_expander, FALSE);
     }
-  else if (status == EMPATHY_TP_CALL_STATUS_PENDING)
+  else if (window->status == EMPATHY_TP_CALL_STATUS_PENDING)
     {
       title = g_strdup_printf (_("%s - Empathy Call"),
           empathy_contact_get_name (contact));
 
       gtk_window_set_title (GTK_WINDOW (window->window), title);
       gtk_label_set_text (GTK_LABEL (window->status_label), _("Ringing"));
-      gtk_widget_set_sensitive (window->start_call_button, is_incoming);
-      gtk_widget_set_sensitive (window->end_call_button, TRUE);
+      gtk_widget_set_sensitive (window->hang_up_button, TRUE);
+      if (is_incoming)
+          call_window_show_confirmation_dialog (window);
     }
-  else if (status == EMPATHY_TP_CALL_STATUS_ACCEPTED)
+  else if (window->status == EMPATHY_TP_CALL_STATUS_ACCEPTED)
     {
       gboolean receiving_video;
       gboolean sending_video;
 
       if (stream_state == TP_MEDIA_STREAM_STATE_DISCONNECTED)
-          gtk_label_set_text (GTK_LABEL (window->status_label), "Disconnected");
+          gtk_label_set_text (GTK_LABEL (window->status_label), _("Disconnected"));
       if (stream_state == TP_MEDIA_STREAM_STATE_CONNECTING)
-          gtk_label_set_text (GTK_LABEL (window->status_label), "Connecting");
+          gtk_label_set_text (GTK_LABEL (window->status_label), _("Connecting"));
       else if (stream_state == TP_MEDIA_STREAM_STATE_CONNECTED &&
                window->timeout_event_id == 0)
         {
@@ -371,55 +427,131 @@ call_window_update (EmpathyCallWindow *window)
           call_window_video_button_toggled_cb, window);
 
       gtk_widget_set_sensitive (window->video_button, TRUE);
-      gtk_widget_set_sensitive (window->input_volume_scale, TRUE);
-      gtk_widget_set_sensitive (window->output_volume_scale, TRUE);
-      gtk_widget_set_sensitive (window->input_mute_button, TRUE);
-      gtk_widget_set_sensitive (window->output_mute_button, TRUE);
+      gtk_widget_set_sensitive (window->output_volume_button, TRUE);
+      gtk_widget_set_sensitive (window->input_volume_button, TRUE);
+      gtk_widget_set_sensitive (window->hang_up_button, TRUE);
+      gtk_widget_set_sensitive (window->keypad_expander, TRUE);
     }
-  else if (status == EMPATHY_TP_CALL_STATUS_CLOSED)
-    {
-      gtk_label_set_text (GTK_LABEL (window->status_label), "Closed");
-      gtk_widget_set_sensitive (window->start_call_button, FALSE);
-      gtk_widget_set_sensitive (window->end_call_button, FALSE);
-      gtk_widget_set_sensitive (window->video_button, FALSE);
-      gtk_widget_set_sensitive (window->input_volume_scale, FALSE);
-      gtk_widget_set_sensitive (window->output_volume_scale, FALSE);
-      gtk_widget_set_sensitive (window->input_mute_button, FALSE);
-      gtk_widget_set_sensitive (window->output_mute_button, FALSE);
-
+  else if (window->status == EMPATHY_TP_CALL_STATUS_CLOSED)
       call_window_finalize (window);
-    }
+
   if (contact)
       g_object_unref (contact);
 }
 
+static gboolean
+call_window_dtmf_button_release_event_cb (GtkWidget *widget,
+                                          GdkEventButton *event,
+                                          EmpathyCallWindow *window)
+{
+  empathy_tp_call_stop_tone (window->call);
+  return FALSE;
+}
+
+static gboolean
+call_window_dtmf_button_press_event_cb (GtkWidget *widget,
+                                        GdkEventButton *event,
+                                        EmpathyCallWindow *window)
+{
+  TpDTMFEvent dtmf_event;
+
+  dtmf_event = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (widget), "code"));
+  empathy_tp_call_start_tone (window->call, dtmf_event);
+  return FALSE;
+}
+
+static void
+call_window_dtmf_connect (GladeXML *glade,
+                          EmpathyCallWindow *window,
+                          const gchar *name,
+                          TpDTMFEvent event)
+{
+  GtkWidget *widget;
+
+  widget = glade_xml_get_widget (glade, name);
+  g_object_set_data (G_OBJECT (widget), "code", GUINT_TO_POINTER (event));
+  g_signal_connect (widget, "button-press-event",
+      G_CALLBACK (call_window_dtmf_button_press_event_cb), window);
+  g_signal_connect (widget, "button-release-event",
+      G_CALLBACK (call_window_dtmf_button_release_event_cb), window);
+  /* FIXME: Connect "key-[press/release]-event" to*/
+}
+
 GtkWidget *
-empathy_call_window_new (EmpathyTpCall *call)
+empathy_call_window_new (TpChannel *channel)
 {
   EmpathyCallWindow *window;
   GladeXML *glade;
   gchar *filename;
+  const gchar *icons[] = {"audio-input-microphone", NULL};
 
-  g_return_val_if_fail (EMPATHY_IS_TP_CALL (call), NULL);
+  g_return_val_if_fail (TP_IS_CHANNEL (channel), NULL);
+
+  if (windows)
+    {
+      window = (EmpathyCallWindow*) windows->data;
+      if (!window->call)
+        {
+          window->call = empathy_tp_call_new (channel);
+          g_signal_connect_swapped (G_OBJECT (window->call), "notify",
+              G_CALLBACK (call_window_update), window);
+          call_window_update (window);
+
+          if (GTK_WIDGET_REALIZED (GTK_WIDGET (window->preview_video_socket)))
+            {
+              call_window_socket_realized_cb (window->preview_video_socket,
+                  window);
+            }
+        }
+      else
+        {
+          GtkWidget *dialog;
+          EmpathyContact *contact;
+          EmpathyTpGroup *tp_group;
+
+          tp_group = empathy_tp_group_new (channel);
+          empathy_run_until_ready (tp_group);
+          empathy_tp_group_get_invitation (tp_group, &contact);
+          empathy_contact_run_until_ready (contact, EMPATHY_CONTACT_READY_NAME,
+              NULL);
+
+          /* We don't want to have multiple calls running.
+           * FIXME: We should use the hold interface... */
+          tp_cli_channel_call_close (channel, -1, NULL, NULL, NULL, NULL);
+
+          dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_INFO,
+              GTK_BUTTONS_CLOSE,
+              _("Incoming call from %s rejected because there is already a"
+                " running call."), empathy_contact_get_name (contact));
+
+          g_object_unref (contact);
+          g_object_unref (tp_group);
+
+          g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy),
+              NULL);
+          gtk_widget_show (dialog);
+        }
+
+      gtk_window_present (GTK_WINDOW (window->window));
+      return window->window;
+    }
 
   window = g_slice_new0 (EmpathyCallWindow);
-  window->call = g_object_ref (call);
+  windows = g_slist_prepend (windows, window);
+  window->call = empathy_tp_call_new (channel);
 
   filename = empathy_file_lookup ("empathy-call-window.glade", "src");
   glade = empathy_glade_get_file (filename,
       "window",
       NULL,
       "window", &window->window,
+      "main_hbox", &window->main_hbox,
+      "controls_vbox", &window->controls_vbox,
+      "volume_hbox", &window->volume_hbox,
       "status_label", &window->status_label,
-      "start_call_button", &window->start_call_button,
-      "end_call_button", &window->end_call_button,
-      "input_volume_scale", &window->input_volume_scale,
-      "output_volume_scale", &window->output_volume_scale,
-      "input_mute_button", &window->input_mute_button,
-      "output_mute_button", &window->output_mute_button,
-      "preview_video_frame", &window->preview_video_frame,
-      "output_video_frame", &window->output_video_frame,
       "video_button", &window->video_button,
+      "hang_up_button", &window->hang_up_button,
+      "keypad_expander", &window->keypad_expander,
       NULL);
   g_free (filename);
 
@@ -427,36 +559,66 @@ empathy_call_window_new (EmpathyTpCall *call)
       window,
       "window", "destroy", call_window_destroy_cb,
       "window", "delete_event", call_window_delete_event_cb,
-      "input_mute_button", "toggled", call_window_input_mute_button_toggled_cb,
-      "output_mute_button", "toggled", call_window_output_mute_button_toggled_cb,
-      "output_volume_scale", "value-changed", call_window_output_volume_changed_cb,
-      "start_call_button", "clicked", call_window_start_call_button_clicked_cb,
-      "end_call_button", "clicked", call_window_end_call_button_clicked_cb,
+      "hang_up_button", "clicked", call_window_hang_up_button_clicked_cb,
       "video_button", "toggled", call_window_video_button_toggled_cb,
       NULL);
 
+  /* Setup DTMF buttons */
+  call_window_dtmf_connect (glade, window, "button_0", TP_DTMF_EVENT_DIGIT_0);
+  call_window_dtmf_connect (glade, window, "button_1", TP_DTMF_EVENT_DIGIT_1);
+  call_window_dtmf_connect (glade, window, "button_2", TP_DTMF_EVENT_DIGIT_2);
+  call_window_dtmf_connect (glade, window, "button_3", TP_DTMF_EVENT_DIGIT_3);
+  call_window_dtmf_connect (glade, window, "button_4", TP_DTMF_EVENT_DIGIT_4);
+  call_window_dtmf_connect (glade, window, "button_5", TP_DTMF_EVENT_DIGIT_5);
+  call_window_dtmf_connect (glade, window, "button_6", TP_DTMF_EVENT_DIGIT_6);
+  call_window_dtmf_connect (glade, window, "button_7", TP_DTMF_EVENT_DIGIT_7);
+  call_window_dtmf_connect (glade, window, "button_8", TP_DTMF_EVENT_DIGIT_8);
+  call_window_dtmf_connect (glade, window, "button_9", TP_DTMF_EVENT_DIGIT_9);
+  call_window_dtmf_connect (glade, window, "button_asterisk", TP_DTMF_EVENT_ASTERISK);
+  call_window_dtmf_connect (glade, window, "button_hash", TP_DTMF_EVENT_HASH);
+
   g_object_unref (glade);
 
-  /* Output video label */
-  window->output_video_label = g_object_ref (gtk_label_new ("No video output"));
-  gtk_container_add (GTK_CONTAINER (window->output_video_frame),
-      window->output_video_label);
-  gtk_widget_show (window->output_video_label);
+  /* Output volume button */
+  window->output_volume_button = gtk_volume_button_new ();
+  gtk_scale_button_set_value (GTK_SCALE_BUTTON (window->output_volume_button), 1);
+  gtk_box_pack_start (GTK_BOX (window->volume_hbox),
+      window->output_volume_button, FALSE, FALSE, 0);
+  gtk_widget_show (window->output_volume_button);
+  g_signal_connect (window->output_volume_button, "value-changed",
+      G_CALLBACK (call_window_output_volume_changed_cb), window);
+
+  /* Input volume button */
+  window->input_volume_button = gtk_volume_button_new ();
+  gtk_scale_button_set_icons (GTK_SCALE_BUTTON (window->input_volume_button),
+      icons);
+  gtk_scale_button_set_value (GTK_SCALE_BUTTON (window->input_volume_button), 1);
+  gtk_box_pack_start (GTK_BOX (window->volume_hbox),
+      window->input_volume_button, FALSE, FALSE, 0);
+  gtk_widget_show (window->input_volume_button);
+  g_signal_connect (window->input_volume_button, "value-changed",
+      G_CALLBACK (call_window_input_volume_changed_cb), window);
 
   /* Output video socket */
   window->output_video_socket = g_object_ref (gtk_socket_new ());
+  gtk_widget_set_size_request (window->output_video_socket, 400, 300);
   g_signal_connect (GTK_OBJECT (window->output_video_socket), "realize",
       G_CALLBACK (call_window_socket_realized_cb), window);
   gtk_widget_show (window->output_video_socket);
 
   /* Preview video socket */
   window->preview_video_socket = g_object_ref (gtk_socket_new ());
+  gtk_widget_set_size_request (window->preview_video_socket, 176, 144);
   g_signal_connect (GTK_OBJECT (window->preview_video_socket), "realize",
       G_CALLBACK (call_window_socket_realized_cb), window);
-  gtk_container_add (GTK_CONTAINER (window->preview_video_frame),
-      window->preview_video_socket);
   gtk_widget_show (window->preview_video_socket);
 
+  /* FIXME: We shouldn't do this if there is no video input */
+  gtk_box_pack_start (GTK_BOX (window->controls_vbox),
+      window->preview_video_socket, FALSE, FALSE, 0);
+  gtk_box_reorder_child (GTK_BOX (window->controls_vbox),
+      window->preview_video_socket, 0);
+
   g_signal_connect_swapped (G_OBJECT (window->call), "notify",
       G_CALLBACK (call_window_update),
       window);