diff --git a/fitnesstrax/app/src/main.rs b/fitnesstrax/app/src/main.rs index dcb3748..e337a81 100644 --- a/fitnesstrax/app/src/main.rs +++ b/fitnesstrax/app/src/main.rs @@ -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) @extends gtk::Box, gtk::Widget; + pub struct WelcomeView(ObjectSubclass) @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(>k::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( + >k::Label::builder() + .label("No Path Selected") + .hexpand(true) + .build(), + ); + db_row.append(>k::Button::builder().label("Select Database").build()); + + s.append(&db_row); + s.append(>k::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() };