1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
/*
* Copyright (C) 2007 Elliot Fairweather
*
* 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>
*/
#include <config.h>
#include <stdlib.h>
#include <glib.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <libgnomevfs/gnome-vfs.h>
#include <libmissioncontrol/mission-control.h>
#include <libempathy/empathy-chandler.h>
#include <libempathy/empathy-utils.h>
#include <libempathy/empathy-tp-call.h>
#include <libempathy/empathy-debug.h>
#include <libempathy-gtk/empathy-call-window.h>
#define DEBUG_DOMAIN "EmpathyCall"
#define BUS_NAME "org.gnome.Empathy.CallChandler"
#define OBJECT_PATH "/org/gnome/Empathy/CallChandler"
static guint nb_calls = 0;
static void
call_chandler_weak_notify (gpointer data,
GObject *where_the_object_was)
{
nb_calls--;
if (nb_calls == 0) {
empathy_debug (DEBUG_DOMAIN, "No more calls, leaving...");
gtk_main_quit ();
}
}
static void
call_chandler_new_channel_cb (EmpathyChandler *chandler,
TpConn *tp_conn,
TpChan *tp_chan,
MissionControl *mc)
{
EmpathyTpCall *call;
McAccount *account;
GtkWidget *window;
account = mission_control_get_account_for_connection (mc, tp_conn, NULL);
call = empathy_tp_call_new (account, tp_chan);
window = empathy_call_window_show (call);
g_object_unref (account);
g_object_unref (call);
nb_calls++;
g_object_weak_ref (G_OBJECT (window), call_chandler_weak_notify, NULL);
}
int
main (int argc, char *argv[])
{
EmpathyChandler *chandler;
MissionControl *mc;
empathy_debug_set_log_file_from_env ();
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
gtk_init (&argc, &argv);
gtk_window_set_default_icon_name ("empathy");
gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
PKGDATADIR G_DIR_SEPARATOR_S "icons");
mc = empathy_mission_control_new ();
chandler = empathy_chandler_new (BUS_NAME, OBJECT_PATH);
g_signal_connect (chandler, "new-channel",
G_CALLBACK (call_chandler_new_channel_cb),
mc);
empathy_debug (DEBUG_DOMAIN, "Ready to handle new streamed media channels");
gtk_main ();
g_object_unref (chandler);
g_object_unref (mc);
return EXIT_SUCCESS;
}
|