diff --git a/Cargo.lock b/Cargo.lock index 5128401..3c04fd4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -976,6 +976,7 @@ checksum = "8fcfdc7a0362c9f4444381a9e697c79d435fe65b52a37466fc2c1184cee9edc6" name = "fitnesstrax" version = "0.1.0" dependencies = [ + "ft-core", "gio", "glib", "glib-build-tools 0.18.0", diff --git a/fitnesstrax/app/Cargo.toml b/fitnesstrax/app/Cargo.toml index 4692329..005fc16 100644 --- a/fitnesstrax/app/Cargo.toml +++ b/fitnesstrax/app/Cargo.toml @@ -7,6 +7,7 @@ edition = "2021" [dependencies] adw = { version = "0.5", package = "libadwaita", features = [ "v1_2" ] } +ft-core = { path = "../core" } gio = { version = "0.18" } glib = { version = "0.18" } gtk = { version = "0.7", package = "gtk4", features = [ "v4_8" ] } diff --git a/fitnesstrax/app/resources/com.luminescent-dreams.fitnesstrax.dev.gschema.xml b/fitnesstrax/app/resources/com.luminescent-dreams.fitnesstrax.dev.gschema.xml new file mode 100644 index 0000000..53d1d41 --- /dev/null +++ b/fitnesstrax/app/resources/com.luminescent-dreams.fitnesstrax.dev.gschema.xml @@ -0,0 +1,9 @@ + + + + + "" + Path to the series + + + diff --git a/fitnesstrax/app/src/main.rs b/fitnesstrax/app/src/main.rs index 3204d89..fdfe8f2 100644 --- a/fitnesstrax/app/src/main.rs +++ b/fitnesstrax/app/src/main.rs @@ -1,7 +1,12 @@ -use fitnesstrax; use gtk::prelude::*; use std::env; +const APP_ID_DEV: &str = "com.luminescent-dreams.fitnesstrax.dev"; +const APP_ID_PROD: &str = "com.luminescent-dreams.fitnesstrax"; + +const RESOURCE_BASE_PATH_DEV: &str = "/com/luminescent-dreams/fitnesstrax/dev/"; +const RESOURCE_BASE_PATH_PROD: &str = "/com/luminescent-dreams/fitnesstrax/"; + struct AppState {} struct AppWindow { @@ -9,11 +14,19 @@ struct AppWindow { } fn main() { - println!("Hello, world!"); + let (app_id, base_path) = if std::env::var_os("ENV") == Some("dev".into()) { + (APP_ID_DEV, RESOURCE_BASE_PATH_DEV) + } else { + (APP_ID_PROD, RESOURCE_BASE_PATH_PROD) + }; + + let settings = gio::Settings::new(app_id); + + println!("database path: {}", settings.string("series-path")); let app = adw::Application::builder() - .application_id("com.luminescent-dreams.fitnesstrax") - .resource_base_path("/com/luminescent-dreams/fitnesstrax") + .application_id(app_id) + .resource_base_path(base_path) .build(); /* diff --git a/flake.nix b/flake.nix index bac9d63..387310c 100644 --- a/flake.nix +++ b/flake.nix @@ -48,6 +48,7 @@ typeshare.packages."x86_64-linux".default ]; LIBCLANG_PATH="${pkgs.llvmPackages.libclang.lib}/lib"; + ENV = "dev"; }; }; }