[gnome-bluetooth] Add success parameter to the connect function callback
- From: Bastien Nocera <hadess src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-bluetooth] Add success parameter to the connect function callback
- Date: Wed, 10 Jun 2009 13:02:02 -0400 (EDT)
commit 72b4759f9a5ea00de5e0235f270512cc09184fed
Author: Bastien Nocera <hadess hadess net>
Date: Wed Jun 10 18:00:52 2009 +0100
Add success parameter to the connect function callback
And assorted changes in the applet.
---
applet/main.c | 9 ++++++---
lib/bluetooth-client.c | 9 ++++++---
lib/bluetooth-client.h | 4 +++-
3 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/applet/main.c b/applet/main.c
index 21173c1..7e75f5f 100644
--- a/applet/main.c
+++ b/applet/main.c
@@ -403,8 +403,11 @@ set_device_status_label (const char *address, int connected)
}
static void
-connection_action_callback (GtkAction *action)
+connection_action_callback (BluetoothClient *_client,
+ gboolean success,
+ gpointer user_data)
{
+ GtkAction *action = (GtkAction *) user_data;
const char *address;
int connected;
@@ -439,10 +442,10 @@ on_connect_activate (GtkAction *action, gpointer data)
path = g_object_get_data (G_OBJECT (action), "device-path");
if (connected == DISCONNECTED) {
- if (bluetooth_client_connect_service (client, path, (BluetoothClientConnectFunc) connection_action_callback, action) != FALSE)
+ if (bluetooth_client_connect_service (client, path, connection_action_callback, action) != FALSE)
connected = DISCONNECTING;
} else if (connected == CONNECTED) {
- if (bluetooth_client_disconnect_service (client, path, (BluetoothClientConnectFunc) connection_action_callback, action) != FALSE)
+ if (bluetooth_client_disconnect_service (client, path, connection_action_callback, action) != FALSE)
connected = CONNECTING;
} else {
g_assert_not_reached ();
diff --git a/lib/bluetooth-client.c b/lib/bluetooth-client.c
index 8fbd561..d221feb 100644
--- a/lib/bluetooth-client.c
+++ b/lib/bluetooth-client.c
@@ -1435,14 +1435,17 @@ static void connect_callback(DBusGProxy *proxy,
{
ConnectData *conndata = user_data;
GError *error = NULL;
+ gboolean retval = TRUE;
dbus_g_proxy_end_call(proxy, call, &error, G_TYPE_INVALID);
- if (error != NULL)
+ if (error != NULL) {
+ retval = FALSE;
g_error_free(error);
+ }
if (conndata->func)
- conndata->func(bluetooth_client, conndata->data);
+ conndata->func(bluetooth_client, retval, conndata->data);
g_object_unref(proxy);
}
@@ -1534,7 +1537,7 @@ static void disconnect_callback(DBusGProxy *proxy,
}
if (conndata->func)
- conndata->func(bluetooth_client, conndata->data);
+ conndata->func(bluetooth_client, TRUE, conndata->data);
g_object_unref(proxy);
g_free (conndata);
diff --git a/lib/bluetooth-client.h b/lib/bluetooth-client.h
index 6ae51a7..71ea6c6 100644
--- a/lib/bluetooth-client.h
+++ b/lib/bluetooth-client.h
@@ -103,7 +103,9 @@ gboolean bluetooth_client_create_device(BluetoothClient *client,
gboolean bluetooth_client_set_trusted(BluetoothClient *client,
const char *device, gboolean trusted);
-typedef void (*BluetoothClientConnectFunc) (BluetoothClient *client, gpointer data);
+typedef void (*BluetoothClientConnectFunc) (BluetoothClient *client,
+ gboolean success,
+ gpointer data);
gboolean bluetooth_client_connect_service(BluetoothClient *client,
const char *device,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]