gnome-bluetooth r422 - trunk/common



Author: hadess
Date: Mon Mar  2 16:00:26 2009
New Revision: 422
URL: http://svn.gnome.org/viewvc/gnome-bluetooth?rev=422&view=rev

Log:
Print out more debug in test-device-selection

Useful to have the device name and stuff.



Modified:
   trunk/common/test-deviceselection.c

Modified: trunk/common/test-deviceselection.c
==============================================================================
--- trunk/common/test-deviceselection.c	(original)
+++ trunk/common/test-deviceselection.c	Mon Mar  2 16:00:26 2009
@@ -143,6 +143,29 @@
 	return dialog;
 }
 
+static void
+response_cb (GtkDialog *dialog, gint response_id, BluetoothChooser *selector)
+{
+	if (response_id == GTK_RESPONSE_ACCEPT) {
+		char *address, *name, *icon;
+		guint type;
+
+		g_object_get (G_OBJECT (selector),
+			      "device-selected", &address,
+			      "device-selected-name", &name,
+			      "device-selected-icon", &icon,
+			      "device-selected-type", &type,
+			      NULL);
+		g_message("Selected device is: %s (address: %s, icon: %s, type: %s)",
+			  name, address, icon, bluetooth_type_to_string (type));
+		g_free(address);
+		g_free (name);
+		g_free (icon);
+	} else {
+		g_message ("No selected device");
+	}
+}
+
 static GtkWidget *
 create_wizard_dialogue (void)
 {
@@ -173,6 +196,9 @@
 	gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), selector);
 	bluetooth_chooser_start_discovery (BLUETOOTH_CHOOSER (selector));
 
+	g_signal_connect (G_OBJECT (dialog), "response",
+			  G_CALLBACK (response_cb), selector);
+
 	return dialog;
 }
 
@@ -204,15 +230,6 @@
 
 	response = gtk_dialog_run(GTK_DIALOG(dialog));
 
-#if 0
-	if (response == GTK_RESPONSE_ACCEPT) {
-		char *address;
-
-		g_object_get(selector, "device-selected", &address, NULL);
-		g_message("Selected device is: %s", address);
-		g_free(address);
-	}
-#endif
 	gtk_widget_destroy(dialog);
 
 	return 0;



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