summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2012-08-18 14:37:43 -0700
committerGravatar Linus Torvalds <torvalds@linux-foundation.org>2012-08-18 14:37:43 -0700
commited6356f7d9a69440c463ed750ab5bcb9f67819bc (patch)
tree99c2b7ede025c4d72ae89453a63d64ed0cc47593
parentbc53bbb10b3aaa22503c2d2b7024d1ac170a5733 (diff)
downloadsubsurface-ed6356f7d9a69440c463ed750ab5bcb9f67819bc.tar.gz
Make the notebook portion (dive notes/equipment/info) a scrollable window
This makes things start up with the wrong size, which is somewhat annoying, but by doing so avoids a bigger annoyance, namely that the three panes move around when moving between dives. In particular, if the initial dive didn't have much of an equipment list, the initial size allocated for the notebook is fairly small and determined mainly by the size of the the Dive Notes page. However, when you then scroll around in the dive list, you might hit a dive with lots of equipment, and suddenly the panes dividing the different parts of the subsurface application window will jump around to make room. That's horribly annoying, and actually makes things like double-clicking dives in the dive list not work right, because the first click will select it, and cause the dive to move around (so the second click will hit a totally different dive). Now, making the notebook be in a scrollable window means that if the size of the notebook changes, it might get a scrollbar, but the panes themselves do not move around. The initial sizing of that thing being wrong is annoying, though. We need to figure out a separate solution to that. [ Side note: currently it uses GTK_POLICY_NEVER for the horizontal scroll-bar, just to avoid the horizontal size also starting out wrong, which is *really* nasty. If we can solve the initial size issue, we should make the horizontal scroll-bar be GTK_POLICY_AUTOMATIC too. ] Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--gtk-gui.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gtk-gui.c b/gtk-gui.c
index 18c19c79f..4e5b9edfb 100644
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -755,6 +755,7 @@ void init_ui(int *argcp, char ***argvp)
GtkWidget *dive_list;
GtkWidget *menubar;
GtkWidget *vbox;
+ GtkWidget *scrolled;
GdkScreen *screen;
GtkIconTheme *icon_theme=NULL;
GtkSettings *settings;
@@ -826,13 +827,16 @@ void init_ui(int *argcp, char ***argvp)
vpane = gtk_vpaned_new();
gtk_box_pack_start(GTK_BOX(vbox), vpane, TRUE, TRUE, 3);
-
hpane = gtk_hpaned_new();
gtk_paned_add1(GTK_PANED(vpane), hpane);
+ g_signal_connect_after(G_OBJECT(vbox), "realize", G_CALLBACK(view_three), NULL);
/* Notebook for dive info vs profile vs .. */
notebook = gtk_notebook_new();
- gtk_paned_add1(GTK_PANED(hpane), notebook);
+ scrolled = gtk_scrolled_window_new(NULL, NULL);
+ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+ gtk_paned_add1(GTK_PANED(hpane), scrolled);
+ gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled), notebook);
g_signal_connect(notebook, "switch-page", G_CALLBACK(switch_page), NULL);
/* Create the actual divelist */