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



commit a9ff7cf947b7b22984c2121acf29caf2ea99ebb6
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 06fd7be..d62d56d 100644
--- a/lib/bluetooth-client.c
+++ b/lib/bluetooth-client.c
@@ -1979,8 +1979,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]