summaryrefslogtreecommitdiffstats
path: root/gtk-gui.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-03-03 21:07:09 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-03-03 21:07:09 -0800
commitd8811e2e4026297fb6f48d831deb3728b562bfb0 (patch)
tree91e2c68dfccfe2e9ec7a2378c4b2d30e3e2ddf9a /gtk-gui.c
parent01291929582ac573d7efd7fba3dbe061c9d70f9a (diff)
downloadsubsurface-d8811e2e4026297fb6f48d831deb3728b562bfb0.tar.gz
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 <dirk@hohndel.org>
Diffstat (limited to 'gtk-gui.c')
-rw-r--r--gtk-gui.c17
1 files changed, 13 insertions, 4 deletions
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)