All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Terry <michael.terry@canonical.com>
To: BlueZ development <bluez-devel@lists.sourceforge.net>
Subject: Re: [Bluez-devel] Wizard patch
Date: Wed, 09 Jul 2008 10:28:10 -0400	[thread overview]
Message-ID: <1215613690.26958.2.camel@bongo> (raw)
In-Reply-To: <1214874653.11537.69.camel@violet.holtmann.net>


[-- Attachment #1.1.1: Type: text/plain, Size: 417 bytes --]

Hello, Marcel.

On Tue, 2008-07-01 at 03:10 +0200, Marcel Holtmann wrote:
> please only change create_bonding and leave the others alone. Also you
> cast a little bit too much for my taste. For example void pointers
> need
> to extra cast.

Attached is callback3.diff which only modifies create_bonding.

I'm not sure which casts you felt were unnecessary.  I don't think I
cast any void pointers.

-mt

[-- Attachment #1.1.2: callback3.diff --]
[-- Type: text/x-patch, Size: 4781 bytes --]

Index: common/client.c
===================================================================
RCS file: /cvsroot/bluez/gnome/common/client.c,v
retrieving revision 1.44
diff -u -p -r1.44 client.c
--- common/client.c	12 Mar 2008 21:03:38 -0000	1.44
+++ common/client.c	9 Jul 2008 14:23:38 -0000
@@ -1115,11 +1115,20 @@ gboolean bluetooth_client_register_passk
 static void create_bonding_reply(DBusGProxy *proxy,
 					GError *error, gpointer userdata)
 {
-	//g_printf("create bonding reply\n");
+	DBusGAsyncData *data = (DBusGAsyncData*) userdata;
+	g_object_set_data(G_OBJECT(proxy), "bonding-call", NULL);
+	if (data && data->cb) {
+		(*(bluetooth_client_call_reply)data->cb) (error, data->userdata);
+		g_free(data);
+	}
+	if (error)
+		g_error_free(error);
 }
 
 gboolean bluetooth_client_create_bonding(BluetoothClient *client,
-					gchar *adapter, const gchar *address)
+					gchar *adapter, const gchar *address,
+					bluetooth_client_call_reply callback,
+					gpointer userdata)
 {
 	BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
 	GtkTreeIter iter;
@@ -1142,9 +1151,15 @@ gboolean bluetooth_client_create_bonding
 						COLUMN_OBJECT, &object, -1);
 
 		if (g_ascii_strcasecmp(path, adapter) == 0) {
-			adapter_create_bonding_async(object, address,
-						create_bonding_reply, NULL);
-			return TRUE;
+			DBusGProxyCall *call;
+			DBusGAsyncData *stuff;
+			stuff = g_new(DBusGAsyncData, 1);
+			stuff->cb = G_CALLBACK(callback);
+			stuff->userdata = userdata;
+			call = adapter_create_bonding_async(object, address,
+						create_bonding_reply, stuff);
+			g_object_set_data(G_OBJECT(object), "bonding-call", call);
+			return call != NULL;
 		}
 
 		cont = gtk_tree_model_iter_next(GTK_TREE_MODEL(priv->store), &iter);
@@ -1386,6 +1401,46 @@ gboolean bluetooth_client_cancel_discove
 	return FALSE;
 }
 
