summaryrefslogtreecommitdiffstats
path: root/gtk-gui.c
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@lmu.de>2013-03-04 09:15:46 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-03-04 00:26:32 -0800
commitc13a10986e3fbdd8269db5ebfc7a33ad5326d2cb (patch)
tree5928414466e20aad8f3c593c1cd95955522c9ad4 /gtk-gui.c
parenta5a3e0a72ea9f0108a8387318c82b43d06856765 (diff)
downloadsubsurface-c13a10986e3fbdd8269db5ebfc7a33ad5326d2cb.tar.gz
Improve pane position saving codev3.0.2
We should test for being in PANE_THREE mode in save_pane_position() and replace the if()'s testing against window geometry. This eliminates some code duplication and, more importantly, save_pane_position() is also called from save_window_geometry() whose calling pattern is not obvious. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'gtk-gui.c')
-rw-r--r--gtk-gui.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/gtk-gui.c b/gtk-gui.c
index 4418f12c6..95a278315 100644
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -330,13 +330,11 @@ void save_pane_position()
{
gint vpane_position = gtk_paned_get_position(GTK_PANED(vpane));
gint hpane_position = gtk_paned_get_position(GTK_PANED(hpane));
- int window_width, window_height;
- gtk_window_get_size(GTK_WINDOW (main_window), &window_width, &window_height);
- if (vpane_position && vpane_position < window_height - 12)
+ if (pane_conf == PANE_THREE){
subsurface_set_conf_int("vpane_position", vpane_position);
- if (hpane_position && hpane_position < window_width - 6 )
subsurface_set_conf_int("hpane_position", hpane_position);
+ }
}
void save_window_geometry(void)
@@ -1176,16 +1174,14 @@ static void show_user_manual(GtkWidget *w, gpointer data)
static void view_list(GtkWidget *w, gpointer data)
{
- if (pane_conf == PANE_THREE)
- save_pane_position();
+ save_pane_position();
gtk_paned_set_position(GTK_PANED(vpane), 0);
pane_conf = PANE_LIST;
}
static void view_profile(GtkWidget *w, gpointer data)
{
- if (pane_conf == PANE_THREE)
- save_pane_position();
+ save_pane_position();
gtk_paned_set_position(GTK_PANED(hpane), 0);
gtk_paned_set_position(GTK_PANED(vpane), 65535);
pane_conf = PANE_PROFILE;
@@ -1193,8 +1189,8 @@ static void view_profile(GtkWidget *w, gpointer data)
static void view_info(GtkWidget *w, gpointer data)
{
- if (pane_conf == PANE_THREE)
- save_pane_position();
+
+ save_pane_position();
gtk_paned_set_position(GTK_PANED(vpane), 65535);
gtk_paned_set_position(GTK_PANED(hpane), 65535);
pane_conf = PANE_INFO;