aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-call-window.c
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@gmail.com>2007-09-29 20:08:45 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2007-09-29 20:08:45 +0800
commite3e5702a683c468ccc1742515b4033f32c7d1083 (patch)
tree9036ec7c855079e59ec6b67128ee37134bb79abf /libempathy-gtk/empathy-call-window.c
parentf5490a416f103d552344f7df0238a39c1e76b537 (diff)
downloadgsoc2013-empathy-e3e5702a683c468ccc1742515b4033f32c7d1083.tar
gsoc2013-empathy-e3e5702a683c468ccc1742515b4033f32c7d1083.tar.gz
gsoc2013-empathy-e3e5702a683c468ccc1742515b4033f32c7d1083.tar.bz2
gsoc2013-empathy-e3e5702a683c468ccc1742515b4033f32c7d1083.tar.lz
gsoc2013-empathy-e3e5702a683c468ccc1742515b4033f32c7d1083.tar.xz
gsoc2013-empathy-e3e5702a683c468ccc1742515b4033f32c7d1083.tar.zst
gsoc2013-empathy-e3e5702a683c468ccc1742515b4033f32c7d1083.zip
Initial Voice+Video support Fixes bug #468204 (Elliot Fairweather, Xavier
2007-09-29 Xavier Claessens <xclaesse@gmail.com> * libempathy-gtk/empathy-call-window.c: * libempathy-gtk/empathy-call-window.h: * libempathy-gtk/empathy-contact-list-view.c: * libempathy-gtk/empathy-call-window.glade: * libempathy-gtk/Makefile.am: * libempathy-gtk/empathy-chat-window.c: * src/empathy-call-chandler.c: * src/empathy-call.chandler: * src/org.gnome.Empathy.Call.service.in: * src/Makefile.am: * libempathy/empathy-utils.c: * libempathy/empathy-utils.h: * libempathy/empathy-tp-call.c: * libempathy/empathy-tp-call.h: * libempathy/Makefile.am: * libempathy/tp-stream-engine.xml: * configure.ac: * doc/libempathy-gtk/libempathy-gtk-docs.sgml: * doc/libempathy/libempathy.types: * doc/libempathy/libempathy-docs.sgml: * doc/libempathy/Makefile.am: * doc/libempathy/tmpl/empathy-utils.sgml: Initial Voice+Video support Fixes bug #468204 (Elliot Fairweather, Xavier Claessens). svn path=/trunk/; revision=339
Diffstat (limited to 'libempathy-gtk/empathy-call-window.c')
-rw-r--r--libempathy-gtk/empathy-call-window.c198
1 files changed, 198 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-call-window.c b/libempathy-gtk/empathy-call-window.c
new file mode 100644
index 000000000..baa169755
--- /dev/null
+++ b/libempathy-gtk/empathy-call-window.c
@@ -0,0 +1,198 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2007 Elliot Fairweather
+ * Copyright (C) 2007 Collabora Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Authors: Elliot Fairweather <elliot.fairweather@collabora.co.uk>
+ * Xavier Claessens <xclaesse@gmail.com>
+ */
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+
+#include <libempathy/empathy-debug.h>
+
+#include "empathy-call-window.h"
+#include "empathy-ui-utils.h"
+
+#define DEBUG_DOMAIN "CallWindow"
+
+typedef struct {
+ GtkWidget *window;
+ GtkWidget *input_volume_scale;
+ GtkWidget *output_volume_scale;
+ GtkWidget *input_mute_togglebutton;
+ GtkWidget *output_mute_togglebutton;
+ GtkWidget *preview_video_frame;
+ GtkWidget *output_video_frame;
+ GtkWidget *preview_video_socket;
+ GtkWidget *output_video_socket;
+ GtkWidget *send_video_checkbutton;
+
+ EmpathyTpCall *call;
+} EmpathyCallWindow;
+
+static void
+call_window_output_volume_changed_cb (GtkWidget *scale,
+ EmpathyCallWindow *window)
+{
+ guint volume;
+
+ volume = (guint) gtk_range_get_value (GTK_RANGE (scale));
+ empathy_tp_call_set_output_volume (window->call, volume);
+}
+
+
+static void
+call_window_output_mute_toggled_cb (GtkWidget *button,
+ EmpathyCallWindow *window)
+{
+ gboolean is_muted;
+
+ is_muted = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
+ empathy_tp_call_mute_output (window->call, is_muted);
+}
+
+
+static void
+call_window_input_mute_toggled_cb (GtkWidget *button,
+ EmpathyCallWindow *window)
+{
+ gboolean is_muted;
+
+ is_muted = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
+ empathy_tp_call_mute_input (window->call, is_muted);
+}
+
+
+static void
+call_window_send_video_toggled_cb (GtkWidget *button,
+ EmpathyCallWindow *window)
+{
+ gboolean is_sending;
+
+ is_sending = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
+ empathy_tp_call_send_video (window->call, is_sending);
+}
+
+static void
+call_window_capabilities_notify_cb (EmpathyContact *contact,
+ GParamSpec *param,
+ EmpathyCallWindow *window)
+{
+ EmpathyCapabilities capabilities;
+
+ capabilities = empathy_contact_get_capabilities (contact);
+ empathy_tp_call_request_streams (window->call,
+ capabilities & EMPATHY_CAPABILITIES_AUDIO,
+ capabilities & EMPATHY_CAPABILITIES_VIDEO);
+}
+
+static void
+call_window_status_notify_cb (EmpathyTpCall *call,
+ GParamSpec *param,
+ EmpathyCallWindow *window)
+{
+ guint status;
+
+ status = empathy_tp_call_get_status (call);
+ empathy_debug (DEBUG_DOMAIN, "Status changed to %d",
+ status);
+
+ if (status == EMPATHY_TP_CALL_STATUS_RINGING) {
+ if (empathy_tp_call_is_incoming (window->call)) {
+ empathy_tp_call_accept (window->call);
+ } else {
+ EmpathyContact *contact;
+
+ contact = empathy_tp_call_get_contact (call);
+ g_signal_connect (contact, "notify::capabilities",
+ G_CALLBACK (call_window_capabilities_notify_cb),
+ window);
+ call_window_capabilities_notify_cb (contact, NULL, window);
+ }
+ }
+
+ if (status == EMPATHY_TP_CALL_STATUS_RUNNING) {
+ empathy_tp_call_set_output_window (window->call,
+ gtk_socket_get_id (GTK_SOCKET (window->output_video_socket)));
+ }
+}
+
+static void
+call_window_destroy_cb (GtkWidget *widget,
+ EmpathyCallWindow *window)
+{
+ g_object_unref (window->call);
+ g_slice_free (EmpathyCallWindow, window);
+}
+
+void
+empathy_call_window_show (EmpathyTpCall *call)
+{
+ EmpathyCallWindow *window;
+ GladeXML *glade;
+
+ window = g_slice_new0 (EmpathyCallWindow);
+
+ glade = empathy_glade_get_file ("empathy-call-window.glade",
+ "window",
+ NULL,
+ "window", &window->window,
+ "input_volume_scale", &window->input_volume_scale,
+ "output_volume_scale", &window->output_volume_scale,
+ "input_mute_togglebutton", &window->input_mute_togglebutton,
+ "output_mute_togglebutton", &window->output_mute_togglebutton,
+ "preview_video_frame", &window->preview_video_frame,
+ "output_video_frame", &window->output_video_frame,
+ "send_video_checkbutton", &window->send_video_checkbutton,
+ NULL);
+
+ empathy_glade_connect (glade,
+ window,
+ "window", "destroy", call_window_destroy_cb,
+ "input_mute_togglebutton", "toggled", call_window_input_mute_toggled_cb,
+ "output_mute_togglebutton", "toggled", call_window_output_mute_toggled_cb,
+ "output_volume_scale", "value-changed", call_window_output_volume_changed_cb,
+ "send_video_checkbutton", "toggled", call_window_send_video_toggled_cb,
+ NULL);
+ g_object_unref (glade);
+
+ /* Set output window socket */
+ window->output_video_socket = gtk_socket_new ();
+ gtk_widget_show (window->output_video_socket);
+ gtk_container_add (GTK_CONTAINER (window->output_video_frame),
+ window->output_video_socket);
+
+ /* Set preview window socket */
+ window->preview_video_socket = gtk_socket_new ();
+ gtk_widget_show (window->preview_video_socket);
+ gtk_container_add (GTK_CONTAINER (window->preview_video_frame),
+ window->preview_video_socket);
+
+ /* Setup TpCall */
+ window->call = g_object_ref (call);
+ empathy_tp_call_add_preview_window (window->call,
+ gtk_socket_get_id (GTK_SOCKET (window->preview_video_socket)));
+ g_signal_connect (window->call, "notify::status",
+ G_CALLBACK (call_window_status_notify_cb),
+ window);
+
+ gtk_widget_show (window->window);
+}
+