mirror of
https://github.com/Xetibo/ReSet.git
synced 2025-07-26 18:37:45 +02:00
cleanup
This commit is contained in:
parent
60760d779f
commit
a0e3f5fbee
12 changed files with 10 additions and 14 deletions
19
src/components/base/listEntry.rs
Normal file
19
src/components/base/listEntry.rs
Normal file
|
@ -0,0 +1,19 @@
|
|||
use crate::components::base::listEntryImpl;
|
||||
use adw::glib;
|
||||
use adw::glib::{IsA, Object};
|
||||
use gtk::prelude::ListBoxRowExt;
|
||||
use gtk::Widget;
|
||||
|
||||
glib::wrapper! {
|
||||
pub struct ListEntry(ObjectSubclass<listEntryImpl::ListEntry>)
|
||||
@extends gtk::ListBoxRow, gtk::Widget,
|
||||
@implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Actionable;
|
||||
}
|
||||
|
||||
impl ListEntry {
|
||||
pub fn new(child: &impl IsA<Widget>) -> Self {
|
||||
let entry: ListEntry = Object::builder().build();
|
||||
entry.set_child(Some(child));
|
||||
entry
|
||||
}
|
||||
}
|
37
src/components/base/listEntryImpl.rs
Normal file
37
src/components/base/listEntryImpl.rs
Normal file
|
@ -0,0 +1,37 @@
|
|||
use gtk::{CompositeTemplate, glib};
|
||||
use gtk::subclass::prelude::*;
|
||||
use crate::components::base::listEntry;
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
#[derive(Default, CompositeTemplate)]
|
||||
#[template(resource = "/org/Xetibo/ReSet/resetListBoxRow.ui")]
|
||||
pub struct ListEntry {}
|
||||
|
||||
#[glib::object_subclass]
|
||||
impl ObjectSubclass for ListEntry {
|
||||
const NAME: &'static str = "resetListBoxRow";
|
||||
type Type = listEntry::ListEntry;
|
||||
type ParentType = gtk::ListBoxRow;
|
||||
|
||||
fn class_init(klass: &mut Self::Class) {
|
||||
klass.bind_template();
|
||||
}
|
||||
|
||||
fn instance_init(obj: &glib::subclass::InitializingObject<Self>) {
|
||||
obj.init_template();
|
||||
}
|
||||
}
|
||||
|
||||
impl ObjectImpl for ListEntry {
|
||||
fn constructed(&self) {
|
||||
self.parent_constructed();
|
||||
}
|
||||
}
|
||||
|
||||
impl ListBoxRowImpl for ListEntry {}
|
||||
|
||||
impl WidgetImpl for ListEntry {}
|
||||
|
||||
impl WindowImpl for ListEntry {}
|
||||
|
||||
impl ApplicationWindowImpl for ListEntry {}
|
4
src/components/base/mod.rs
Normal file
4
src/components/base/mod.rs
Normal file
|
@ -0,0 +1,4 @@
|
|||
pub mod settingBox;
|
||||
pub mod settingBoxImpl;
|
||||
pub mod listEntry;
|
||||
pub mod listEntryImpl;
|
19
src/components/base/settingBox.rs
Normal file
19
src/components/base/settingBox.rs
Normal file
|
@ -0,0 +1,19 @@
|
|||
use crate::components::base::settingBoxImpl;
|
||||
use adw::glib;
|
||||
use adw::glib::{IsA, Object};
|
||||
use gtk::prelude::BoxExt;
|
||||
use gtk::Widget;
|
||||
|
||||
glib::wrapper! {
|
||||
pub struct SettingBox(ObjectSubclass<settingBoxImpl::SettingBox>)
|
||||
@extends gtk::Box, gtk::Widget,
|
||||
@implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Orientable;
|
||||
}
|
||||
|
||||
impl SettingBox {
|
||||
pub fn new(child: &impl IsA<Widget>) -> Self {
|
||||
let entry: SettingBox = Object::builder().build();
|
||||
entry.append(child);
|
||||
entry
|
||||
}
|
||||
}
|
37
src/components/base/settingBoxImpl.rs
Normal file
37
src/components/base/settingBoxImpl.rs
Normal file
|
@ -0,0 +1,37 @@
|
|||
use gtk::{CompositeTemplate, glib};
|
||||
use gtk::subclass::prelude::*;
|
||||
use crate::components::base::settingBox;
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
#[derive(Default, CompositeTemplate)]
|
||||
#[template(resource = "/org/Xetibo/ReSet/resetSettingBox.ui")]
|
||||
pub struct SettingBox {}
|
||||
|
||||
#[glib::object_subclass]
|
||||
impl ObjectSubclass for SettingBox {
|
||||
const NAME: &'static str = "resetSetting";
|
||||
type Type = settingBox::SettingBox;
|
||||
type ParentType = gtk::Box;
|
||||
|
||||
fn class_init(klass: &mut Self::Class) {
|
||||
klass.bind_template();
|
||||
}
|
||||
|
||||
fn instance_init(obj: &glib::subclass::InitializingObject<Self>) {
|
||||
obj.init_template();
|
||||
}
|
||||
}
|
||||
|
||||
impl ObjectImpl for SettingBox {
|
||||
fn constructed(&self) {
|
||||
self.parent_constructed();
|
||||
}
|
||||
}
|
||||
|
||||
impl BoxImpl for SettingBox {}
|
||||
|
||||
impl WidgetImpl for SettingBox {}
|
||||
|
||||
impl WindowImpl for SettingBox {}
|
||||
|
||||
impl ApplicationWindowImpl for SettingBox {}
|
Loading…
Add table
Add a link
Reference in a new issue