summaryrefslogtreecommitdiff
path: root/gtk/gtk_window.c
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2010-04-08 20:17:57 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2010-04-08 20:17:57 +0000
commit169e8e3f9152d7ef9070e818ae700ec049024ed8 (patch)
treec49ab27b85cae1ac9b9d62423bb4eb2ae260971e /gtk/gtk_window.c
parentee12fb211fe06fb1d18d09834a336642c2440b3d (diff)
downloadnetsurf-169e8e3f9152d7ef9070e818ae700ec049024ed8.tar.gz
netsurf-169e8e3f9152d7ef9070e818ae700ec049024ed8.tar.bz2
Status bar width now set in proportion to actual window width. Correctly retain status bar proportion as window is resized.
svn path=/trunk/netsurf/; revision=10325
Diffstat (limited to 'gtk/gtk_window.c')
-rw-r--r--gtk/gtk_window.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/gtk/gtk_window.c b/gtk/gtk_window.c
index 1dfb8d5c6..1b959a366 100644
--- a/gtk/gtk_window.c
+++ b/gtk/gtk_window.c
@@ -67,6 +67,7 @@ struct gui_window {
/**< frames only; top level of gtk structure of gui_window */
GtkWidget *tab; /**< the visible tab */
GtkLabel *status_bar;
+ GtkPaned *paned; /**< statusbar/scrollbar paned */
gulong signalhandler[NSGTK_WINDOW_SIGNAL_COUNT];
/**< to allow disactivation / resume of normal window behaviour */
struct gui_window *next, *prev; /**< list for eventual cleanup */
@@ -157,6 +158,7 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
LOG(("Creating gui window %p for browser window %p", g, bw));
g->bw = bw;
+ g->paned = NULL;
g->mouse.state = 0;
g->current_pointer = GUI_POINTER_DEFAULT;
if (clone != NULL)
@@ -193,18 +195,7 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
GtkWidget *tab_contents = glade_xml_get_widget(xml, "tabContents");
g->layout = GTK_LAYOUT(glade_xml_get_widget(xml, "layout"));
g->status_bar = GTK_LABEL(glade_xml_get_widget(xml, "status_bar"));
-
- /* Set statusbar / scrollbar proportion according to the
- * percentage given by "option_toolbar_status_width / 10000" */
- /* TODO: Is this the best place to do this? */
- /* TODO: Should set it to a proportion of real window width,
- * not some arbitrary guess at window width. */
- /* TODO: Needs to be reset to proportion of window width as
- * window is resized too */
- const int window_width_guess = 1024;
- GtkPaned *paned = GTK_PANED(glade_xml_get_widget(xml, "hpaned1"));
- gtk_paned_set_position (paned, (option_toolbar_status_width *
- window_width_guess) / 10000);
+ g->paned = GTK_PANED(glade_xml_get_widget(xml, "hpaned1"));
/* connect the scrollbars to the layout widget */
gtk_layout_set_hadjustment(g->layout,
@@ -699,13 +690,23 @@ gboolean nsgtk_window_keypress_event(GtkWidget *widget, GdkEventKey *event,
}
gboolean nsgtk_window_size_allocate_event(GtkWidget *widget,
- GtkAllocation *allocation, gpointer data)
+ GtkAllocation *allocation, gpointer data)
{
struct gui_window *g = data;
g->bw->reformat_pending = true;
browser_reformat_pending = true;
+ if (g->paned != NULL) {
+ /* Set status bar / scroll bar proportion according to
+ * option_toolbar_status_width */
+ /* TODO: Probably want to detect when the user adjusts the
+ * status bar width, remember that proportion for the
+ * window, and use that here. */
+ gtk_paned_set_position(g->paned, (option_toolbar_status_width *
+ allocation->width) / 10000);
+ }
+
return TRUE;
}