From d8811e2e4026297fb6f48d831deb3728b562bfb0 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sun, 3 Mar 2013 21:07:09 -0800 Subject: Only store pane positions if we currently display "View Three" We tried to detect this without needing a global variable but that clearly was too dependent on decorations that the window manager might add. This code works reliably. Signed-off-by: Dirk Hohndel --- gtk-gui.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'gtk-gui.c') diff --git a/gtk-gui.c b/gtk-gui.c index db04641f4..4418f12c6 100644 --- a/gtk-gui.c +++ b/gtk-gui.c @@ -43,6 +43,9 @@ GtkWidget *notebook; int error_count; const char *existing_filename; +typedef enum { PANE_INFO, PANE_PROFILE, PANE_LIST, PANE_THREE } pane_conf_t; +static pane_conf_t pane_conf; + static struct device_info *holdnicknames = NULL; static GtkWidget *dive_profile_widget(void); static void import_files(GtkWidget *, gpointer); @@ -1173,22 +1176,28 @@ static void show_user_manual(GtkWidget *w, gpointer data) static void view_list(GtkWidget *w, gpointer data) { - save_pane_position(); + if (pane_conf == PANE_THREE) + save_pane_position(); gtk_paned_set_position(GTK_PANED(vpane), 0); + pane_conf = PANE_LIST; } static void view_profile(GtkWidget *w, gpointer data) { - save_pane_position(); + if (pane_conf == PANE_THREE) + save_pane_position(); gtk_paned_set_position(GTK_PANED(hpane), 0); gtk_paned_set_position(GTK_PANED(vpane), 65535); + pane_conf = PANE_PROFILE; } static void view_info(GtkWidget *w, gpointer data) { - save_pane_position(); + if (pane_conf == PANE_THREE) + save_pane_position(); gtk_paned_set_position(GTK_PANED(vpane), 65535); gtk_paned_set_position(GTK_PANED(hpane), 65535); + pane_conf = PANE_INFO; } static void view_three(GtkWidget *w, gpointer data) @@ -1214,7 +1223,7 @@ static void view_three(GtkWidget *w, gpointer data) else gtk_paned_set_position(GTK_PANED(vpane), requisition.height + 6); - + pane_conf = PANE_THREE; } static void toggle_zoom(GtkWidget *w, gpointer data) -- cgit v1.2.3-70-g09d2