]> git.0d.be Git - empathy.git/blobdiff - src/empathy-call-window.c
GNOME Goal: Update icon names
[empathy.git] / src / empathy-call-window.c
index 95b01d3d1730c202a433f7b9ab530ffb6f6909e6..eb39855babb9632c1257b1a78a441b33f76c7ead 100644 (file)
  */
 
 #include "config.h"
+#include "empathy-call-window.h"
 
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <math.h>
-
-#include <gdk/gdkkeysyms.h>
-#include <gst/gst.h>
-#include <gtk/gtk.h>
 #include <glib/gi18n.h>
-
-#include <clutter/clutter.h>
-#include <clutter-gtk/clutter-gtk.h>
-#include <clutter-gst/clutter-gst.h>
-
 #include <telepathy-farstream/telepathy-farstream.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-request-util.h>
-#include <libempathy/empathy-utils.h>
-
-#include <libempathy-gtk/empathy-avatar-image.h>
-#include <libempathy-gtk/empathy-dialpad-widget.h>
-#include <libempathy-gtk/empathy-ui-utils.h>
-#include <libempathy-gtk/empathy-sound-manager.h>
-#include <libempathy-gtk/empathy-geometry.h>
-#include <libempathy-gtk/empathy-images.h>
-#include <libempathy-gtk/empathy-call-utils.h>
-
-#define DEBUG_FLAG EMPATHY_DEBUG_VOIP
-#include <libempathy/empathy-debug.h>
-
-#include "empathy-call-window.h"
-#include "empathy-call-window-fullscreen.h"
-#include "empathy-call-factory.h"
 #include "empathy-about-dialog.h"
-#include "empathy-audio-src.h"
 #include "empathy-audio-sink.h"
-#include "empathy-video-src.h"
+#include "empathy-call-utils.h"
+#include "empathy-call-window-fullscreen.h"
+#include "empathy-camera-menu.h"
+#include "empathy-camera-monitor.h"
+#include "empathy-dialpad-widget.h"
+#include "empathy-geometry.h"
+#include "empathy-gsettings.h"
+#include "empathy-images.h"
 #include "empathy-mic-menu.h"
 #include "empathy-preferences.h"
+#include "empathy-request-util.h"
 #include "empathy-rounded-actor.h"
 #include "empathy-rounded-rectangle.h"
 #include "empathy-rounded-texture.h"
-#include "empathy-camera-menu.h"
+#include "empathy-sound-manager.h"
+#include "empathy-ui-utils.h"
+#include "empathy-utils.h"
+
+#define DEBUG_FLAG EMPATHY_DEBUG_VOIP
+#include "empathy-debug.h"
 
 #define CONTENT_HBOX_SPACING 3
 #define CONTENT_HBOX_CHILDREN_PACKING_PADDING 0
 /* The roundedness of preview box and placeholders */
 #define PREVIEW_ROUND_FACTOR 16
 
+#define PREVIEW_BUTTON_OPACITY 180
+
 G_DEFINE_TYPE(EmpathyCallWindow, empathy_call_window, GTK_TYPE_WINDOW)
 
 enum {
   PROP_CALL_HANDLER = 1,
 };
 
