]> git.0d.be Git - empathy.git/blob - src/empathy-call-chandler.c
Initial Voice+Video support Fixes bug #468204 (Elliot Fairweather, Xavier
[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 <stdlib.h>
22
23 #include <gtk/gtk.h>
24
25 #include <libmissioncontrol/mission-control.h>
26
27 #include <libempathy/empathy-chandler.h>
28 #include <libempathy/empathy-utils.h>
29 #include <libempathy/empathy-tp-call.h>
30 #include <libempathy/empathy-debug.h>
31
32 #include <libempathy-gtk/empathy-call-window.h>
33
34 #define DEBUG_DOMAIN "EmpathyCall"
35
36 #define BUS_NAME "org.gnome.Empathy.Call"
37 #define OBJECT_PATH "/org/freedesktop/Telepathy/ChannelHandler"
38
39 static void
40 call_chandler_new_channel_cb (EmpathyChandler *chandler,
41                               TpConn          *tp_conn,
42                               TpChan          *tp_chan,
43                               MissionControl  *mc)
44 {
45         EmpathyTpCall *call;
46         McAccount     *account;
47
48         account = mission_control_get_account_for_connection (mc, tp_conn, NULL);
49
50         call = empathy_tp_call_new (account, tp_chan);
51         empathy_call_window_show (call);
52         g_object_unref (account);
53         g_object_unref (call);
54 }
55
56 int
57 main (int argc, char *argv[])
58 {
59         EmpathyChandler *chandler;
60         MissionControl  *mc;
61
62         gtk_init (&argc, &argv);
63
64         mc = empathy_mission_control_new ();
65         chandler = empathy_chandler_new (BUS_NAME, OBJECT_PATH);
66         g_signal_connect (chandler, "new-channel",
67                           G_CALLBACK (call_chandler_new_channel_cb),
68                           mc);
69
70         empathy_debug (DEBUG_DOMAIN, "Ready to handle new streamed media channels");
71
72         gtk_main ();
73
74         g_object_unref (chandler);
75         g_object_unref (mc);
76
77         return EXIT_SUCCESS;
78 }
79