M shipments_gtk/ui/shipments.glade => shipments_gtk/ui/shipments.glade +2 -1
@@ 618,7 618,7 @@
</packing>
</child>
<child>
- <object class="GtkFlowBox">
+ <object class="GtkFlowBox" id="mainflow">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="column-spacing">10</property>
@@ 626,6 626,7 @@
<property name="max-children-per-line">2</property>
<property name="selection-mode">none</property>
<property name="activate-on-single-click">False</property>
+ <signal name="size-allocate" handler="on_flowbox_resize" swapped="no"/>
<child>
<object class="GtkFlowBoxChild">
<property name="width-request">100</property>
M shipments_gtk/window.py => shipments_gtk/window.py +6 -0
@@ 154,6 154,7 @@ class ShipmentsWindow:
self.searchbox = builder.get_object("searchbox")
self.leaflet = builder.get_object("leaflet")
self.topleaflet = builder.get_object("topleaflet")
+ self.mainflow = builder.get_object("mainflow")
self.back = builder.get_object("back")
self.label_stack = builder.get_object("label_stack")
@@ 553,3 554,8 @@ class ShipmentsWindow:
def on_searchbox_stop_search(self, widget, *args):
widget.set_text('')
self.searchrevealer.set_reveal_child(False)
+
+ def on_flowbox_resize(self, widget, *args):
+ width = widget.get_allocation().width
+ columns = (width // 750) + 1
+ self.mainflow.set_min_children_per_line(columns)