83
83
vino_dbus_listener_get_external_port (VinoDBusListener *listener,
88
88
vino_dbus_listener_get_internal_data (VinoDBusListener *listener,
90
char ** avahi_hostname,
90
char **avahi_hostname,
95
95
vino_dbus_listener_share_with_tube (VinoDBusListener *listener,
96
const gchar * connection_path,
97
const gchar * tube_path,
98
GHashTable * properties,
96
const gchar *connection_path,
97
const gchar *tube_path,
98
GHashTable *properties,
101
101
#include "dbus-interface-glue.h"
310
310
vino_dbus_listener_get_internal_data (VinoDBusListener *listener,
312
char ** avahi_hostname,
312
char **avahi_hostname,
316
316
#ifdef VINO_ENABLE_HTTP_SERVER
317
*port = (gdouble)vino_get_http_server_port (listener->priv->server);
317
*port = vino_get_http_server_port (listener->priv->server);
319
*port = (gdouble)vino_server_get_port (listener->priv->server);
319
*port = vino_server_get_port (listener->priv->server);
322
322
*hostname = get_local_hostname (listener);
324
323
*avahi_hostname = g_strdup (vino_mdns_get_hostname ());
378
377
dprintf (DBUS, "Object registered at path '%s'\n", obj_path);
380
g_signal_connect (server, "notify::alternative-port",
381
G_CALLBACK (vino_dbus_listener_info_changed),
379
g_signal_connect (server,
380
"notify::alternative-port",
381
G_CALLBACK (vino_dbus_listener_info_changed),
384
384
g_free (obj_path);
392
392
return listener->priv->server;
395
static DBusGConnection * vino_dbus_connection = NULL;
395
static DBusGConnection *vino_dbus_connection = NULL;
396
396
static gboolean vino_dbus_failed_to_connect = FALSE;
398
398
DBusGConnection *
399
399
vino_dbus_get_connection (void)
401
DBusConnection * dbus_conn;
402
401
if (vino_dbus_connection == NULL && !vino_dbus_failed_to_connect)
404
GError * error = NULL;
403
GError *error = NULL;
406
405
if ((vino_dbus_connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error)))
408
dprintf (DBUS, "Successfully connected to the message bus\n");
409
dbus_conn = dbus_g_connection_get_connection (vino_dbus_connection);
410
dbus_connection_set_exit_on_disconnect (dbus_conn, FALSE);
407
DBusConnection * dbus_conn;
409
dprintf (DBUS, "Successfully connected to the message bus\n");
410
dbus_conn = dbus_g_connection_get_connection (vino_dbus_connection);
411
dbus_connection_set_exit_on_disconnect (dbus_conn, FALSE);
414
vino_dbus_failed_to_connect = TRUE;
415
g_printerr ("Failed to open connection to bus: %s\n",
417
g_error_free (error);
415
vino_dbus_failed_to_connect = TRUE;
416
dprintf (DBUS, "Failed to open connection to bus: %s\n", error->message);
417
g_error_free (error);
421
421
return vino_dbus_connection;
428
428
DBusGConnection *connection;
429
GError *error = NULL;
430
DBusGProxy *bus_proxy;
431
int request_name_result;
429
DBusGProxy *bus_proxy;
430
guint request_name_result;
431
GError *error = NULL;
433
433
if (!(connection = vino_dbus_get_connection ()))
436
436
dbus_g_object_type_install_info (VINO_TYPE_DBUS_LISTENER,
437
&dbus_glib_vino_dbus_listener_object_info);
437
&dbus_glib_vino_dbus_listener_object_info);
439
439
bus_proxy = dbus_g_proxy_new_for_name (connection,
440
440
"org.freedesktop.DBus",
441
441
"/org/freedesktop/DBus",
442
442
"org.freedesktop.DBus");
444
if (!dbus_g_proxy_call(bus_proxy, "RequestName", &error,
445
G_TYPE_STRING, VINO_DBUS_BUS_NAME, G_TYPE_UINT, 0, G_TYPE_INVALID,
446
G_TYPE_UINT, &request_name_result, G_TYPE_INVALID))
444
if (!dbus_g_proxy_call (bus_proxy,
447
G_TYPE_STRING, VINO_DBUS_BUS_NAME,
448
G_TYPE_UINT, DBUS_NAME_FLAG_DO_NOT_QUEUE,
450
G_TYPE_UINT, &request_name_result,
448
g_debug ("Failed to request name: %s",
449
error ? error->message : "No error given");
453
dprintf (DBUS, "Failed to request DBUS name: %s", error ? error->message : "No error given");
450
454
g_clear_error (&error);
454
458
if (request_name_result == DBUS_REQUEST_NAME_REPLY_EXISTS)