summaryrefslogtreecommitdiffstats
path: root/gtk-gui.c
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2013-03-02 00:23:31 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-03-01 16:22:29 -0800
commitf7d373bae64627e25dcca219f81362c9f1d1b508 (patch)
tree4a3766aa4d9aab82d1dfb1e2c96d3e42730d4eb1 /gtk-gui.c
parent36422d2f9ee1856bec35892338845af85034190b (diff)
downloadsubsurface-f7d373bae64627e25dcca219f81362c9f1d1b508.tar.gz
Remember window pane positions
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.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/gtk-gui.c b/gtk-gui.c
index 0e7b6da8a..cd26cd635 100644
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -326,6 +326,8 @@ void save_window_geometry(void)
gtk_window_get_size(GTK_WINDOW (main_window), &window_width, &window_height);
subsurface_set_conf_int("window_width", window_width);
subsurface_set_conf_int("window_height", window_height);
+ subsurface_set_conf_int("vpane_position", gtk_paned_get_position(GTK_PANED(vpane)));
+ subsurface_set_conf_int("hpane_position", gtk_paned_get_position(GTK_PANED(hpane)));
subsurface_flush_conf();
}
@@ -340,6 +342,8 @@ void restore_window_geometry(void)
window_height == -1 ? window_height = 300 : window_height;
window_width == -1 ? window_width = 700 : window_width;
+ gtk_paned_set_position(GTK_PANED(vpane), subsurface_get_conf_int("vpane_position"));
+ gtk_paned_set_position(GTK_PANED(hpane), subsurface_get_conf_int("hpane_position"));
gtk_window_resize (GTK_WINDOW (main_window), window_width, window_height);
}
@@ -1142,12 +1146,25 @@ static void view_three(GtkWidget *w, gpointer data)
GtkAllocation alloc;
GtkRequisition requisition;
+ int vpane_position = subsurface_get_conf_int("vpane_position");
+ int hpane_position = subsurface_get_conf_int("hpane_position");
+
gtk_widget_get_allocation(hpane, &alloc);
- gtk_paned_set_position(GTK_PANED(hpane), alloc.width/2);
+
+ if(hpane_position && hpane_position != 65535)
+ gtk_paned_set_position(GTK_PANED(hpane), hpane_position);
+ else
+ gtk_paned_set_position(GTK_PANED(hpane), alloc.width/2);
+
gtk_widget_get_allocation(vpane, &alloc);
gtk_widget_size_request(notebook, &requisition);
/* pick the requested size for the notebook plus 6 pixels for frame */
- gtk_paned_set_position(GTK_PANED(vpane), requisition.height + 6);
+ if(vpane_position && vpane_position != 65535)
+ gtk_paned_set_position(GTK_PANED(vpane), vpane_position);
+ else
+ gtk_paned_set_position(GTK_PANED(vpane), requisition.height + 6);
+
+
}
static void toggle_zoom(GtkWidget *w, gpointer data)