]> git.0d.be Git - empathy.git/blob - src/empathy-call-chandler.c
merge git work
[empathy.git] / src / empathy-call-chandler.c
1 /*
2  *  Copyright (C) 2007 Elliot Fairweather
3  *
4  *  This library is free software; you can redistribute it and/or
5  *  modify it under the terms of the GNU Lesser General Public
6  *  License as published by the Free Software Foundation; either
7  *  version 2.1 of the License, or (at your option) any later version.
8  *
9  *  This library 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  *  Lesser General Public License for more details.
13  *
14  *  You should have received a copy of the GNU Lesser General Public
15  *  License along with this library; if not, write to the Free Software
16  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17  *
18  *  Authors: Elliot Fairweather <elliot.fairweather@collabora.co.uk>
19  */
20
21 #include <config.h>
22
23 #include <stdlib.h>
24
25 #include <glib.h>
26 #include <glib/gi18n.h>
27 #include <gtk/gtk.h>
28
29 #include <libgnomevfs/gnome-vfs.h>
30
31 #include <libmissioncontrol/mission-control.h>
32
33 #include <libempathy/empathy-chandler.h>
34 #include <libempathy/empathy-utils.h>
35 #include <libempathy/empathy-tp-call.h>
36 #include <libempathy/empathy-debug.h>
37
38 #include <libempathy-gtk/empathy-call-window.h>
39
40 #define DEBUG_DOMAIN "EmpathyCall"
41
42 #define BUS_NAME "org.gnome.Empathy.CallChandler"
43 #define OBJECT_PATH "/org/gnome/Empathy/CallChandler"
44
45 static void
46 call_chandler_new_channel_cb (EmpathyChandler *chandler,
47                               TpConn          *tp_conn,
48                               TpChan          *tp_chan,
49                               MissionControl  *mc)
50 {
51         EmpathyTpCall *call;
52         McAccount     *account;
53
54         account = mission_control_get_account_for_connection (mc, tp_conn, NULL);
55
56         call = empathy_tp_call_new (account, tp_chan);
57         empathy_call_window_show (call);
58         g_object_unref (account);
59         g_object_unref (call);
60 }
61
62 int
63 main (int argc, char *argv[])
64 {
65         EmpathyChandler *chandler;
66         MissionControl  *mc;
67
68         empathy_debug_set_log_file_from_env ();
69
70         bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
71         bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
72         textdomain (GETTEXT_PACKAGE);
73
74         gtk_init (&argc, &argv);
75
76         gtk_window_set_default_icon_name ("empathy");
77         gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
78                                            PKGDATADIR G_DIR_SEPARATOR_S "icons");
79
80         mc = empathy_mission_control_new ();
81         chandler = empathy_chandler_new (BUS_NAME, OBJECT_PATH);
82         g_signal_connect (chandler, "new-channel",
83                           G_CALLBACK (call_chandler_new_channel_cb),
84                           mc);
85
86         empathy_debug (DEBUG_DOMAIN, "Ready to handle new streamed media channels");
87
88         gtk_main ();
89
90         g_object_unref (chandler);
91         g_object_unref (mc);
92
93         return EXIT_SUCCESS;
94 }
95