aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2022-07-17 13:47:16 +0200
committerPřemysl Eric Janouch <p@janouch.name>2022-07-17 13:47:56 +0200
commit62b1e83541a0d42315227cd2237d230c4a4195a6 (patch)
treeb14001bfab40a299fba9338b840e02d8ef9255fb
parentbd2e929b77b4bbf9eae7b96986fa441380140d92 (diff)
downloadfiv-62b1e83541a0d42315227cd2237d230c4a4195a6.tar.gz
fiv-62b1e83541a0d42315227cd2237d230c4a4195a6.tar.xz
fiv-62b1e83541a0d42315227cd2237d230c4a4195a6.zip
Support horizontal scrolling in the browser
An unlikely situation.
-rw-r--r--fiv-browser.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/fiv-browser.c b/fiv-browser.c
index c1c6a48..cd6c3e3 100644
--- a/fiv-browser.c
+++ b/fiv-browser.c
@@ -193,7 +193,14 @@ relayout(FivBrowser *self, int width)
g_array_free(items, TRUE);
int total_height = y + padding.bottom;
if (self->hadjustment) {
- // TODO(p): Set it to the width. Ideally, bump it to the minimum width.
+ gint minimum_width = 0;
+ gtk_widget_get_preferred_width(widget, &minimum_width, NULL);
+
+ gtk_adjustment_set_lower(self->hadjustment, 0);
+ gtk_adjustment_set_upper(self->hadjustment, MAX(width, minimum_width));
+ gtk_adjustment_set_step_increment(self->hadjustment, width * 0.1);
+ gtk_adjustment_set_page_increment(self->hadjustment, width * 0.9);
+ gtk_adjustment_set_page_size(self->hadjustment, width);
}
if (self->vadjustment) {
gtk_adjustment_set_lower(self->vadjustment, 0);