[gnome-bluetooth] Use services status to check connection status



commit 18cf75142c1e931068b89868b4429bc6515c3fc4
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Apr 24 19:31:11 2009 +0100

    Use services status to check connection status
    
    Use the status of services on a device to check whether or
    not it is connected, otherwise, we'd have to wait for the ACL link
    to timeout. Makes it faster to disconnect/reconnect immediately.
---
 applet/main.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/applet/main.c b/applet/main.c
index 9841717..ae443d1 100644
--- a/applet/main.c
+++ b/applet/main.c
@@ -501,7 +501,6 @@ update_device_list (GtkTreeIter *parent)
 				    BLUETOOTH_COLUMN_ADDRESS, &address,
 				    BLUETOOTH_COLUMN_SERVICES, &table,
 				    BLUETOOTH_COLUMN_ALIAS, &alias,
-				    BLUETOOTH_COLUMN_CONNECTED, &is_connected,
 				    -1);
 
 		if (address != NULL) {
@@ -521,6 +520,21 @@ update_device_list (GtkTreeIter *parent)
 			}
 		}
 
+		/* If one service is connected, then we're connected */
+		is_connected = FALSE;
+		if (table != NULL) {
+			GList *list, *l;
+
+			list = g_hash_table_get_values (table);
+			for (l = list; l != NULL; l = l->next) {
+				gboolean val = GPOINTER_TO_INT (l->data);
+				if (val != FALSE) {
+					is_connected = TRUE;
+					break;
+				}
+			}
+		}
+
 		if (table != NULL && address != NULL && proxy != NULL && alias != NULL) {
 			char *name;
 



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