]> git.0d.be Git - empathy.git/blob - libempathy-gtk/empathy-share-my-desktop.c
share-my-desktop: request the tube using the CDO
[empathy.git] / libempathy-gtk / empathy-share-my-desktop.c
1 /*
2  * © 2009, Collabora Ltd
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: Arnaud Maillet <arnaud.maillet@collabora.co.uk>
19  */
20
21 #include <gtk/gtk.h>
22
23 #include <dbus/dbus-glib.h>
24 #include <telepathy-glib/util.h>
25 #include <telepathy-glib/contact.h>
26 #include <telepathy-glib/channel.h>
27 #include <telepathy-glib/interfaces.h>
28
29 #include <libempathy/empathy-dispatcher.h>
30
31 #define DEBUG_FLAG EMPATHY_DEBUG_SHARE_DESKTOP
32 #include <libempathy/empathy-debug.h>
33
34 #include "empathy-share-my-desktop.h"
35
36 void
37 empathy_share_my_desktop_share_with_contact (EmpathyContact *contact)
38 {
39   EmpathyDispatcher *dispatcher;
40   GHashTable *request;
41   TpContact *tp_contact;
42
43   tp_contact = empathy_contact_get_tp_contact (contact);
44
45   DEBUG ("Creation of ShareMyDesktop");
46
47   if (!TP_IS_CONTACT (tp_contact))
48     {
49       DEBUG ("It's not a tp contact");
50       return;
51     }
52
53   dispatcher = empathy_dispatcher_dup_singleton ();
54
55   request = tp_asv_new (
56       TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING,
57         TP_IFACE_CHANNEL_TYPE_STREAM_TUBE,
58       TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT,
59         TP_HANDLE_TYPE_CONTACT,
60       TP_PROP_CHANNEL_TARGET_HANDLE, G_TYPE_UINT,
61         tp_contact_get_handle (tp_contact),
62       TP_PROP_CHANNEL_TYPE_STREAM_TUBE_SERVICE, G_TYPE_STRING, "rfb",
63       NULL);
64
65   empathy_dispatcher_create_channel (dispatcher,
66       tp_contact_get_connection (tp_contact), request,
67       EMPATHY_DISPATCHER_CURRENT_TIME,
68       NULL, NULL);
69
70   g_object_unref (dispatcher);
71   g_hash_table_unref (request);
72 }