Set up configuration via gsettings #115

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

1
Cargo.lock generated
View File

@ -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",

View File

@ -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" ] }

View File

@ -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>

View File

@ -1,7 +1,11 @@
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/";
struct AppState {} struct AppState {}
struct AppWindow { struct AppWindow {
@ -11,9 +15,16 @@ struct AppWindow {
fn main() { fn main() {
println!("Hello, world!"); println!("Hello, world!");
let app_id = APP_ID_DEV;
let base_path = RESOURCE_BASE_PATH_DEV;
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();
/* /*