diff --git a/Cargo.toml b/Cargo.toml
index 4f8500e..195af2d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,4 +12,5 @@ gtk = { version = "0.8.1", package = "gtk4", features = ["v4_12"] }
rand = "0.8.5"
[build-dependencies]
+dirs = "5.0.1"
glib-build-tools = "0.19.0"
diff --git a/build.rs b/build.rs
index 2fb52ed..19284ad 100644
--- a/build.rs
+++ b/build.rs
@@ -1,4 +1,41 @@
+use dirs;
+use std::process::Command;
+
fn main() {
+ let home = dirs::home_dir().unwrap().to_str().unwrap().to_string();
+
+ if cfg!(target_os = "windows") {
+ Command::new("mkdir")
+ .arg("C:/ProgramData/glib-2.0/schemas/")
+ .spawn()
+ .expect("failed to make dir for schemas!");
+ Command::new("cp")
+ .arg("resources/org.foxarmy.settings.gschema.xml")
+ .arg("C:/ProgramData/glib-2.0/schemas/")
+ .spawn()
+ .expect("failed to copy schema to dest. dir");
+ Command::new("glib-compile-schemas")
+ .arg("C:/ProgramData/glib-2.0/schemas/")
+ .spawn()
+ .expect("Could not compile glib schemas. Probably you don't have glib build tools on your system.");
+ } else {
+ let path = format!("{}/.local/share/glib-2.0/schemas", &home);
+ Command::new("mkdir")
+ .arg("-p")
+ .arg(&path)
+ .spawn()
+ .expect("failed to make dir for schemas!");
+ Command::new("cp")
+ .arg("resources/org.foxarmy.settings.gschema.xml")
+ .arg(&path)
+ .spawn()
+ .expect("failed to copy schema to dest. dir");
+ Command::new("glib-compile-schemas")
+ .arg(path)
+ .spawn()
+ .expect("Could not compile glib schemas. Probably you don't have glib build tools on your system.");
+ };
+
glib_build_tools::compile_resources(
&["resources"],
"resources/resources.gresource.xml",
diff --git a/resources/cards/game/ui.xml b/resources/cards/game/ui.xml
new file mode 100644
index 0000000..e69de29
diff --git a/resources/memory_cards_settings.ui.xml b/resources/cards/settings/ui.xml
similarity index 100%
rename from resources/memory_cards_settings.ui.xml
rename to resources/cards/settings/ui.xml
diff --git a/resources/guessing.ui.xml b/resources/guessing/game/ui.xml
similarity index 100%
rename from resources/guessing.ui.xml
rename to resources/guessing/game/ui.xml
diff --git a/resources/guessing/settings/ui.xml b/resources/guessing/settings/ui.xml
new file mode 100644
index 0000000..e69de29
diff --git a/resources/menu.ui.xml b/resources/menu/ui.xml
similarity index 100%
rename from resources/menu.ui.xml
rename to resources/menu/ui.xml
diff --git a/resources/settings.gschema.xml b/resources/org.foxarmy.settings.gschema.xml
similarity index 100%
rename from resources/settings.gschema.xml
rename to resources/org.foxarmy.settings.gschema.xml
diff --git a/resources/resources.gresource.xml b/resources/resources.gresource.xml
index a27b575..9ce30b4 100644
--- a/resources/resources.gresource.xml
+++ b/resources/resources.gresource.xml
@@ -1,9 +1,14 @@
- menu.ui.xml
- guessing.ui.xml
- settings.gschema.xml
- memory_cards_settings.ui.xml
+ org.foxarmy.settings.gschema.xml
+ menu/ui.xml
+
+ guessing/game/ui.xml
+
+ cards/settings/ui.xml
+
+
+
diff --git a/src/main.rs b/src/main.rs
index f69a43f..c125e77 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -4,19 +4,17 @@ mod ui;
use crate::ui::menu::MenuScene;
+use gio::Settings;
use gtk::{prelude::*, ApplicationWindow};
use gtk::{glib, Application, gio};
const APP_ID: &str = "org.foxarmy.learn-hieroglyph";
-// const APP: Option> = None;//RefCell::new(Application::builder().application_id(APP_ID).build());
-// pub const S: Stack = Stack::new();
+
fn main() -> glib::ExitCode {
+ print!("cargo:rerun-if-changed=build.rs");
gio::resources_register_include!("compiled.gresource")
.expect("Cannot include gresources");
- // APP = Option::from(RefCell::new(Application::builder().application_id(APP_ID).build()));
- // *APP.unwrap().borrow_mut() = Application::builder().application_id(APP_ID).build();
-
let app: Application = Application::builder().application_id(APP_ID).build();
app.connect_activate(test_ui);
@@ -28,8 +26,10 @@ fn main() -> glib::ExitCode {
fn test_ui (app: &Application) {
let window: ApplicationWindow = MenuScene::new(app).into();
+ let settings = Settings::new(APP_ID);
+
+ println!("{}", settings.boolean("is-ktr-enabled"));
+ println!("{}", settings.boolean("is-ktr-enabled"));
+
window.present();
-
- println!("{}", app.windows().len());
-
}
diff --git a/src/ui/cards/edit/imp.rs b/src/ui/cards/edit/imp.rs
new file mode 100644
index 0000000..e69de29
diff --git a/src/ui/cards/edit/mod.rs b/src/ui/cards/edit/mod.rs
new file mode 100644
index 0000000..e69de29
diff --git a/src/ui/cards/game/imp.rs b/src/ui/cards/game/imp.rs
new file mode 100644
index 0000000..e69de29
diff --git a/src/ui/cards/game/mod.rs b/src/ui/cards/game/mod.rs
new file mode 100644
index 0000000..e69de29
diff --git a/src/ui/cards/mod.rs b/src/ui/cards/mod.rs
index ef5de7d..5f68851 100644
--- a/src/ui/cards/mod.rs
+++ b/src/ui/cards/mod.rs
@@ -1,17 +1,3 @@
-mod imp;
-
-use glib::Object;
-use gtk::{gio, glib, Application};
-
-glib::wrapper! {
- pub struct MemoryCardsSetupScene(ObjectSubclass)
- @extends gtk::ApplicationWindow, gtk::Window, gtk::Widget,
- @implements gio::ActionGroup, gio::ActionMap, gtk::Accessible, gtk::Buildable,
- gtk::ConstraintTarget, gtk::Native, gtk::Root, gtk::ShortcutManager;
-}
-
-impl MemoryCardsSetupScene {
- pub fn new(app: &Application) -> Self {
- Object::builder().property("application", app).build()
- }
-}
+pub mod edit;
+pub mod game;
+pub mod settings;
\ No newline at end of file
diff --git a/src/ui/cards/imp.rs b/src/ui/cards/settings/imp.rs
similarity index 86%
rename from src/ui/cards/imp.rs
rename to src/ui/cards/settings/imp.rs
index d508c83..383e859 100644
--- a/src/ui/cards/imp.rs
+++ b/src/ui/cards/settings/imp.rs
@@ -4,7 +4,7 @@ use gtk::{glib, Button, CompositeTemplate};
#[derive(CompositeTemplate, Default)]
-#[template(resource = "/org/foxarmy/learn-hieroglyph/memory_cards_settings.ui.xml")]
+#[template(resource = "/org/foxarmy/learn-hieroglyph/cards/settings/ui.xml")]
pub struct MemoryCardsSetupScene {
#[template_child]
pub edit_button: TemplateChild