Changes
3 changed files (+27/-28)
-
-
@@ -14,17 +14,33 @@ public Model.Model model { get; construct; }private NewTimerForm form = new NewTimerForm(); private Adw.StatusPage empty = new Adw.StatusPage() { title = "No active timers", description = "Type timer name in to bottom input and press start", hexpand = true, hexpand_set = true, vexpand = true, // This widget steals focus. sensitive = false, }; private Gtk.ScrolledWindow body = new Gtk.ScrolledWindow() { vexpand = true, }; public ActiveTimersView(Model.Model model) { Object(model: model, orientation: Gtk.Orientation.VERTICAL, spacing: 4); } construct { this.append(body); this.append(empty); var list = new TimerList(model.active_timers); list.stop.connect((timer) => { model.update(new Event.TimerStopped(timer.id)); }); list.vexpand = true; this.append(list); body.child = list; form.create.connect((title) => { model.update(new Event.TimerStarted(title));
-
@@ -38,7 +54,10 @@ on_item_count_changed();} private void on_item_count_changed() { form.primary = model.active_timers.n_items == 0; var has_items = model.active_timers.get_n_items() > 0; form.primary = !has_items; body.visible = has_items; empty.visible = !has_items; } } }
-
-
-
@@ -17,10 +17,13 @@ Object(model: model, orientation: Gtk.Orientation.VERTICAL, spacing: 4);} construct { var list = new TimerList(model.stopped_timers) { var scrollable = new Gtk.ScrolledWindow() { vexpand = true, }; this.append(list); this.append(scrollable); var list = new TimerList(model.stopped_timers); scrollable.child = list; } } }
-
-
-
@@ -19,15 +19,6 @@ hexpand = true,hexpand_set = true, }; private Adw.StatusPage empty = new Adw.StatusPage() { title = "No active timers", description = "Type timer name in to bottom input and press start", hexpand = true, hexpand_set = true, // This widget steals focus. sensitive = false, }; public TimerList(ListModel timers) { Object(timers: timers); }
-
@@ -43,20 +34,6 @@this.bind_property("timers", list, "model", SYNC_CREATE, (_binding, from, ref to) => { to = new Gtk.NoSelection((ListModel) from); }); this.append(empty); timers.items_changed.connect(() => { sync_visibility(); }); sync_visibility(); } private void sync_visibility() { var has_items = timers.get_n_items() > 0; list.visible = has_items; empty.visible = !has_items; } private void setup(Gtk.ListItemFactory _factory, Object object) {
-