[gnome-bluetooth] lib: Fix setting default-adapter-discoverable
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth] lib: Fix setting default-adapter-discoverable
- Date: Fri, 14 Oct 2011 14:38:26 +0000 (UTC)
commit 3162368eb60c320c33d4a7046754c2ac7ca0cb7a
Author: Bastien Nocera <hadess hadess net>
Date: Fri Oct 14 15:35:54 2011 +0100
lib: Fix setting default-adapter-discoverable
We were using the wrong types to pass to
adapter_call_set_property_sync(), and leaking errors when those
occurred.
lib/bluetooth-client.c | 22 ++++++++++++----------
1 files changed, 12 insertions(+), 10 deletions(-)
---
diff --git a/lib/bluetooth-client.c b/lib/bluetooth-client.c
index 2764e2e..65b2f0c 100644
--- a/lib/bluetooth-client.c
+++ b/lib/bluetooth-client.c
@@ -1148,25 +1148,27 @@ _bluetooth_client_set_discoverable (BluetoothClient *client,
if (discoverable) {
ret = adapter_call_set_property_sync (ADAPTER (adapter),
"DiscoverableTimeout",
- g_variant_new_uint32 (timeout),
+ g_variant_new_variant (g_variant_new_uint32 (timeout)),
NULL, &error);
- if (ret == FALSE)
- goto bail;
+ if (ret == FALSE) {
+ g_warning ("Failed to set DiscoverableTimeout to %d: %s", timeout, error->message);
+ g_error_free (error);
+ g_object_unref (adapter);
+ return ret;
+ }
}
ret = adapter_call_set_property_sync (ADAPTER (adapter),
"Discoverable",
- g_variant_new_boolean (discoverable),
+ g_variant_new_variant (g_variant_new_boolean (discoverable)),
NULL, &error);
-
-bail:
- g_object_unref(adapter);
-
- if (error) {
- g_warning ("Cannot set discoverable: %s", error->message);
+ if (ret == FALSE) {
+ g_warning ("Failed to set Discoverable to %d: %s", discoverable, error->message);
g_error_free (error);
}
+ g_object_unref(adapter);
+
return ret;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]