aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
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
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')
-rw-r--r--libempathy-gtk/Makefile.am3
-rw-r--r--libempathy-gtk/empathy-call-window.c198
-rw-r--r--libempathy-gtk/empathy-call-window.glade335
-rw-r--r--libempathy-gtk/empathy-call-window.h36
-rw-r--r--libempathy-gtk/empathy-chat-window.c4
-rw-r--r--libempathy-gtk/empathy-contact-list-view.c55
6 files changed, 574 insertions, 57 deletions
diff --git a/libempathy-gtk/Makefile.am b/libempathy-gtk/Makefile.am
index a825f4427..fa13e27cc 100644
--- a/libempathy-gtk/Makefile.am
+++ b/libempathy-gtk/Makefile.am
@@ -47,6 +47,7 @@ libempathy_gtk_la_SOURCES = \
empathy-new-chatroom-dialog.c \
empathy-chatrooms-window.c \
empathy-log-window.c \
+ empathy-call-window.c \
empathy-ui-utils.c
# do not distribute generated files
@@ -96,6 +97,7 @@ libempathy_gtk_headers = \
empathy-new-chatroom-dialog.h \
empathy-chatrooms-window.h \
empathy-log-window.h \
+ empathy-call-window.h \
empathy-ui-utils.h
libempathy_gtk_includedir = $(includedir)/libempathy-gtk/
@@ -120,6 +122,7 @@ glade_DATA = \
empathy-chatrooms-window.glade \
empathy-spell-dialog.glade \
empathy-log-window.glade \
+ empathy-call-window.glade \
empathy-chat.glade
empathy-gtk-enum-types.h: stamp-empathy-gtk-enum-types.h
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);
+}
+
diff --git a/libempathy-gtk/empathy-call-window.glade b/libempathy-gtk/empathy-call-window.glade
new file mode 100644
index 000000000..bc18952b6
--- /dev/null
+++ b/libempathy-gtk/empathy-call-window.glade
@@ -0,0 +1,335 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
+
+<glade-interface>
+
+<widget class="GtkWindow" id="window">
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="title" translatable="yes">Call</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="decorated">True</property>
+ <property name="skip_taskbar_hint">False</property>
+ <property name="skip_pager_hint">False</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
+ <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+ <property name="focus_on_map">True</property>
+ <property name="urgency_hint">False</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">10</property>
+
+ <child>
+ <widget class="GtkFrame" id="frame1">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <property name="label_yalign">0.5</property>
+ <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment1">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="xscale">1</property>
+ <property name="yscale">1</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">0</property>
+ <property name="right_padding">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox3">
+ <property name="visible">True</property>
+ <property name="homogeneous">True</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkVBox" id="vbox4">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Input</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">5</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVScale" id="input_volume_scale">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="draw_value">False</property>
+ <property name="value_pos">GTK_POS_TOP</property>
+ <property name="digits">1</property>
+ <property name="update_policy">GTK_UPDATE_CONTINUOUS</property>
+ <property name="inverted">True</property>
+ <property name="adjustment">100 0 100 1 0 0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkToggleButton" id="input_mute_togglebutton">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Mute</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ </widget>
+ <packing>
+ <property name="padding">5</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">5</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox5">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Output</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">5</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVScale" id="output_volume_scale">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="draw_value">False</property>
+ <property name="value_pos">GTK_POS_TOP</property>
+ <property name="digits">1</property>
+ <property name="update_policy">GTK_UPDATE_CONTINUOUS</property>
+ <property name="inverted">True</property>
+ <property name="adjustment">100 0 100 1 0 0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkToggleButton" id="output_mute_togglebutton">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Mute</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ </widget>
+ <packing>
+ <property name="padding">5</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">5</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Volume</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox2">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkAspectFrame" id="output_video_frame">
+ <property name="width_request">352</property>
+ <property name="height_request">288</property>
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <property name="label_yalign">0.5</property>
+ <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="ratio">1.22000002861</property>
+ <property name="obey_child">False</property>
+
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox3">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkAspectFrame" id="preview_video_frame">
+ <property name="width_request">176</property>
+ <property name="height_request">144</property>
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <property name="label_yalign">0.5</property>
+ <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="ratio">1.22000002861</property>
+ <property name="obey_child">False</property>
+
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="send_video_checkbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Send Video</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">True</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">10</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
+</glade-interface>
diff --git a/libempathy-gtk/empathy-call-window.h b/libempathy-gtk/empathy-call-window.h
new file mode 100644
index 000000000..ea310d622
--- /dev/null
+++ b/libempathy-gtk/empathy-call-window.h
@@ -0,0 +1,36 @@
+/* -*- 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>
+ */
+
+#ifndef __EMPATHY_CALL_WINDOW_H__
+#define __EMPATHY_CALL_WINDOW_H__
+
+#include <libempathy/empathy-tp-call.h>
+
+G_BEGIN_DECLS
+
+void empathy_call_window_show (EmpathyTpCall *call);
+
+G_END_DECLS
+
+#endif /* __EMPATHY_CALL_WINDOW_H__ */
+
diff --git a/libempathy-gtk/empathy-chat-window.c b/libempathy-gtk/empathy-chat-window.c
index 29fe5a521..41402f252 100644
--- a/libempathy-gtk/empathy-chat-window.c
+++ b/libempathy-gtk/empathy-chat-window.c
@@ -883,9 +883,7 @@ chat_window_call_activate_cb (GtkWidget *menuitem,
chat = EMPATHY_PRIVATE_CHAT (priv->current_chat);
contact = empathy_private_chat_get_contact (chat);
- /* FIXME: See contact_list_view_voip_activated() to know how to
- * call a contact. We need a function to call a contact and use
- * it here and in EmpathyContactListView. */
+ empathy_call_contact (contact);
}
}
diff --git a/libempathy-gtk/empathy-contact-list-view.c b/libempathy-gtk/empathy-contact-list-view.c
index c959eec01..1fcbf4440 100644
--- a/libempathy-gtk/empathy-contact-list-view.c
+++ b/libempathy-gtk/empathy-contact-list-view.c
@@ -1438,59 +1438,6 @@ static void
contact_list_view_voip_activated (EmpathyContactListView *view,
EmpathyContact *contact)
{
- MissionControl *mc;
- McAccount *account;
- TpConn *tp_conn;
- gchar *object_path;
- const gchar *bus_name;
- TpChan *new_chan;
- EmpathyTpGroup *group;
- GError *error;
-
- /* StreamedMedia channels must have handle=0 and handle_type=none.
- * To call a contact we have to add him in the group interface of the
- * channel. MissionControl will detect the channel creation and
- * dispatch it to the VoIP chandler automatically. */
-
- mc = empathy_mission_control_new ();
- account = empathy_contact_get_account (contact);
- tp_conn = mission_control_get_connection (mc, account, NULL);
- /* FIXME: Should be async */
- if (!tp_conn_request_channel (DBUS_G_PROXY (tp_conn),
- TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA,
- TP_HANDLE_TYPE_NONE,
- 0,
- FALSE,
- &object_path,
- &error)) {
- empathy_debug (DEBUG_DOMAIN,
- "Couldn't request channel: %s",
- error ? error->message : "No error given");
- g_clear_error (&error);
- g_object_unref (mc);
- g_object_unref (tp_conn);
- return;
- }
-
- bus_name = dbus_g_proxy_get_bus_name (DBUS_G_PROXY (tp_conn));
- new_chan = tp_chan_new (tp_get_bus (),
- bus_name,
- object_path,
- TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA,
- TP_HANDLE_TYPE_NONE,
- 0);
-
- /* FIXME: group is leaked, we can't unref it directly because
- * _add_member is async so we have to wait for it to return before
- * finalizing the group. I think EmpathyTpGroup should ref itself
- * when it does async calls to avoid finalizing when there is calls
- * in fligth like that we could unref it here. */
- group = empathy_tp_group_new (account, new_chan);
- empathy_tp_group_add_member (group, contact, "");
-
- g_object_unref (mc);
- g_object_unref (tp_conn);
- g_object_unref (new_chan);
- g_free (object_path);
+ empathy_call_contact (contact);
}