[gnome-bluetooth] lib: Add hack to get default adapter as GDBusProxy
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth] lib: Add hack to get default adapter as GDBusProxy
- Date: Wed, 28 Sep 2011 13:50:13 +0000 (UTC)
commit 1dd7002d7138c4705eaeca5fbbe9c4306be6d501
Author: Bastien Nocera <hadess hadess net>
Date: Wed Sep 28 14:43:49 2011 +0100
lib: Add hack to get default adapter as GDBusProxy
So we can port some code to GDBus now.
lib/bluetooth-client-private.h | 1 +
lib/bluetooth-client.c | 31 +++++++++++++++++++++++++++++++
2 files changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/lib/bluetooth-client-private.h b/lib/bluetooth-client-private.h
index 44c2fbc..86679c0 100644
--- a/lib/bluetooth-client-private.h
+++ b/lib/bluetooth-client-private.h
@@ -32,6 +32,7 @@
G_BEGIN_DECLS
DBusGProxy *bluetooth_client_get_default_adapter(BluetoothClient *client);
+GDBusProxy *bluetooth_client_get_default_adapter_gdbus (BluetoothClient *client);
gboolean bluetooth_client_start_discovery(BluetoothClient *client);
gboolean bluetooth_client_stop_discovery(BluetoothClient *client);
diff --git a/lib/bluetooth-client.c b/lib/bluetooth-client.c
index a3279c8..5a0980c 100644
--- a/lib/bluetooth-client.c
+++ b/lib/bluetooth-client.c
@@ -1279,6 +1279,37 @@ DBusGProxy *bluetooth_client_get_default_adapter(BluetoothClient *client)
return adapter;
}
+/* XXX */
+GDBusProxy *bluetooth_client_get_default_adapter_gdbus (BluetoothClient *client)
+{
+ DBusGProxy *proxy;
+ GDBusProxy *ret;
+ GError *error = NULL;
+
+ proxy = bluetooth_client_get_default_adapter (client);
+ if (proxy == NULL)
+ return NULL;
+
+ ret = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
+ G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES | G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS | G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
+ NULL,
+ dbus_g_proxy_get_bus_name (proxy),
+ dbus_g_proxy_get_path (proxy),
+ dbus_g_proxy_get_interface (proxy),
+ NULL,
+ &error);
+
+ g_object_unref (proxy);
+
+ if (ret == NULL) {
+ g_warning ("Failed to create proxy for default adapter: %s", error->message);
+ g_error_free (error);
+ return NULL;
+ }
+
+ return ret;
+}
+
/**
* bluetooth_client_start_discovery:
* @client: a #BluetoothClient object
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]