From a3f9f47612798f8280ff8886e656130b5af2849b Mon Sep 17 00:00:00 2001 From: Leonhard Date: Sun, 12 Jul 2026 15:02:32 +0200 Subject: [PATCH] ScaleDropDown: Provide a Gtk.Expression instead of a custom factory --- src/Widgets/DisplayWidget.vala | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/Widgets/DisplayWidget.vala b/src/Widgets/DisplayWidget.vala index 75db722f..a2a5567e 100644 --- a/src/Widgets/DisplayWidget.vala +++ b/src/Widgets/DisplayWidget.vala @@ -239,22 +239,10 @@ public class Display.DisplayWidget : Gtk.Box { populate_refresh_rates (); - var scale_drop_down_factory = new Gtk.SignalListItemFactory (); - scale_drop_down_factory.setup.connect ((obj) => { - var list_item = (Gtk.ListItem) obj; - list_item.child = new Gtk.Label (null) { xalign = 0 }; - }); - scale_drop_down_factory.bind.connect ((obj) => { - var list_item = (Gtk.ListItem) obj; - var item = (VirtualMonitor.Scale) list_item.item; - var scale_label = (Gtk.Label) list_item.child; - scale_label.label = item.string_representation; - }); - - scale_drop_down = new Gtk.DropDown (virtual_monitor.available_scales, null) { + var scale_name_expression = new Gtk.PropertyExpression (typeof (VirtualMonitor.Scale), null, "string-representation"); + scale_drop_down = new Gtk.DropDown (virtual_monitor.available_scales, scale_name_expression) { margin_start = 12, margin_end = 12, - factory = scale_drop_down_factory }; virtual_monitor.available_scales.bind_property ("selected", scale_drop_down, "selected", BIDIRECTIONAL | SYNC_CREATE);