Skip to contentSkip to conversation

Fix incorrect device name in the wizard

PATCH In review Bastien Nocera 2 participants 2 messages Oct 23, 2008 – Oct 27, 2008 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix incorrect device name in the wizard

When the device is selected in the list before its name is resolved, the device name in the checks as well as the final page of the wizard will be wrong.

Attached patch should fix that.

Quoted 1 line

From 3ee1953501e1a64aba62405d63fde893a6a609ba Mon Sep 17 00:00:00 2001

From: Bastien Nocera <[email protected]>
Date: Thu, 23 Oct 2008 22:30:11 +0100
Subject: [PATCH] Fix incorrect device name in the wizard

When the device is selected in the list before its name is resolved, the device name in the checks as well as the final page of the wizard will be wrong.

---
 wizard/main.c |   40 ++++++++++++++++++++++++----------------
 1 files changed, 24 insertions(+), 16 deletions(-)
wizard/main.c +24 -16
index b1b944b..6f0b035 100644
@@ -193,7 +193,28 @@ static void prepare_callback(GtkWidget *assistant,
 		bluetooth_client_stop_discovery(client);
 
 	if (page == page_setup) {
-		gchar *text, *markup;
+		GtkTreeModel *model;
+		GtkTreeIter iter;
+		gchar *text, *markup, *address, *name;
+		guint type;
+
+		/* Get the info about the device now,
+		 * we can't get here without a valid selection */
+		if (gtk_tree_selection_get_selected(search_selection, &model, &iter) == FALSE)
+			g_assert_not_reached();
+
+		gtk_tree_model_get(model, &iter,
+				BLUETOOTH_COLUMN_ADDRESS, &address,
+				BLUETOOTH_COLUMN_ALIAS, &name,
+				BLUETOOTH_COLUMN_TYPE, &type, -1);
+
+		g_free(target_address);
+		target_address = address;
+
+		g_free(target_name);
+		target_name = name;
+
+		target_type = type;
 
 		text = g_strdup_printf(_("Connecting to %s now ..."),
 								target_name);
@@ -353,30 +374,17 @@ static void select_callback(GtkTreeSelection *selection, gpointer user_data)
 	GtkAssistant *assistant = user_data;
 	GtkTreeModel *model;
 	GtkTreeIter iter;
-	gboolean selected;
 	gboolean paired = FALSE;
-	gchar *address, *name;
-	guint type;
+	gboolean selected;
 
 	selected = gtk_tree_selection_get_selected(selection, &model, &iter);
 
 	if (selected == TRUE) {
 		gtk_tree_model_get(model, &iter,
-				BLUETOOTH_COLUMN_PAIRED, &paired,
-				BLUETOOTH_COLUMN_ADDRESS, &address,
-				BLUETOOTH_COLUMN_ALIAS, &name,
-				BLUETOOTH_COLUMN_TYPE, &type, -1);
+				BLUETOOTH_COLUMN_PAIRED, &paired, -1);
 
 		if (paired == TRUE)
 			selected = FALSE;
-
-		g_free(target_address);
-		target_address = address;
-
-		g_free(target_name);
-		target_name = name;
-
-		target_type = type;
 	}
 
 	gtk_assistant_set_page_complete(assistant, page_search, selected);
Signature · 1 line
1.6.0.3
maintainer
#1 lore raw

Hi Bastien,

Quoted 3 lines

When the device is selected in the list before its name is resolved, the device name in the checks as well as the final page of the wizard will be wrong.

patch has been applied, but I am worried about increasing the reference count of the agent and never decreasing it. Do you think that is a good idea?

Regards

Marcel