From 1fafd10e012bc3bd6646a2e159dd72df5820fb31 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Sat, 24 Aug 2024 05:56:10 +0200
Subject: [PATCH] Improve Browser layout.

---
 browser.py | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/browser.py b/browser.py
index 26b67a4..ac1afc7 100755
--- a/browser.py
+++ b/browser.py
@@ -83,8 +83,13 @@ class Window(Gtk.ApplicationWindow):
         self.list_store = Gio.ListStore(item_type=FileItem)
         self.selection = Gtk.SingleSelection.new(self.list_store)
         factory = Gtk.SignalListItemFactory()
+        factory.connect('setup', lambda _, i: i.set_child(Gtk.Label(xalign=0)))
+        factory.connect('bind',
+                        lambda _, i: i.props.child.set_text(i.props.item.name))
         self.selector = Gtk.ListView(model=self.selection, factory=factory)
-        dir_box.append(self.selector)
+        scrolled = Gtk.ScrolledWindow(child=self.selector, vexpand=True,
+                                      propagate_natural_width=True)
+        dir_box.append(scrolled)
 
         box_outer = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
         box_outer.append(dir_box)
@@ -99,10 +104,6 @@ class Window(Gtk.ApplicationWindow):
         self.max_index = 0
         self.item = None
         self.selection.connect('selection-changed', self.update_selected)
-        factory.connect('setup',
-                        lambda _, i: i.set_child(Gtk.Label()))
-        factory.connect('bind',
-                        lambda _, i: i.props.child.set_text(i.props.item.name))
         query_attrs = 'standard::name,standard::content-type,time::*'
         enumerator = self.dir.enumerate_children(
                 query_attrs, Gio.FileQueryInfoFlags.NONE, None)
@@ -140,6 +141,7 @@ class Window(Gtk.ApplicationWindow):
             self.metadata.props.label = '\n'.join([self.item.full_path]
                                                   + params_strs)
             pic = Gtk.Picture.new_for_filename(self.item.name)
+            pic.props.halign = Gtk.Align.START
             self.viewer.append(pic)
         else:
             self.metadata.props.label = None
-- 
2.30.2