mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 22:35:27 +00:00
Improve pane position saving code
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>
This commit is contained in:
parent
a5a3e0a72e
commit
c13a10986e
1 changed files with 6 additions and 10 deletions
16
gtk-gui.c
16
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;
|
||||
|
|
Loading…
Add table
Reference in a new issue