From 3e4a55f33faf863fe41355b364c7cb63d2f21060 Mon Sep 17 00:00:00 2001 From: leca Date: Tue, 2 Apr 2024 15:23:56 +0300 Subject: [PATCH] guessing is completed --- resources/guessing/setup/ui.xml | 5 ++++ src/labled_switch/imp.rs | 11 ++++---- src/labled_switch/mod.rs | 11 ++++++-- src/ui/cards/edit/mod.rs | 1 + src/ui/cards/game/mod.rs | 1 + src/ui/cards/mod.rs | 2 +- src/ui/cards/setup/imp.rs | 7 ++--- src/ui/guessing/game/imp.rs | 18 ++++++------ src/ui/guessing/mod.rs | 2 +- src/ui/guessing/setup/imp.rs | 50 +++++++++++++++++++++++++++++---- src/ui/menu/imp.rs | 2 +- src/ui/mod.rs | 25 ++--------------- 12 files changed, 82 insertions(+), 53 deletions(-) diff --git a/resources/guessing/setup/ui.xml b/resources/guessing/setup/ui.xml index 23a59c1..29d42a2 100644 --- a/resources/guessing/setup/ui.xml +++ b/resources/guessing/setup/ui.xml @@ -25,6 +25,11 @@ Enable romaji to kana? + + + Start! + + diff --git a/src/labled_switch/imp.rs b/src/labled_switch/imp.rs index 5789865..eaa7b4f 100644 --- a/src/labled_switch/imp.rs +++ b/src/labled_switch/imp.rs @@ -37,13 +37,14 @@ impl ObjectImpl for LabledSwitch { fn constructed(&self) { self.parent_constructed(); - // let a = LayoutManager:: ; - - // self.obj().set_layout_manager(a); - let l: &Label = self.label_obj.as_ref(); self.obj().bind_property("label_text", l, "label").sync_create().build(); } + + fn dispose(&self) { + self.dispose_template(); + } + } -impl WidgetImpl for LabledSwitch {} \ No newline at end of file +impl WidgetImpl for LabledSwitch { } \ No newline at end of file diff --git a/src/labled_switch/mod.rs b/src/labled_switch/mod.rs index bb069fe..e670f42 100644 --- a/src/labled_switch/mod.rs +++ b/src/labled_switch/mod.rs @@ -1,7 +1,7 @@ mod imp; use glib::Object; -use gtk::{gio, glib}; +use gtk::{gio, glib::{self, subclass::types::ObjectSubclassIsExt}, Label, Switch}; glib::wrapper! { pub struct LabledSwitch(ObjectSubclass) @@ -14,4 +14,11 @@ impl LabledSwitch { pub fn new(label: &String) -> Self { Object::builder().property("label_text", label).build() } -} + + pub fn get_switch(&self) -> &Switch { + self.imp().switch_obj.as_ref() + } + pub fn get_label(&self) -> &Label { + self.imp().label_obj.as_ref() + } +} \ No newline at end of file diff --git a/src/ui/cards/edit/mod.rs b/src/ui/cards/edit/mod.rs index e69de29..8b13789 100644 --- a/src/ui/cards/edit/mod.rs +++ b/src/ui/cards/edit/mod.rs @@ -0,0 +1 @@ + diff --git a/src/ui/cards/game/mod.rs b/src/ui/cards/game/mod.rs index e69de29..8b13789 100644 --- a/src/ui/cards/game/mod.rs +++ b/src/ui/cards/game/mod.rs @@ -0,0 +1 @@ + diff --git a/src/ui/cards/mod.rs b/src/ui/cards/mod.rs index 1c250fd..03ca420 100644 --- a/src/ui/cards/mod.rs +++ b/src/ui/cards/mod.rs @@ -1,3 +1,3 @@ pub mod edit; pub mod game; -pub mod setup; \ No newline at end of file +pub mod setup; diff --git a/src/ui/cards/setup/imp.rs b/src/ui/cards/setup/imp.rs index 383e859..19e7eff 100644 --- a/src/ui/cards/setup/imp.rs +++ b/src/ui/cards/setup/imp.rs @@ -2,14 +2,13 @@ use glib::subclass::InitializingObject; use gtk::subclass::prelude::*; use gtk::{glib, Button, CompositeTemplate}; - #[derive(CompositeTemplate, Default)] #[template(resource = "/org/foxarmy/learn-hieroglyph/cards/settings/ui.xml")] pub struct MemoryCardsSetupScene { #[template_child] pub edit_button: TemplateChild