55 lines
2.1 KiB
Rust
55 lines
2.1 KiB
Rust
/*
|
|
Copyright 2024, Savanni D'Gerinel <savanni@luminescent-dreams.com>
|
|
|
|
This file is part of Kifu.
|
|
|
|
Kifu 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.
|
|
|
|
Kifu 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 Kifu. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
use crate::LocalObserver;
|
|
use kifu_core::{Core, CoreNotification};
|
|
|
|
/// DatabaseViewModel controls the view that the user sees when starting the application if the application has been configured and if there are no games in progress. It provides a window into the database, showing a list of recently recorded games (whether from this app or from a main database). It also provides the UI for starting a new game. This will render an empty database view if the user hasn't configured a database yet.
|
|
pub struct DatabaseViewModel {
|
|
core: Core,
|
|
notification_observer: LocalObserver<CoreNotification>,
|
|
widget: gtk::Box,
|
|
}
|
|
|
|
impl DatabaseViewModel {
|
|
fn new(core: Core) -> Self {
|
|
let notification_observer = LocalObserver::new(&core, |msg| {
|
|
println!("DatabaseViewModelHandler called with message: {:?}", msg)
|
|
});
|
|
|
|
Self {
|
|
core,
|
|
notification_observer,
|
|
widget: gtk::Box::new(gtk::Orientation::Horizontal, 0),
|
|
}
|
|
}
|
|
|
|
/// Create a new game with the given parameters.
|
|
fn new_game(&self) {
|
|
unimplemented!()
|
|
}
|
|
|
|
/// Select a game from the database to show in detail. This will require a transition away from this view model into a different one.
|
|
fn select_game(&self) {
|
|
unimplemented!()
|
|
}
|
|
|
|
/// Delete a game from the database.
|
|
fn delete_game(&self) {
|
|
unimplemented!()
|
|
}
|
|
}
|