From: Bastien Nocera <hadess@hadess.net>
To: BlueZ Hackers <bluez-devel@lists.sourceforge.net>
Subject: [Bluez-devel] [PATCH] Show all the possibly known devices
Date: Thu, 06 Mar 2008 15:56:19 +0000 [thread overview]
Message-ID: <1204818979.2640.117.camel@cookie.hadess.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 312 bytes --]
Heya,
This patch makes the default client.c show all the known devices,
including the seen remote devices. Those can be easily filtered using
the drop-downs at the bottom of the dialogue.
It also doesn't query remotely to avoid problems with asking for a name
for a device we don't know about anymore.
Cheers
[-- Attachment #2: bluez-gnome-device-selection-show-all-devices.patch --]
[-- Type: text/x-patch, Size: 3407 bytes --]
Index: client.c
===================================================================
RCS file: /cvsroot/bluez/gnome/common/client.c,v
retrieving revision 1.42
diff -u -p -u -p -r1.42 client.c
--- client.c 6 Mar 2008 10:54:29 -0000 1.42
+++ client.c 6 Mar 2008 15:45:35 -0000
@@ -204,7 +204,8 @@ static guint class_to_type(guint32 class
static void insert_device(DBusGProxy *object, GtkTreeIter *parent,
BluetoothClient *client,
- const char *address, const int rssi, gboolean active)
+ const char *address, const int rssi, gboolean active,
+ gboolean remote_lookup)
{
BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
GtkTreeIter iter;
@@ -223,20 +224,28 @@ static void insert_device(DBusGProxy *ob
&hash, G_TYPE_INVALID);
value = (hash == NULL) ? NULL : g_hash_table_lookup(hash, "name");
- if (value == NULL)
- dbus_g_proxy_call(object, "GetRemoteName", NULL,
- G_TYPE_STRING, address, G_TYPE_INVALID,
- G_TYPE_STRING, &name, G_TYPE_INVALID);
- else
+ if (value == NULL) {
+ if (remote_lookup) {
+ dbus_g_proxy_call(object, "GetRemoteName", NULL,
+ G_TYPE_STRING, address, G_TYPE_INVALID,
+ G_TYPE_STRING, &name, G_TYPE_INVALID);
+ } else {
+ name = g_strdup(address);
+ }
+ } else {
name = g_value_get_string(value);
+ }
value = (hash == NULL) ? NULL : g_hash_table_lookup(hash, "class");
- if (value == NULL)
- dbus_g_proxy_call(object, "GetRemoteClass", NULL,
- G_TYPE_STRING, address, G_TYPE_INVALID,
- G_TYPE_UINT, &class, G_TYPE_INVALID);
- else
+ if (value == NULL) {
+ if (remote_lookup) {
+ dbus_g_proxy_call(object, "GetRemoteClass", NULL,
+ G_TYPE_STRING, address, G_TYPE_INVALID,
+ G_TYPE_UINT, &class, G_TYPE_INVALID);
+ }
+ } else {
class = g_value_get_uint(value);
+ }
value = (hash == NULL) ? NULL : g_hash_table_lookup(hash, "bonded");
if (value == NULL)
@@ -447,7 +456,7 @@ static void device_found(DBusGProxy *obj
if (find_iter_for_object(object, BLUETOOTH_CLIENT(user_data), &iter) == FALSE)
return;
- insert_device(object, &iter, BLUETOOTH_CLIENT(user_data), address, rssi, TRUE);
+ insert_device(object, &iter, BLUETOOTH_CLIENT(user_data), address, rssi, TRUE, TRUE);
}
static void device_disappeared(DBusGProxy *object,
@@ -567,7 +576,7 @@ static void update_adapter(DBusGProxy *o
if (error == NULL) {
while (*array) {
- insert_device(object, iter, client, *array, 0, FALSE);
+ insert_device(object, iter, client, *array, 0, FALSE, TRUE);
array++;
}
} else {
@@ -580,7 +589,7 @@ static void update_adapter(DBusGProxy *o
if (error == NULL) {
while (*array) {
- insert_device(object, iter, client, *array, 0, FALSE);
+ insert_device(object, iter, client, *array, 0, FALSE, FALSE);
array++;
}
} else {
@@ -593,7 +602,7 @@ static void update_adapter(DBusGProxy *o
if (error == NULL) {
while (*array) {
- insert_device(object, iter, client, *array, 0, FALSE);
+ insert_device(object, iter, client, *array, 0, FALSE, FALSE);
array++;
}
} else {
@@ -602,14 +611,12 @@ static void update_adapter(DBusGProxy *o
goto failover;
}
- return;
-
failover:
adapter_list_remote_devices(object, &array, &error);
if (error == NULL) {
while (*array) {
- insert_device(object, iter, client, *array, 0, FALSE);
+ insert_device(object, iter, client, *array, 0, FALSE, FALSE);
array++;
}
} else
[-- Attachment #3: Type: text/plain, Size: 228 bytes --]
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
[-- Attachment #4: Type: text/plain, Size: 164 bytes --]
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
next reply other threads:[~2008-03-06 15:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-06 15:56 Bastien Nocera [this message]
2008-03-07 14:15 ` [Bluez-devel] [PATCH] Show all the possibly known devices Marcel Holtmann
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=1204818979.2640.117.camel@cookie.hadess.net \
--to=hadess@hadess.net \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox