Remmina - The GTK+ Remote Desktop Client  v1.4.2
Remmina is a remote desktop client written in GTK+, aiming to be useful for system administrators and travellers, who need to work with lots of remote computers in front of either large monitors or tiny netbooks. Remmina supports multiple network protocols in an integrated and consistent user interface. Currently RDP, VNC, NX, XDMCP and SSH are supported.
telepathy_handler.c
Go to the documentation of this file.
1 /*
2  * Remmina - The GTK+ Remote Desktop Client
3  * Copyright (C) 2010 Vic Lee
4  * Copyright (C) 2014-2015 Antenore Gatta, Fabio Castelli, Giovanni Panozzo
5  * Copyright (C) 2016-2020 Antenore Gatta, Giovanni Panozzo
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21  *
22  * In addition, as a special exception, the copyright holders give
23  * permission to link the code of portions of this program with the
24  * OpenSSL library under certain conditions as described in each
25  * individual source file, and distribute linked combinations
26  * including the two.
27  * You must obey the GNU General Public License in all respects
28  * for all of the code used other than OpenSSL. * If you modify
29  * file(s) with this exception, you may extend this exception to your
30  * version of the file(s), but you are not obligated to do so. * If you
31  * do not wish to do so, delete this exception statement from your
32  * version. * If you delete this exception statement from all source
33  * files in the program, then also delete it here.
34  *
35  */
36 
37 #include "common/remmina_plugin.h"
38 #include <gmodule.h>
39 #include <telepathy-glib/dbus.h>
40 #include <telepathy-glib/defs.h>
41 #include <telepathy-glib/svc-client.h>
43 #include "telepathy_handler.h"
44 
46 
47 #define REMMINA_TP_BUS_NAME TP_CLIENT_BUS_NAME_BASE "Remmina"
48 #define REMMINA_TP_OBJECT_PATH TP_CLIENT_OBJECT_PATH_BASE "Remmina"
49 
50 static void remmina_tp_handler_iface_init(gpointer g_iface, gpointer iface_data);
51 
53  G_IMPLEMENT_INTERFACE(TP_TYPE_SVC_CLIENT, NULL);
54  G_IMPLEMENT_INTERFACE( TP_TYPE_SVC_CLIENT_HANDLER, remmina_tp_handler_iface_init);
55  );
56 
58 {
59  TRACE_CALL(__func__);
60 }
61 
63 {
64  TRACE_CALL(__func__);
65 }
66 
67 static void remmina_tp_handler_handle_channels(TpSvcClientHandler *handler, const char *account_path,
68  const char *connection_path, const GPtrArray *channels, const GPtrArray *requests_satisfied,
69  guint64 user_action_time, GHashTable *handler_info, DBusGMethodInvocation *context)
70 {
71  TRACE_CALL(__func__);
72  gint i;
73  GArray *array;
74 
75  for (i = 0; i < channels->len; i++) {
76  array = g_ptr_array_index(channels, i);
77  remmina_tp_channel_handler_new(account_path, connection_path,
78  (const gchar*)g_value_get_boxed(&g_array_index(array, GValue, 0)),
79  (GHashTable*)g_value_get_boxed(&g_array_index(array, GValue, 1)), context);
80  }
81 }
82 
83 static void remmina_tp_handler_iface_init(gpointer g_iface, gpointer iface_data)
84 {
85  TRACE_CALL(__func__);
86  TpSvcClientHandlerClass *klass = (TpSvcClientHandlerClass*)g_iface;
87 
88 #define IMPLEMENT(x) tp_svc_client_handler_implement_ ## x(klass, remmina_tp_handler_ ## x)
89  IMPLEMENT(handle_channels);
90 #undef IMPLEMENT
91 }
92 
94 {
95  TRACE_CALL(__func__);
96  TpDBusDaemon *bus;
97  GError *error = NULL;
98 
99  bus = tp_dbus_daemon_dup(&error);
100  if (bus == NULL) {
101  g_print("tp_dbus_daemon_dup: %s", error->message);
102  return FALSE;
103  }
104  if (!tp_dbus_daemon_request_name(bus, REMMINA_TP_BUS_NAME, FALSE, &error)) {
105  g_object_unref(bus);
106  g_print("tp_dbus_daemon_request_name: %s", error->message);
107  return FALSE;
108  }
109  dbus_g_connection_register_g_object(
110  tp_proxy_get_dbus_connection(TP_PROXY(bus)),
111  REMMINA_TP_OBJECT_PATH, G_OBJECT(handler));
112  g_object_unref(bus);
113  g_print("%s: bus_name " REMMINA_TP_BUS_NAME
114  " object_path " REMMINA_TP_OBJECT_PATH "\n", __func__);
115  return TRUE;
116 }
117 
120 {
121  TRACE_CALL(__func__);
122  RemminaTpHandler *handler;
123 
124  handler = REMMINA_TP_HANDLER(g_object_new(REMMINA_TYPE_TP_HANDLER, NULL));
126  return handler;
127 }
128 
static void remmina_tp_handler_handle_channels(TpSvcClientHandler *handler, const char *account_path, const char *connection_path, const GPtrArray *channels, const GPtrArray *requests_satisfied, guint64 user_action_time, GHashTable *handler_info, DBusGMethodInvocation *context)
static void remmina_tp_handler_class_init(RemminaTpHandlerClass *klass)
G_DEFINE_TYPE_WITH_CODE(RemminaTpHandler, remmina_tp_handler, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE(TP_TYPE_SVC_CLIENT, NULL);G_IMPLEMENT_INTERFACE(TP_TYPE_SVC_CLIENT_HANDLER, remmina_tp_handler_iface_init);)
RemminaTpHandler * remmina_tp_handler_new(void)
static RemminaTpHandler * remmina_tp_handler
RemminaPluginService * remmina_plugin_telepathy_service
static gboolean remmina_tp_handler_register(RemminaTpHandler *handler)
void remmina_tp_channel_handler_new(const gchar *account_path, const gchar *connection_path, const gchar *channel_path, GHashTable *channel_properties, DBusGMethodInvocation *context)
static void remmina_tp_handler_iface_init(gpointer g_iface, gpointer iface_data)
static void remmina_tp_handler_init(RemminaTpHandler *handler)