* [Bluez-devel] [PATCH] Show all the possibly known devices
@ 2008-03-06 15:56 Bastien Nocera
2008-03-07 14:15 ` Marcel Holtmann
0 siblings, 1 reply; 2+ messages in thread
From: Bastien Nocera @ 2008-03-06 15:56 UTC (permalink / raw)
To: BlueZ Hackers
[-- 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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Bluez-devel] [PATCH] Show all the possibly known devices
2008-03-06 15:56 [Bluez-devel] [PATCH] Show all the possibly known devices Bastien Nocera
@ 2008-03-07 14:15 ` Marcel Holtmann
0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2008-03-07 14:15 UTC (permalink / raw)
To: BlueZ development
Hi Bastien,
> 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.
it did some modification to the patch to honor the 80 characters width
requirement :)
Other than that, the patch has been applied.
Regards
Marcel
-------------------------------------------------------------------------
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/
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-03-07 14:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-06 15:56 [Bluez-devel] [PATCH] Show all the possibly known devices Bastien Nocera
2008-03-07 14:15 ` Marcel Holtmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox