summaryrefslogtreecommitdiffstats
path: root/gtk-gui.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2012-11-05 20:13:05 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-11-05 20:15:45 -0800
commit41930e1edd8f61fc4274cc4e8993393cfa837ab9 (patch)
tree3ecfd70ded1dcf75c095e446f851da64b709a67f /gtk-gui.c
parent853277ba9d821922a8da6e55dd47d2f09def50fa (diff)
downloadsubsurface-41930e1edd8f61fc4274cc4e8993393cfa837ab9.tar.gz
Fix incorrect variable reuse bug in preferences dialog
This was introduced in commit ee803ef5d85b "Change preferences into a notebook and add second page for tec settings" In order to be able to get the new default XML file name back from the button, we need to keep that variable around and not overwrite it with more buttons for the tec preferences page. Reported-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'gtk-gui.c')
-rw-r--r--gtk-gui.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/gtk-gui.c b/gtk-gui.c
index e5b35f468..b14abb75b 100644
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -568,7 +568,7 @@ static void pick_default_file(GtkWidget *w, GtkButton *button)
static void preferences_dialog(GtkWidget *w, gpointer data)
{
int result;
- GtkWidget *dialog, *notebook, *font, *frame, *box, *vbox, *button;
+ GtkWidget *dialog, *notebook, *font, *frame, *box, *vbox, *button, *xmlfile_button;
const char *current_default, *new_default;
menu_units = output_units;
@@ -677,9 +677,10 @@ static void preferences_dialog(GtkWidget *w, gpointer data)
box = gtk_hbox_new(FALSE, 6);
gtk_container_add(GTK_CONTAINER(frame), box);
current_default = subsurface_default_filename();
- button = gtk_button_new_with_label(current_default);
- g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(pick_default_file), button);
- gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6);
+ xmlfile_button = gtk_button_new_with_label(current_default);
+ g_signal_connect(G_OBJECT(xmlfile_button), "clicked",
+ G_CALLBACK(pick_default_file), xmlfile_button);
+ gtk_box_pack_start(GTK_BOX(box), xmlfile_button, FALSE, FALSE, 6);
/* vbox that holds the second notebook page */
vbox = gtk_vbox_new(FALSE, 6);
@@ -755,7 +756,7 @@ static void preferences_dialog(GtkWidget *w, gpointer data)
subsurface_set_conf("pn2graph", PREF_BOOL, BOOL_TO_PTR(enabled_graphs.pn2));
subsurface_set_conf("phegraph", PREF_BOOL, BOOL_TO_PTR(enabled_graphs.phe));
- new_default = strdup(gtk_button_get_label(GTK_BUTTON(button)));
+ new_default = strdup(gtk_button_get_label(GTK_BUTTON(xmlfile_button)));
/* if we opened the default file and are changing its name,
* update existing_filename */