Changes
2 changed files (+31/-4)
-
-
@@ -24,6 +24,7 @@ this.spacing = 8;title_input.activate.connect(this.submit); title_input.hexpand = true; title_input.receives_default = true; this.append(title_input); submit_button.clicked.connect(this.submit);
-
-
-
@@ -12,7 +12,21 @@ namespace TimeTracker.Widget {private class TimerList : Gtk.Box { public signal void stop(Model.Timer timer); public ListModel timers { get; set construct; } public ListModel timers { get; construct; } private Gtk.ListView list = new Gtk.ListView(null, null) { 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);
-
@@ -23,14 +37,26 @@ var factory = new Gtk.SignalListItemFactory();factory.setup.connect(setup); factory.bind.connect(bind); var list = new Gtk.ListView(null, factory); list.hexpand = true; list.hexpand_set = true; list.factory = factory; this.append(list); 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) {
-