Set up configuration via gsettings #115
|
@ -976,6 +976,7 @@ checksum = "8fcfdc7a0362c9f4444381a9e697c79d435fe65b52a37466fc2c1184cee9edc6"
|
||||||
name = "fitnesstrax"
|
name = "fitnesstrax"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"ft-core",
|
||||||
"gio",
|
"gio",
|
||||||
"glib",
|
"glib",
|
||||||
"glib-build-tools 0.18.0",
|
"glib-build-tools 0.18.0",
|
||||||
|
|
|
@ -7,6 +7,7 @@ edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
adw = { version = "0.5", package = "libadwaita", features = [ "v1_2" ] }
|
adw = { version = "0.5", package = "libadwaita", features = [ "v1_2" ] }
|
||||||
|
ft-core = { path = "../core" }
|
||||||
gio = { version = "0.18" }
|
gio = { version = "0.18" }
|
||||||
glib = { version = "0.18" }
|
glib = { version = "0.18" }
|
||||||
gtk = { version = "0.7", package = "gtk4", features = [ "v4_8" ] }
|
gtk = { version = "0.7", package = "gtk4", features = [ "v4_8" ] }
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<schemalist>
|
||||||
|
<schema id="com.luminescent-dreams.fitnesstrax.dev" path="/com/luminescent-dreams/fitnesstrax/dev/">
|
||||||
|
<key name="series-path" type="s">
|
||||||
|
<default>""</default>
|
||||||
|
<summary>Path to the series</summary>
|
||||||
|
</key>
|
||||||
|
</schema>
|
||||||
|
</schemalist>
|
|
@ -1,7 +1,12 @@
|
||||||
use fitnesstrax;
|
|
||||||
use gtk::prelude::*;
|
use gtk::prelude::*;
|
||||||
use std::env;
|
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 AppState {}
|
||||||
|
|
||||||
struct AppWindow {
|
struct AppWindow {
|
||||||
|
@ -9,11 +14,19 @@ 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)
|
||||||
|
} 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()
|
let app = adw::Application::builder()
|
||||||
.application_id("com.luminescent-dreams.fitnesstrax")
|
.application_id(app_id)
|
||||||
.resource_base_path("/com/luminescent-dreams/fitnesstrax")
|
.resource_base_path(base_path)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue