Set up configuration via gsettings #115

Merged
savanni merged 2 commits from fitnesstrax/gsettings into main 2023-12-07 15:34:32 +00:00
2 changed files with 8 additions and 5 deletions
Showing only changes of commit a7d6d82ec2 - Show all commits

View File

@ -2,9 +2,10 @@ use gtk::prelude::*;
use std::env; use std::env;
const APP_ID_DEV: &str = "com.luminescent-dreams.fitnesstrax.dev"; const APP_ID_DEV: &str = "com.luminescent-dreams.fitnesstrax.dev";
// const APP_ID_PROD: &str = "com.luminescent-dreams.fitnesstrax"; const APP_ID_PROD: &str = "com.luminescent-dreams.fitnesstrax";
const RESOURCE_BASE_PATH_DEV: &str = "/com/luminescent-dreams/fitnesstrax/dev/"; const RESOURCE_BASE_PATH_DEV: &str = "/com/luminescent-dreams/fitnesstrax/dev/";
const RESOURCE_BASE_PATH_PROD: &str = "/com/luminescent-dreams/fitnesstrax/";
struct AppState {} struct AppState {}
@ -13,10 +14,11 @@ struct AppWindow {
} }
fn main() { 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)
let app_id = APP_ID_DEV; } else {
let base_path = RESOURCE_BASE_PATH_DEV; (APP_ID_PROD, RESOURCE_BASE_PATH_PROD)
};
let settings = gio::Settings::new(app_id); let settings = gio::Settings::new(app_id);

View File

@ -48,6 +48,7 @@
typeshare.packages."x86_64-linux".default typeshare.packages."x86_64-linux".default
]; ];
LIBCLANG_PATH="${pkgs.llvmPackages.libclang.lib}/lib"; LIBCLANG_PATH="${pkgs.llvmPackages.libclang.lib}/lib";
ENV = "dev";
}; };
}; };
} }