summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/tab-chrome.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/tab-chrome.c b/src/tab-chrome.c
index cdaa51c..924be33 100644
--- a/src/tab-chrome.c
+++ b/src/tab-chrome.c
@@ -41,6 +41,27 @@ forward_clicked_cb(GtkButton __attribute__((unused)) *toolbutton,
}
static void
+back_forward_scrolled_window_size_allocate_cb(
+ GtkScrolledWindow *scrolled_window,
+ GdkRectangle __attribute__((unused)) *allocation, GtkWidget *child)
+{
+ GtkRequisition child_req;
+ GtkRequisition hscrollbar_req;
+ GtkRequisition vscrollbar_req;
+
+ gtk_widget_get_preferred_size(child, NULL, &child_req);
+ gtk_widget_get_preferred_size(gtk_scrolled_window_get_hscrollbar(
+ scrolled_window), NULL, &hscrollbar_req);
+ gtk_widget_get_preferred_size(gtk_scrolled_window_get_hscrollbar(
+ scrolled_window), NULL, &vscrollbar_req);
+
+ gtk_widget_set_size_request(GTK_WIDGET(scrolled_window),
+ child_req.width + vscrollbar_req.width,
+ child_req.height + hscrollbar_req.height);
+ gtk_widget_queue_resize(GTK_WIDGET(scrolled_window));
+}
+
+static void
back_forward_toggle_button_toggled_cb(GtkToggleButton *toggle_button,
GtkStack *stack)
{
@@ -200,11 +221,19 @@ back_forward_box_button_press_cb(GtkWidget *widget, GdkEvent *event,
++chrome->back_items;
}
+ GtkRequisition min_req, nat_req;
+ gtk_widget_get_preferred_size(list_box, &min_req, &nat_req);
+ g_print("Min req: %dx%d\n", min_req.width, min_req.height);
+ g_print("Nat req: %dx%d\n", nat_req.width, nat_req.height);
+
/* Set up the stack. */
stack = gtk_stack_new();
scrolled_window = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ g_signal_connect(scrolled_window, "size-allocate",
+ G_CALLBACK(back_forward_scrolled_window_size_allocate_cb),
+ list_box);
/* gtk_scrolled_window_set_propagate_natural_width(
GTK_SCROLLED_WINDOW(scrolled_window), TRUE); */
gtk_container_add(GTK_CONTAINER(scrolled_window), list_box);
@@ -212,6 +241,9 @@ back_forward_box_button_press_cb(GtkWidget *widget, GdkEvent *event,
scrolled_window = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ g_signal_connect(scrolled_window, "size-allocate",
+ G_CALLBACK(back_forward_scrolled_window_size_allocate_cb),
+ text_view);
/* gtk_scrolled_window_set_propagate_natural_width(
GTK_SCROLLED_WINDOW(scrolled_window), TRUE); */
gtk_container_add(GTK_CONTAINER(scrolled_window), text_view);