some renaming, creating GuessingSetup scene and LabledSwitch
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
pub mod edit;
|
||||
pub mod game;
|
||||
pub mod settings;
|
||||
pub mod setup;
|
||||
@@ -1,2 +1,2 @@
|
||||
pub mod settings;
|
||||
pub mod setup;
|
||||
pub mod game;
|
||||
41
src/ui/guessing/setup/imp.rs
Normal file
41
src/ui/guessing/setup/imp.rs
Normal file
@@ -0,0 +1,41 @@
|
||||
|
||||
use crate::labled_switch::LabledSwitch;
|
||||
|
||||
use glib::subclass::InitializingObject;
|
||||
use gtk::subclass::prelude::*;
|
||||
use gtk::{glib, CompositeTemplate};
|
||||
|
||||
|
||||
#[derive(CompositeTemplate, Default)]
|
||||
#[template(resource = "/org/foxarmy/learn-hieroglyph/guessing/setup/ui.xml")]
|
||||
pub struct GuessingSetupScene {
|
||||
#[template_child]
|
||||
pub question_label: TemplateChild<LabledSwitch>,
|
||||
}
|
||||
|
||||
#[glib::object_subclass]
|
||||
impl ObjectSubclass for GuessingSetupScene {
|
||||
const NAME: &'static str = "GuessingSetupScene";
|
||||
type Type = super::GuessingSetupScene;
|
||||
type ParentType = gtk::ApplicationWindow;
|
||||
|
||||
fn class_init(klass: &mut Self::Class) {
|
||||
klass.bind_template();
|
||||
}
|
||||
|
||||
fn instance_init(obj: &InitializingObject<Self>) {
|
||||
obj.init_template();
|
||||
}
|
||||
}
|
||||
|
||||
impl ObjectImpl for GuessingSetupScene {
|
||||
fn constructed(&self) {
|
||||
self.parent_constructed();
|
||||
}
|
||||
}
|
||||
|
||||
impl WidgetImpl for GuessingSetupScene {}
|
||||
|
||||
impl WindowImpl for GuessingSetupScene {}
|
||||
|
||||
impl ApplicationWindowImpl for GuessingSetupScene {}
|
||||
17
src/ui/guessing/setup/mod.rs
Normal file
17
src/ui/guessing/setup/mod.rs
Normal file
@@ -0,0 +1,17 @@
|
||||
mod imp;
|
||||
|
||||
use glib::Object;
|
||||
use gtk::{gio, glib, Application};
|
||||
|
||||
glib::wrapper! {
|
||||
pub struct GuessingSetupScene(ObjectSubclass<imp::GuessingSetupScene>)
|
||||
@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 GuessingSetupScene {
|
||||
pub fn new(app: &Application) -> Self {
|
||||
Object::builder().property("application", app).build()
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::ui::{guessing::game::GuessingScene, cards::settings::MemoryCardsSetupScene};
|
||||
use crate::ui::{guessing::setup::GuessingSetupScene, cards::setup::MemoryCardsSetupScene};
|
||||
|
||||
use glib::subclass::InitializingObject;
|
||||
use gtk::glib::closure_local;
|
||||
@@ -41,7 +41,7 @@ impl ObjectImpl for MenuScene {
|
||||
"clicked",
|
||||
false,
|
||||
closure_local!(@strong binding => move |_button: &Button| {
|
||||
let new_win: GuessingScene = GuessingScene::new(&binding.application().unwrap());
|
||||
let new_win: GuessingSetupScene = GuessingSetupScene::new(&binding.application().unwrap());
|
||||
new_win.present();
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
pub(crate) mod menu;
|
||||
pub(crate) mod guessing;
|
||||
mod cards;
|
||||
pub mod menu;
|
||||
pub mod guessing;
|
||||
pub mod cards;
|
||||
|
||||
// use crate::ui::menu::build_menu_scene;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user