summaryrefslogtreecommitdiffstats
path: root/gtk-gui.c
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2013-03-02 11:30:10 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-03-02 09:10:34 -0800
commit0e3c6f7517619c877a924f493cc1d1fa4293e533 (patch)
treeacb493ac1ce4d74e6aab81109be185c539c8e1f0 /gtk-gui.c
parent3443abea721c9d5d8100c82e5b2dc9f543c5092c (diff)
downloadsubsurface-0e3c6f7517619c877a924f493cc1d1fa4293e533.tar.gz
Save 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.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/gtk-gui.c b/gtk-gui.c
index b7a631e2e..53979034b 100644
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -323,6 +323,16 @@ static void file_open(GtkWidget *w, gpointer data)
gtk_widget_destroy(dialog);
}
+void save_pane_position()
+{
+ gint vpane_position = gtk_paned_get_position(GTK_PANED(vpane));
+ gint hpane_position = gtk_paned_get_position(GTK_PANED(hpane));
+ if (vpane_position && vpane_position != 65535)
+ subsurface_set_conf_int("vpane_position", vpane_position);
+ if (hpane_position && hpane_position != 65535)
+ subsurface_set_conf_int("hpane_position", hpane_position);
+}
+
void save_window_geometry(void)
{
/* GDK_GRAVITY_NORTH_WEST assumed ( it is the default ) */
@@ -330,9 +340,7 @@ 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)));
-
+ save_pane_position();
subsurface_flush_conf();
}
@@ -349,7 +357,6 @@ void restore_window_geometry(void)
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);
-
}
gboolean on_delete(GtkWidget* w, gpointer data)
@@ -1163,17 +1170,20 @@ static void show_user_manual(GtkWidget *w, gpointer data)
static void view_list(GtkWidget *w, gpointer data)
{
- gtk_paned_set_position(GTK_PANED(vpane), 0);
+ save_pane_position();
+ gtk_paned_set_position(GTK_PANED(vpane), 0);
}
static void view_profile(GtkWidget *w, gpointer data)
{
+ save_pane_position();
gtk_paned_set_position(GTK_PANED(hpane), 0);
gtk_paned_set_position(GTK_PANED(vpane), 65535);
}
static void view_info(GtkWidget *w, gpointer data)
{
+ save_pane_position();
gtk_paned_set_position(GTK_PANED(vpane), 65535);
gtk_paned_set_position(GTK_PANED(hpane), 65535);
}
@@ -1188,7 +1198,7 @@ static void view_three(GtkWidget *w, gpointer data)
gtk_widget_get_allocation(hpane, &alloc);
- if(hpane_position && hpane_position != 65535)
+ 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);
@@ -1196,7 +1206,7 @@ static void view_three(GtkWidget *w, gpointer data)
gtk_widget_get_allocation(vpane, &alloc);
gtk_widget_size_request(notebook, &requisition);
/* pick the requested size for the notebook plus 6 pixels for frame */
- if(vpane_position && vpane_position != 65535)
+ 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);