Set up the main application window #122

Merged
savanni merged 3 commits from fitnesstrax/main-window into main 2023-12-19 00:13:08 +00:00
1 changed files with 26 additions and 0 deletions
Showing only changes of commit 0ebdcd7c2a - Show all commits

View File

@ -1,3 +1,18 @@
/*
Copyright 2023, Savanni D'Gerinel <savanni@luminescent-dreams.com>
This file is part of FitnessTrax.
FitnessTrax is free software: you can redistribute it and/or modify it under the terms of the GNU
General Public License as published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
FitnessTrax is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along with FitnessTrax. If not, see <https://www.gnu.org/licenses/>.
*/
use adw::prelude::*;
use emseries::Series;
use ft_core::TraxRecord;
@ -29,6 +44,8 @@ impl App {
}
}
/// This is the view to show if the application has not yet been configured. It will walk the user
/// through the most critical setup steps so that we can move on to the other views in the app.
pub struct UnconfiguredViewPrivate {}
#[glib::object_subclass]
@ -54,6 +71,8 @@ impl UnconfiguredView {
pub fn new() -> Self {
let s: Self = Object::builder().build();
// Replace this with the welcome screen that we set up in the fitnesstrax/unconfigured-page
// branch.
let label = gtk::Label::builder()
.label("Database is not configured.")
.build();
@ -62,6 +81,9 @@ impl UnconfiguredView {
}
}
/// The historical view will show a window into the main database. It will show some version of
/// daily summaries, daily details, and will provide all functions the user may need for editing
/// records.
pub struct HistoricalViewPrivate {}
#[glib::object_subclass]
@ -160,6 +182,10 @@ impl AppWindow {
s
}
// Switch views.
//
// This function only replaces the old view with the one which matches the current view state.
// If there is any other setup/teardown to do, it will handle that as well.
fn redraw(&self) {
match *self.current_view.borrow() {
MainView::Unconfigured(ref view) => self.window.set_content(Some(view)),