Changes
3 changed files (+78/-13)
-
-
@@ -0,0 +1,34 @@// Copyright 2025 Shota FUJI // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. // // SPDX-License-Identifier: MPL-2.0 using GLib; namespace TimeTracker.Widget { private class ActiveTimersView : Gtk.Box { public Model.Model model { get; construct; } public ActiveTimersView(Model.Model model) { Object(model: model, orientation: Gtk.Orientation.VERTICAL, spacing: 4); } construct { var list = new TimerList(model.active_timers); list.stop.connect((timer) => { model.update(new Event.TimerStopped(timer.id)); }); list.vexpand = true; this.append(list); var form = new NewTimerForm(); form.create.connect((title) => { model.update(new Event.TimerStarted(title)); }); this.append(form); } } }
-
-
-
@@ -0,0 +1,25 @@// Copyright 2025 Shota FUJI // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. // // SPDX-License-Identifier: MPL-2.0 using GLib; namespace TimeTracker.Widget { private class HistoryView : Gtk.Box { public Model.Model model { get; construct; } public HistoryView(Model.Model model) { Object(model: model, orientation: Gtk.Orientation.VERTICAL, spacing: 4); } construct { var list = new TimerList(model.stopped_timers); list.vexpand = true; this.append(list); } } }
-
-
-
@@ -22,22 +22,28 @@var header_bar = new Adw.HeaderBar(); view.add_top_bar(header_bar); var body = new Gtk.Box(VERTICAL, 0); var stack = new Adw.ViewStack(); var list = new TimerList(model.active_timers); list.stop.connect((timer) => { model.update(new Event.TimerStopped(timer.id)); }); list.vexpand = true; body.append(list); stack.add_titled_with_icon( new ActiveTimersView(model), "active_timers", "Timers", "appointment-new-symbolic" ); var form = new NewTimerForm(); form.create.connect((title) => { model.update(new Event.TimerStarted(title)); }); body.append(form); stack.add_titled_with_icon( new HistoryView(model), "history", "History", "view-list-bullet-symbolic" ); view.content = body; var switcher = new Adw.ViewSwitcher(); switcher.stack = stack; header_bar.title_widget = switcher; view.content = stack; this.title = "Time Tracker"; this.content = view;
-