diff options
author | Robert C. Helling <helling@atdotde.de> | 2013-03-02 00:23:31 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-03-01 16:22:29 -0800 |
commit | f7d373bae64627e25dcca219f81362c9f1d1b508 (patch) | |
tree | 4a3766aa4d9aab82d1dfb1e2c96d3e42730d4eb1 | |
parent | 36422d2f9ee1856bec35892338845af85034190b (diff) | |
download | subsurface-f7d373bae64627e25dcca219f81362c9f1d1b508.tar.gz |
Remember window pane positions
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | gtk-gui.c | 21 |
1 files changed, 19 insertions, 2 deletions
@@ -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) |