summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-09-20 16:35:48 (EDT)
committer Patrick McDermott <pj@pehjota.net>2017-09-20 16:35:48 (EDT)
commit22056692ce29110774bf5486214f8b55b5006922 (patch)
tree2b4bb6d8a0ed117cf3b9d61c2b7c397b50fee914 /src
parenta5676333c4e7148f879a4d5210e62801dade127c (diff)
downloadmarquee-22056692ce29110774bf5486214f8b55b5006922.zip
marquee-22056692ce29110774bf5486214f8b55b5006922.tar.gz
marquee-22056692ce29110774bf5486214f8b55b5006922.tar.bz2
src/tab-chrome.c: Try to resize tab history scrolled windows
Doesn't work.
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);