[gnome-bluetooth] test-client: display "Legacy Pairing" property as UNSET/FALSE/TRUE



commit 287c3bc4b52af906f1fa4457d6b228516935a20a
Author: Daniele Forsi <dforsi src gnome org>
Date:   Sun May 6 18:03:57 2012 +0200

    test-client: display "Legacy Pairing" property as UNSET/FALSE/TRUE
    
    As per commit d569de359d28679c7241f4ac40f59bf8a35f16ac

 lib/test-client.c |   24 ++++++++++++++++++++++--
 1 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/lib/test-client.c b/lib/test-client.c
index 97995e5..6325170 100644
--- a/lib/test-client.c
+++ b/lib/test-client.c
@@ -102,6 +102,26 @@ static void type_to_text(GtkTreeViewColumn *column, GtkCellRenderer *cell,
 }
 
 static void
+legacypairing_to_text(GtkTreeViewColumn *column, GtkCellRenderer *cell,
+		      GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data)
+{
+	gint legacypairing;
+
+	gtk_tree_model_get(model, iter, BLUETOOTH_COLUMN_LEGACYPAIRING, &legacypairing, -1);
+
+	switch (legacypairing) {
+	case -1:
+		g_object_set(cell, "text", "UNSET", NULL);
+		break;
+	case 0:
+		g_object_set(cell, "text", "FALSE", NULL);
+		break;
+	default:
+		g_object_set(cell, "text", "TRUE", NULL);
+	}
+}
+
+static void
 services_foreach (const char *service, gpointer value, GString *str)
 {
 	GEnumClass *eclass;
@@ -236,9 +256,9 @@ static void create_window(void)
 					"Connected", gtk_cell_renderer_text_new(),
 					"text", BLUETOOTH_COLUMN_CONNECTED, NULL);
 
-	gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(tree), -1,
+	gtk_tree_view_insert_column_with_data_func(GTK_TREE_VIEW(tree), -1,
 					"Legacy Pairing", gtk_cell_renderer_text_new(),
-					"text", BLUETOOTH_COLUMN_LEGACYPAIRING, NULL);
+						legacypairing_to_text, NULL, NULL);
 
 	gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(tree), -1,
 					"Discoverable", gtk_cell_renderer_text_new(),



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