home · contact · privacy
Improve Browser layout.
authorChristian Heller <c.heller@plomlompom.de>
Sat, 24 Aug 2024 03:56:10 +0000 (05:56 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Sat, 24 Aug 2024 03:56:10 +0000 (05:56 +0200)
browser.py

index 26b67a415d81498a0cee93192707956a295c98b5..ac1afc781852e02ce890282de3716406a41d87f2 100755 (executable)
@@ -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