[gnome-bluetooth] Fix "dump devices"'s incorrect services state



commit 2b378e7dc8bd1d9bc3c64798e4188b33d0ebe786
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Sep 1 19:09:44 2010 +0100

    Fix "dump devices"'s incorrect services state
    
    Because we expected a boolean value, when it's actually an enum.

 lib/bluetooth-client.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/lib/bluetooth-client.c b/lib/bluetooth-client.c
index 22f3d4a..71f67ea 100644
--- a/lib/bluetooth-client.c
+++ b/lib/bluetooth-client.c
@@ -1990,8 +1990,17 @@ gboolean bluetooth_client_disconnect_service (BluetoothClient *client,
 static void
 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);
 }
 
 void



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