[gnome-bluetooth/fedora-11] Track the state of org.bluez.Audio service as well



commit ea8e00974c687eba2bf2b735245ea2a3b4d80af9
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Jul 24 13:37:05 2009 +0100

    Track the state of org.bluez.Audio service as well
    
    Because otherwise we think it's still connected when it actually
    isn't. Fixes the device showing up as connected when it wasn't
    in BlueZ.

 lib/bluetooth-client.c |   12 +++---------
 1 files changed, 3 insertions(+), 9 deletions(-)
---
diff --git a/lib/bluetooth-client.c b/lib/bluetooth-client.c
index caae303..63582f1 100644
--- a/lib/bluetooth-client.c
+++ b/lib/bluetooth-client.c
@@ -61,6 +61,7 @@
 #define BLUEZ_DEVICE_INTERFACE	"org.bluez.Device"
 
 static char * detectable_interfaces[] = {
+	"org.bluez.Audio",
 	"org.bluez.Headset",
 	"org.bluez.AudioSink",
 	"org.bluez.Input"
@@ -349,22 +350,15 @@ device_list_nodes (DBusGProxy *device, BluetoothClient *client, gboolean connect
 	for (i = 0; i < G_N_ELEMENTS (detectable_interfaces); i++) {
 		DBusGProxy *iface;
 		GHashTable *props;
-		const char *iface_name;
 
 		/* Don't add the input interface for devices that already have
 		 * audio stuff */
 		if (g_str_equal (detectable_interfaces[i], BLUEZ_INPUT_INTERFACE)
 		    && g_hash_table_size (table) > 0)
 			continue;
-		/* Add org.bluez.Audio if the device supports headset or audiosink */
-		if (g_str_equal (detectable_interfaces[i], BLUEZ_HEADSET_INTERFACE) ||
-		    g_str_equal (detectable_interfaces[i], BLUEZ_AUDIOSINK_INTERFACE))
-		    	iface_name = BLUEZ_AUDIO_INTERFACE;
-		else
-			iface_name = detectable_interfaces[i];
 
 		/* And skip interface if it's already in the hash table */
-		if (g_hash_table_lookup (table, iface_name) != NULL)
+		if (g_hash_table_lookup (table, detectable_interfaces[i]) != NULL)
 			continue;
 
 		iface = dbus_g_proxy_new_from_proxy (device, detectable_interfaces[i], NULL);
@@ -386,7 +380,7 @@ device_list_nodes (DBusGProxy *device, BluetoothClient *client, gboolean connect
 				is_connected = (g_strcmp0(str, "connected") == 0);
 			}
 
-			g_hash_table_insert (table, (gpointer) iface_name, GINT_TO_POINTER (is_connected));
+			g_hash_table_insert (table, (gpointer) detectable_interfaces[i], GINT_TO_POINTER (is_connected));
 
 			if (connect_signal != FALSE) {
 				dbus_g_proxy_add_signal(iface, "PropertyChanged",



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]