[gnome-bluetooth] Export the error from a CreatePairedDevice call



commit da70a4043554cedc60132ca1ef22eeee990ddf35
Author: Bastien Nocera <hadess hadess net>
Date:   Sun Jul 12 01:27:27 2009 +0100

    Export the error from a CreatePairedDevice call
    
    So that the front-end can show a nice error to the user.

 lib/bluetooth-client-private.h |    5 ++++-
 lib/bluetooth-client.c         |    9 +++++----
 wizard/main.c                  |    1 +
 3 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/lib/bluetooth-client-private.h b/lib/bluetooth-client-private.h
index 5c0ea75..63f292e 100644
--- a/lib/bluetooth-client-private.h
+++ b/lib/bluetooth-client-private.h
@@ -36,7 +36,10 @@ DBusGProxy *bluetooth_client_get_default_adapter(BluetoothClient *client);
 gboolean bluetooth_client_start_discovery(BluetoothClient *client);
 gboolean bluetooth_client_stop_discovery(BluetoothClient *client);
 
-typedef void (*BluetoothClientCreateDeviceFunc) (BluetoothClient *client, const char *path, gpointer data);
+typedef void (*BluetoothClientCreateDeviceFunc) (BluetoothClient *client,
+						 const char *path,
+						 const GError *error,
+						 gpointer data);
 
 gboolean bluetooth_client_create_device(BluetoothClient *client,
 			const char *address, const char *agent,
diff --git a/lib/bluetooth-client.c b/lib/bluetooth-client.c
index 33f86a5..3a0b15a 100644
--- a/lib/bluetooth-client.c
+++ b/lib/bluetooth-client.c
@@ -1365,13 +1365,14 @@ static void create_device_callback(DBusGProxy *proxy,
 	dbus_g_proxy_end_call(proxy, call, &error,
 			DBUS_TYPE_G_OBJECT_PATH, &path, G_TYPE_INVALID);
 
-	if (error != NULL) {
+	if (error != NULL)
 		path = NULL;
-		g_error_free(error);
-	}
 
 	if (devdata->func)
-		devdata->func(devdata->client, path, devdata->data);
+		devdata->func(devdata->client, path, error, devdata->data);
+
+	if (error != NULL)
+		g_error_free (error);
 
 	g_object_unref (devdata->client);
 	g_object_unref(proxy);
diff --git a/wizard/main.c b/wizard/main.c
index 83260ed..f26541d 100644
--- a/wizard/main.c
+++ b/wizard/main.c
@@ -364,6 +364,7 @@ connect_callback (BluetoothClient *_client,
 static void
 create_callback (BluetoothClient *_client,
 		 const char *path,
+		 const GError *error,
 		 gpointer user_data)
 {
 	ConnectData *data;



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