2
* Copyright (C) 2007-2011 Collabora Ltd.
4
* This program is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU General Public License as
6
* published by the Free Software Foundation; either version 2 of the
7
* License, or (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* General Public License for more details.
14
* You should have received a copy of the GNU General Public
15
* License along with this program; if not, write to the
16
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17
* Boston, MA 02110-1301 USA
19
* Authors: Xavier Claessens <xclaesse@gmail.com>
20
* Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
26
#include <glib/gi18n.h>
29
#include <telepathy-glib/debug-sender.h>
31
#include <telepathy-yell/telepathy-yell.h>
33
#include <libempathy-gtk/empathy-ui-utils.h>
35
#include "empathy-call-window.h"
36
#include "empathy-call-factory.h"
38
#define DEBUG_FLAG EMPATHY_DEBUG_VOIP
39
#include <libempathy/empathy-debug.h>
43
/* Exit after $TIMEOUT seconds if not displaying any call window */
46
static guint nb_windows = 0;
47
static guint timeout_id = 0;
48
static gboolean use_timer = TRUE;
51
timeout_cb (gpointer data)
53
DEBUG ("Timing out; exiting");
68
DEBUG ("Start timer");
70
timeout_id = g_timeout_add_seconds (TIMEOUT, timeout_cb, NULL);
81
g_source_remove (timeout_id);
86
call_window_destroy_cb (EmpathyCallWindow *window,
98
new_call_handler_cb (EmpathyCallFactory *factory,
99
EmpathyCallHandler *handler,
103
EmpathyCallWindow *window;
105
DEBUG ("Create a new call window");
107
window = empathy_call_window_new (handler);
112
g_signal_connect (window, "destroy",
113
G_CALLBACK (call_window_destroy_cb), NULL);
115
gtk_widget_show (GTK_WIDGET (window));
122
GOptionContext *optcontext;
123
GOptionEntry options[] = {
127
TpDebugSender *debug_sender;
129
EmpathyCallFactory *call_factory;
130
GError *error = NULL;
133
g_thread_init (NULL);
135
optcontext = g_option_context_new (N_("- Empathy Audio/Video Client"));
136
g_option_context_add_group (optcontext, gst_init_get_option_group ());
137
g_option_context_add_group (optcontext, gtk_get_option_group (TRUE));
138
g_option_context_add_main_entries (optcontext, options, GETTEXT_PACKAGE);
140
if (!g_option_context_parse (optcontext, &argc, &argv, &error)) {
141
g_print ("%s\nRun '%s --help' to see a full list of available command "
143
error->message, argv[0]);
144
g_warning ("Error in empathy-call init: %s", error->message);
148
g_option_context_free (optcontext);
153
g_set_application_name (_("Empathy Audio/Video Client"));
154
g_setenv ("PULSE_PROP_media.role", "phone", TRUE);
156
gtk_window_set_default_icon_name ("empathy");
157
textdomain (GETTEXT_PACKAGE);
160
/* Set up debug sender */
161
debug_sender = tp_debug_sender_dup ();
162
g_log_set_default_handler (tp_debug_sender_log_handler, G_LOG_DOMAIN);
165
call_factory = empathy_call_factory_initialise ();
167
g_signal_connect (G_OBJECT (call_factory), "new-call-handler",
168
G_CALLBACK (new_call_handler_cb), NULL);
170
if (!empathy_call_factory_register (call_factory, &error))
172
g_critical ("Failed to register Handler: %s", error->message);
173
g_error_free (error);
177
if (g_getenv ("EMPATHY_PERSIST") != NULL)
179
DEBUG ("Disable timer");
188
g_object_unref (call_factory);
191
g_object_unref (debug_sender);