+gboolean bluetooth_client_cancel_bonding(BluetoothClient *client,
+					gchar *adapter, const gchar *address)
+{
+	BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
+	GtkTreeIter iter;
+	gboolean cont;
+
+	if (adapter == NULL)
+		adapter = priv->default_adapter;
+
+	if (adapter == NULL)
+		return FALSE;
+
+	cont = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(priv->store), &iter);
+
+	while (cont == TRUE) {
+		DBusGProxy *object;
+		gchar *path;
+
+		gtk_tree_model_get(GTK_TREE_MODEL(priv->store), &iter,
+						COLUMN_PATH, &path,
+						COLUMN_OBJECT, &object, -1);
+
+		if (g_ascii_strcasecmp(path, adapter) == 0) {
+			DBusGProxyCall *call;
+			call = (DBusGProxyCall *)g_object_get_data(G_OBJECT(object), "bonding-call");
+			if (call != NULL) {
+				dbus_g_proxy_cancel_call(object, call);
+				g_object_set_data(G_OBJECT(object), "bonding-call", NULL);
+				return TRUE;
+			}
+			return FALSE;
+		}
+
+		cont = gtk_tree_model_iter_next(GTK_TREE_MODEL(priv->store), &iter);
+	}
+
+	return FALSE;
+}
+
 GtkTreeModel *bluetooth_client_get_model(BluetoothClient *client)
 {
 	BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
Index: common/client.h
===================================================================
RCS file: /cvsroot/bluez/gnome/common/client.h,v
retrieving revision 1.24
diff -u -p -r1.24 client.h
--- common/client.h	6 Mar 2008 10:54:29 -0000	1.24
+++ common/client.h	9 Jul 2008 14:23:38 -0000
@@ -99,7 +99,13 @@ const gchar *bluetooth_type_to_string(gu
 gboolean bluetooth_client_register_passkey_agent(BluetoothClient *self,
 		const char *path, const char *address, const void *info);
 
+typedef void (*bluetooth_client_call_reply) (GError *error, gpointer data);
+
 gboolean bluetooth_client_create_bonding(BluetoothClient *self,
+					gchar *adapter, const gchar *address,
+					bluetooth_client_call_reply callback,
+					gpointer data);
+gboolean bluetooth_client_cancel_bonding(BluetoothClient *self,
 					gchar *adapter, const gchar *address);
 gboolean bluetooth_client_remove_bonding(BluetoothClient *self,
 					gchar *adapter, const gchar *address);
Index: wizard/main.c
===================================================================
RCS file: /cvsroot/bluez/gnome/wizard/main.c,v
retrieving revision 1.31
diff -u -p -r1.31 main.c
--- wizard/main.c	6 Jun 2008 15:08:32 -0000	1.31
+++ wizard/main.c	9 Jul 2008 14:23:38 -0000
@@ -120,7 +120,7 @@ static void prepare_callback(GtkWidget *
 					"/org/bluez/applet", address,
 					&dbus_glib_passkey_agent_object_info);
 
-		bluetooth_client_create_bonding(client, NULL, address);
+		bluetooth_client_create_bonding(client, NULL, address, NULL, NULL);
 
 		gtk_label_set_markup(GTK_LABEL(label_pairing), address);
 		gtk_label_set_markup(GTK_LABEL(label_passkey), passkey);

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 347 bytes --]

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08

[-- Attachment #3: Type: text/plain, Size: 164 bytes --]

_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

  reply	other threads:[~2008-07-09 14:28 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-27 19:05 [Bluez-devel] Wizard patch Michael Terry
2008-06-27 19:18 ` Michael Terry
2008-06-27 19:38 ` David Stockwell
2008-06-27 19:42   ` Michael Terry
2008-06-27 22:24     ` Marcel Holtmann
2008-06-27 22:23 ` Marcel Holtmann
2008-06-30 12:51   ` Michael Terry
2008-06-30 12:57     ` Marcel Holtmann
2008-06-30 13:20       ` Michael Terry
2008-06-30 14:07         ` Marcel Holtmann
2008-06-30 13:15   ` Michael Terry
2008-06-30 14:06     ` Marcel Holtmann
2008-06-30 15:57       ` Michael Terry
2008-06-30 16:03         ` Marcel Holtmann
2008-06-30 18:53           ` Michael Terry
2008-07-01  1:10             ` Marcel Holtmann
2008-07-09 14:28               ` Michael Terry [this message]
2008-08-19 17:33                 ` Michael Terry
2008-06-30 13:51   ` Michael Terry
2008-06-30 19:58     ` Michael Terry
2008-06-30 20:01       ` Michael Terry
2008-06-30 20:38         ` Bastien Nocera
2008-06-30 20:42         ` Mario Limonciello
2008-07-01  1:16     ` Marcel Holtmann
2008-06-30 15:48   ` Michael Terry
2008-07-01  1:24     ` Marcel Holtmann
2008-06-27 22:44 ` Bastien Nocera
     [not found]   ` <031301c8da4d$0bce3720$6701a8c0@freqonedev>
     [not found]     ` <1214813891.4435.149.camel@cookie.hadess.net>
2008-06-30 13:15       ` David Stockwell
2008-06-30 22:27         ` Luiz Augusto von Dentz
2008-07-01 18:56           ` David Stockwell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1215613690.26958.2.camel@bongo \
    --to=michael.terry@canonical.com \
    --cc=bluez-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.