Set up the bare minimum of a GUI app, opening only a single window

This commit is contained in:
Savanni D'Gerinel 2023-11-19 22:47:36 -05:00
parent f034dfcb8b
commit 0ac9bb74a6
4 changed files with 66 additions and 1 deletions

7
Cargo.lock generated
View File

@ -976,8 +976,15 @@ name = "fitnesstrax"
version = "0.1.0"
dependencies = [
"chrono",
"chrono-tz",
"dimensioned 0.8.0",
"emseries",
"gio",
"glib",
"glib-build-tools 0.18.0",
"gtk4",
"libadwaita",
"tokio",
]
[[package]]

View File

@ -5,7 +5,26 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
name = "fitnesstrax"
path = "src/lib.rs"
[[bin]]
name = "fitnesstrax"
path = "src/main.rs"
[dependencies]
adw = { version = "0.5", package = "libadwaita", features = [ "v1_2" ] }
chrono = { version = "0.4" }
dimensioned = {version = "0.8" }
chrono-tz = { version = "0.8" }
dimensioned = { version = "0.8" }
emseries = { path = "../emseries" }
gio = { version = "0.18" }
glib = { version = "0.18" }
gtk = { version = "0.7", package = "gtk4", features = [ "v4_8" ] }
tokio = { version = "1.34", features = [ "full" ] }
[build-dependencies]
glib-build-tools = "0.18"

View File

@ -1,3 +1,38 @@
use fitnesstrax;
use gtk::prelude::*;
use std::env;
struct AppState {}
struct AppWindow {
window: adw::ApplicationWindow,
}
fn main() {
println!("Hello, world!");
let app = adw::Application::builder()
.application_id("com.luminescent-dreams.fitnesstrax")
.resource_base_path("/com/luminescent-dreams/fitnesstrax")
.build();
/*
let runtime = tokio::runtime::Builder::new_multi_thread()
.enable_all()
.build()
.unwrap();
*/
let app = adw::Application::builder()
.application_id("com.luminescent-dreams.fitnesstrax")
.resource_base_path("/com/luminescent-dreams/fitnesstrax")
.build();
app.connect_activate(move |app| {
let window = adw::ApplicationWindow::new(app);
window.present();
});
let args: Vec<String> = env::args().collect();
ApplicationExtManual::run_with_args(&app, &args);
}

View File

@ -1,3 +1,7 @@
use chrono::NaiveDate;
use dimensioned::si;
use emseries::DateTimeTz;
/// SetRep represents workouts like pushups or situps, which involve doing a "set" of a number of
/// actions, resting, and then doing another set.
pub struct SetRep {