+enum {
+  SIG_INHIBIT,
+  LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL];
+
 typedef enum {
   RINGING,       /* Incoming call */
   CONNECTING,    /* Outgoing call */
@@ -626,7 +614,8 @@ empathy_call_window_camera_removed_cb (EmpathyCameraMonitor *monitor,
 }
 
 static void
-empathy_call_window_preview_button_clicked_cb (GtkButton *button,
+empathy_call_window_preview_button_clicked_cb (ClutterClickAction *action,
+    ClutterActor *actor,
     EmpathyCallWindow *self)
 {
   GtkWidget *menu;
@@ -639,7 +628,9 @@ empathy_call_window_preview_button_clicked_cb (GtkButton *button,
 }
 
 static void
-empathy_call_window_preview_hidden_button_clicked_cb (GtkButton *button,
+empathy_call_window_preview_hidden_button_clicked_cb (
+    ClutterClickAction *action,
+    ClutterActor *actor,
     EmpathyCallWindow *self)
 {
   GtkWidget *menu;
@@ -1067,7 +1058,6 @@ create_video_preview (EmpathyCallWindow *self)
   ClutterActor *preview;
   ClutterActor *b;
   ClutterAction *action;
-  GtkWidget *button;
   PreviewPosition pos;
 
   g_assert (priv->video_preview == NULL);
@@ -1119,27 +1109,27 @@ create_video_preview (EmpathyCallWindow *self)
       "async", FALSE,
       NULL);
 
-  /* Translators: this is an "Info" label. It should be as short
-   * as possible. */
-  button = gtk_button_new_with_label (_("i"));
-  priv->preview_shown_button = b = gtk_clutter_actor_new_with_contents (button);
-  clutter_actor_set_size (b, 24, 24);
+  /* Preview show */
+  priv->preview_shown_button = b = gtk_clutter_actor_new_with_contents (
+      gtk_image_new_from_icon_name ("emblem-system-symbolic",
+        GTK_ICON_SIZE_MENU));
   clutter_actor_set_margin_right (b, 4);
   clutter_actor_set_margin_bottom (b, 2);
+  clutter_actor_set_opacity (b, PREVIEW_BUTTON_OPACITY);
   make_background_transparent (GTK_CLUTTER_ACTOR (b));
 
   clutter_bin_layout_add (CLUTTER_BIN_LAYOUT (layout), b,
       CLUTTER_BIN_ALIGNMENT_END, CLUTTER_BIN_ALIGNMENT_END);
 
-  g_signal_connect (button, "clicked",
-      G_CALLBACK (empathy_call_window_preview_button_clicked_cb),
-      self);
+  action = clutter_click_action_new ();
+  clutter_actor_add_action (b, action);
+  g_signal_connect (action, "clicked",
+      G_CALLBACK (empathy_call_window_preview_button_clicked_cb), self);
 
-  /* Translators: this is an "Info" label. It should be as short
-   * as possible. */
-  button = gtk_button_new_with_label (_("i"));
-  priv->preview_hidden_button = b = gtk_clutter_actor_new_with_contents (button);
-  clutter_actor_set_size (b, 24, 24);
+  /* Preview hidden */
+  priv->preview_hidden_button = b = gtk_clutter_actor_new_with_contents (
+      gtk_image_new_from_icon_name ("emblem-system-symbolic",
+        GTK_ICON_SIZE_MENU));
   make_background_transparent (GTK_CLUTTER_ACTOR (b));
 
   clutter_bin_layout_add (CLUTTER_BIN_LAYOUT (priv->preview_layout),
@@ -1151,9 +1141,10 @@ create_video_preview (EmpathyCallWindow *self)
 
   clutter_actor_hide (priv->preview_hidden_button);
 
-  g_signal_connect (button, "clicked",
-      G_CALLBACK (empathy_call_window_preview_hidden_button_clicked_cb),
-      self);
+  action = clutter_click_action_new ();
+  clutter_actor_add_action (b, action);
+  g_signal_connect (action, "clicked",
+      G_CALLBACK (empathy_call_window_preview_hidden_button_clicked_cb), self);
 
   clutter_bin_layout_add (CLUTTER_BIN_LAYOUT (priv->preview_layout),
       priv->video_preview,
@@ -1393,7 +1384,7 @@ empathy_call_window_debug_gst_cb (GtkAction *action,
   filename = g_strdup_printf ("%s-%" G_GINT64_FORMAT, prgname,
       g_date_time_to_unix (date_time));
 
-  gst_debug_bin_to_dot_file (GST_BIN (priv->pipeline),
+  GST_DEBUG_BIN_TO_DOT_FILE (GST_BIN (priv->pipeline),
       GST_DEBUG_GRAPH_SHOW_ALL, filename);
 
   dot_dir = g_getenv ("GST_DEBUG_DUMP_DOT_DIR");
@@ -1865,6 +1856,8 @@ empathy_call_window_init (EmpathyCallWindow *self)
 
   empathy_call_window_show_hangup_button (self, TRUE);
 
+  gtk_window_set_default_size (GTK_WINDOW (self), 580, 480);
+
   empathy_geometry_bind (GTK_WINDOW (self), "call-window");
   /* These signals are used to track the window position and save it
    * when the window is destroyed. We need to do this as we don't want
@@ -2355,6 +2348,13 @@ empathy_call_window_class_init (
     G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
   g_object_class_install_property (object_class,
     PROP_CALL_HANDLER, param_spec);
+
+  signals[SIG_INHIBIT] = g_signal_new ("inhibit",
+      G_OBJECT_CLASS_TYPE (empathy_call_window_class),
+      G_SIGNAL_RUN_LAST,
+      0, NULL, NULL, NULL,
+      G_TYPE_NONE,
+      1, G_TYPE_BOOLEAN);
 }
 
 void
@@ -2598,9 +2598,18 @@ empathy_call_window_disconnected (EmpathyCallWindow *self,
   /* Leave full screen mode if needed */
   gtk_window_unfullscreen (GTK_WINDOW (self));
 
+  g_signal_emit (self, signals[SIG_INHIBIT], 0, FALSE);
+
   gtk_action_set_sensitive (priv->menu_fullscreen, FALSE);
   gtk_widget_set_sensitive (priv->dtmf_panel, FALSE);
 
+  /* Create the video input and then turn on the camera
+   * menu, so that the active camera gets marked as such.
+   */
+  if (priv->video_input == NULL)
+    create_video_input (self);
+  empathy_camera_menu_set_sensitive (priv->camera_menu, TRUE);
+
   could_reset_pipeline = empathy_call_window_reset_pipeline (self);
 
   if (priv->call_state == CONNECTING)
@@ -2894,6 +2903,7 @@ empathy_call_window_get_audio_sink_pad (EmpathyCallWindow *self,
           g_warning ("Could not start audio sink");
           goto error;
         }
+      priv->audio_output_added = TRUE;
     }
 
   template = gst_element_class_get_pad_template (
@@ -3628,6 +3638,7 @@ empathy_call_window_remove_video_input (EmpathyCallWindow *self)
   priv->video_preview = NULL;
 
   gtk_widget_set_sensitive (priv->camera_button, FALSE);
+  empathy_camera_menu_set_sensitive (priv->camera_menu, FALSE);
 }
 
 static void
@@ -3635,6 +3646,8 @@ start_call (EmpathyCallWindow *self)
 {
   EmpathyCallWindowPriv *priv = GET_PRIV (self);
 
+  g_signal_emit (self, signals[SIG_INHIBIT], 0, TRUE);
+
   priv->call_started = TRUE;
   empathy_call_handler_start_call (priv->handler,
       gtk_get_current_event_time ());
@@ -4002,7 +4015,7 @@ empathy_call_window_state_event_cb (GtkWidget *widget,
       show_controls (window, set_fullscreen);
       show_borders (window, set_fullscreen);
       gtk_action_set_stock_id (priv->menu_fullscreen,
-          (set_fullscreen ? "gtk-leave-fullscreen" : "gtk-fullscreen"));
+          (set_fullscreen ? "view-restore" : "view-fullscreen"));
       priv->is_fullscreen = set_fullscreen;
   }