gnome-bluetooth r576 - trunk/common
- From: hadess svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-bluetooth r576 - trunk/common
- Date: Wed, 8 Apr 2009 13:47:16 +0000 (UTC)
Author: hadess
Date: Wed Apr 8 13:47:16 2009
New Revision: 576
URL: http://svn.gnome.org/viewvc/gnome-bluetooth?rev=576&view=rev
Log:
Add a "connected" argument to the _connect and _disconnect callbacks.
Also fix a memleak when disconnecting.
Modified:
trunk/common/bluetooth-client.c
trunk/common/bluetooth-client.h
Modified: trunk/common/bluetooth-client.c
==============================================================================
--- trunk/common/bluetooth-client.c (original)
+++ trunk/common/bluetooth-client.c Wed Apr 8 13:47:16 2009
@@ -1333,6 +1333,7 @@
gpointer data;
/* used for disconnect */
GList *services;
+ gboolean disconnected;
} ConnectData;
static void connect_callback(DBusGProxy *proxy,
@@ -1340,14 +1341,16 @@
{
ConnectData *conndata = user_data;
GError *error = NULL;
+ gboolean connected = FALSE;
- dbus_g_proxy_end_call(proxy, call, &error, G_TYPE_INVALID);
+ if (dbus_g_proxy_end_call(proxy, call, &error, G_TYPE_INVALID) != FALSE)
+ connected = TRUE;
if (error != NULL)
g_error_free(error);
if (conndata->func)
- conndata->func(conndata->data);
+ conndata->func(connected, conndata->data);
g_object_unref(proxy);
}
@@ -1417,7 +1420,8 @@
{
ConnectData *conndata = user_data;
- dbus_g_proxy_end_call(proxy, call, NULL, G_TYPE_INVALID);
+ if (dbus_g_proxy_end_call(proxy, call, NULL, G_TYPE_INVALID) != FALSE)
+ conndata->disconnected = TRUE;
if (conndata->services != NULL) {
DBusGProxy *service;
@@ -1437,9 +1441,10 @@
}
if (conndata->func)
- conndata->func(conndata->data);
+ conndata->func(!conndata->disconnected, conndata->data);
g_object_unref(proxy);
+ g_free (conndata);
}
static int
Modified: trunk/common/bluetooth-client.h
==============================================================================
--- trunk/common/bluetooth-client.h (original)
+++ trunk/common/bluetooth-client.h Wed Apr 8 13:47:16 2009
@@ -101,7 +101,7 @@
gboolean bluetooth_client_set_trusted(BluetoothClient *client,
const char *device, gboolean trusted);
-typedef void (*BluetoothClientConnectFunc) (gpointer data);
+typedef void (*BluetoothClientConnectFunc) (gboolean connected, 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]