[gnome-bluetooth/meego-dev: 9/15] Print error if cannot set discoverable



commit fe526224c4a6f4e78fa0eea05de9764ca2722ddf
Author: Ross Burton <ross linux intel com>
Date:   Thu Feb 25 13:29:37 2010 +0000

    Print error if cannot set discoverable

 lib/bluetooth-client.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/lib/bluetooth-client.c b/lib/bluetooth-client.c
index 87818e6..725b4d5 100644
--- a/lib/bluetooth-client.c
+++ b/lib/bluetooth-client.c
@@ -1620,6 +1620,7 @@ bluetooth_client_set_discoverable (BluetoothClient *client,
 				   gboolean discoverable,
                                    guint timeout)
 {
+	GError *error = NULL;
 	DBusGProxy *adapter;
 	GValue disco = { 0 };
 	GValue timeoutv = { 0 };
@@ -1639,8 +1640,8 @@ bluetooth_client_set_discoverable (BluetoothClient *client,
 	g_value_set_boolean (&disco, discoverable);
 	g_value_set_uint (&timeoutv, timeout);
 
-        if (discoverable) {
-		ret = dbus_g_proxy_call (adapter, "SetProperty", NULL,
+	if (discoverable) {
+		ret = dbus_g_proxy_call (adapter, "SetProperty", &error,
 					 G_TYPE_STRING, "DiscoverableTimeout",
 					 G_TYPE_VALUE, &timeoutv,
 					 G_TYPE_INVALID, G_TYPE_INVALID);
@@ -1648,12 +1649,11 @@ bluetooth_client_set_discoverable (BluetoothClient *client,
 			goto bail;
 	}
 
-	ret = dbus_g_proxy_call (adapter, "SetProperty", NULL,
+	ret = dbus_g_proxy_call (adapter, "SetProperty", &error,
 				 G_TYPE_STRING, "Discoverable",
 				 G_TYPE_VALUE, &disco,
 				 G_TYPE_INVALID, G_TYPE_INVALID);
-	if (ret == FALSE)
-		goto bail;
+
 
 bail:
 	g_value_unset (&disco);
@@ -1661,6 +1661,11 @@ bail:
 
 	g_object_unref(adapter);
 
+	if (error) {
+		g_warning ("Cannot set discoverable: %s", error->message);
+		g_error_free (error);
+	}
+
 	return ret;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]