[gnome-bluetooth] Update test client for status changes



commit 3c8e44c6a1a8da7c227325832774609d9147e425
Author: Bastien Nocera <hadess hadess net>
Date:   Sun Jul 26 16:13:26 2009 +0100

    Update test client for status changes
    
    The test client now knows whether a service is connecting.

 lib/test-client.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/lib/test-client.c b/lib/test-client.c
index 57edcc2..56d5ebc 100644
--- a/lib/test-client.c
+++ b/lib/test-client.c
@@ -31,6 +31,7 @@
 
 #include "bluetooth-client.h"
 #include "bluetooth-client-private.h"
+#include "gnome-bluetooth-enum-types.h"
 
 static BluetoothClient *client;
 static GtkTreeSelection *selection;
@@ -98,10 +99,19 @@ static void type_to_text(GtkTreeViewColumn *column, GtkCellRenderer *cell,
 }
 
 static void
-services_foreach (const char *service, gpointer _value, GString *str)
+services_foreach (const char *service, gpointer value, GString *str)
 {
-	gboolean value = GPOINTER_TO_INT (_value);
-	g_string_append_printf (str, "%s (%s) ", service, value ? "connected" : "not connected");
+	GEnumClass *eclass;
+	GEnumValue *ev;
+	BluetoothStatus status = GPOINTER_TO_INT (value);
+
+	eclass = g_type_class_ref (BLUETOOTH_TYPE_STATUS);
+	ev = g_enum_get_value (eclass, status);
+	if (ev == NULL)
+		g_warning ("Unknown status value %d", status);
+
+	g_string_append_printf (str, "%s (%s) ", service, ev ? ev->value_nick : "unknown");
+	g_type_class_unref (eclass);
 }
 
 static void services_to_text(GtkTreeViewColumn *column, GtkCellRenderer *cell,



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