[gnome-bluetooth] test-deviceselection: print the same device information for all tests



commit bb160a6792863427e3100714199e4128c6cc2bec
Author: Daniele Forsi <dforsi src gnome org>
Date:   Sun May 6 16:10:11 2012 +0200

    test-deviceselection: print the same device information for all tests
    
    Replace ad hoc function with bluetooth_chooser_dump_selected_device().
    The combo test was printing more information than the others calling
    bluetooth_client_dump_device() which in turn calls
    bluetooth_chooser_dump_selected_device();

 lib/test-deviceselection.c |   35 ++---------------------------------
 1 files changed, 2 insertions(+), 33 deletions(-)
---
diff --git a/lib/test-deviceselection.c b/lib/test-deviceselection.c
index fdb7644..adcf0d6 100644
--- a/lib/test-deviceselection.c
+++ b/lib/test-deviceselection.c
@@ -38,38 +38,6 @@
 #include "bluetooth-utils.h"
 #include "bluetooth-filter-widget.h"
 
-static void dump_selected_device(BluetoothChooser *sel)
-{
-	GValue value = { 0, };
-
-	g_print ("Info dumped\n");
-	if (bluetooth_chooser_get_selected_device_info (sel, "address", &value)) {
-		g_print ("\tAddress: '%s'\n", g_value_get_string (&value));
-		g_value_unset (&value);
-	}
-	if (bluetooth_chooser_get_selected_device_info (sel, "name", &value)) {
-		g_print ("\tName: '%s'\n", g_value_get_string (&value));
-		g_value_unset (&value);
-	}
-	if (bluetooth_chooser_get_selected_device_info (sel, "connected", &value)) {
-		g_print ("\tConnected: %s\n", g_value_get_boolean (&value) ? "True" : "False");
-		g_value_unset (&value);
-	}
-	if (bluetooth_chooser_get_selected_device_info (sel, "uuids", &value)) {
-		guint i;
-		const char **uuids;
-
-		uuids = (const char **) g_value_get_boxed (&value);
-		if (uuids != NULL) {
-			g_print ("\tUUIDs: ");
-			for (i = 0; uuids[i] != NULL; i++)
-				g_print ("%s, ", uuids[i]);
-			g_print ("\n");
-		}
-		g_value_unset (&value);
-	}
-}
-
 static void select_device_changed(BluetoothChooser *sel,
 				  gchar *address, gpointer user_data)
 {
@@ -94,7 +62,8 @@ static void device_selected_cb(GObject *object,
 			       GParamSpec *spec, gpointer user_data)
 {
 	g_message ("Property \"device-selected\" changed");
-	dump_selected_device(BLUETOOTH_CHOOSER (object));
+	if (bluetooth_chooser_get_selected_device (BLUETOOTH_CHOOSER (object)))
+		bluetooth_chooser_dump_selected_device (BLUETOOTH_CHOOSER (object));
 }
 
 static void device_type_filter_selected_cb(GObject *object,



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