Set up some of the content of the welcome view

This commit is contained in:
Savanni D'Gerinel 2023-12-18 20:04:55 -05:00
parent acdf9ec150
commit 0dd0a5f7cc
1 changed files with 33 additions and 11 deletions

View File

@ -46,12 +46,12 @@ 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 {}
pub struct WelcomeViewPrivate {}
#[glib::object_subclass]
impl ObjectSubclass for UnconfiguredViewPrivate {
const NAME: &'static str = "UnconfiguredView";
type Type = UnconfiguredView;
impl ObjectSubclass for WelcomeViewPrivate {
const NAME: &'static str = "WelcomeView";
type Type = WelcomeView;
type ParentType = gtk::Box;
fn new() -> Self {
@ -59,24 +59,46 @@ impl ObjectSubclass for UnconfiguredViewPrivate {
}
}
impl ObjectImpl for UnconfiguredViewPrivate {}
impl WidgetImpl for UnconfiguredViewPrivate {}
impl BoxImpl for UnconfiguredViewPrivate {}
impl ObjectImpl for WelcomeViewPrivate {}
impl WidgetImpl for WelcomeViewPrivate {}
impl BoxImpl for WelcomeViewPrivate {}
glib::wrapper! {
pub struct UnconfiguredView(ObjectSubclass<UnconfiguredViewPrivate>) @extends gtk::Box, gtk::Widget;
pub struct WelcomeView(ObjectSubclass<WelcomeViewPrivate>) @extends gtk::Box, gtk::Widget, @implements gtk::Orientable;
}
impl UnconfiguredView {
impl WelcomeView {
pub fn new() -> Self {
let s: Self = Object::builder().build();
s.set_orientation(gtk::Orientation::Vertical);
// 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.")
.label("Welcome to FitnessTrax")
.build();
s.append(&label);
s.append(&gtk::Label::new(Some("Welcome to FitnessTrax. The application has not yet been configured, so I will walk you through that. Let's start out by selecting your database.")));
// The database selection row should be a box that shows a default database path, along with a
// button that triggers a file chooser dialog. Once the dialog returns, the box should be
// updated to reflect the chosen path.
let db_row = gtk::Box::builder()
.orientation(gtk::Orientation::Horizontal)
.build();
db_row.append(
&gtk::Label::builder()
.label("No Path Selected")
.hexpand(true)
.build(),
);
db_row.append(&gtk::Button::builder().label("Select Database").build());
s.append(&db_row);
s.append(&gtk::Button::builder().label("Save Settings").build());
s
}
}
@ -141,7 +163,7 @@ impl AppWindow {
.build();
let current_view = if app.database.read().unwrap().is_none() {
UnconfiguredView::new().upcast()
WelcomeView::new().upcast()
} else {
HistoricalView::new().upcast()
};