mirror of
https://github.com/Xetibo/ReSet.git
synced 2025-07-03 08:47:45 +02:00
Big restructuring
This commit is contained in:
parent
c4c95df8d3
commit
13084ed86d
22 changed files with 638 additions and 595 deletions
|
@ -1,46 +1,16 @@
|
|||
use gtk::{CompositeTemplate, glib, ListBox, Switch};
|
||||
use gtk::prelude::*;
|
||||
use gtk::subclass::prelude::*;
|
||||
use crate::components::bluetooth::BluetoothEntry;
|
||||
use adw::glib;
|
||||
use adw::glib::Object;
|
||||
use crate::components::bluetooth::bluetoothBoxImpl;
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
#[derive(Default, CompositeTemplate)]
|
||||
#[template(resource = "/org/Xetibo/ReSet/resetBluetooth.ui")]
|
||||
pub struct BluetoothBox {
|
||||
#[template_child]
|
||||
pub resetBluetoothSwitch: TemplateChild<Switch>,
|
||||
#[template_child]
|
||||
pub resetBluetoothAvailableDevices: TemplateChild<ListBox>,
|
||||
#[template_child]
|
||||
pub resetBluetoothConnectedDevices: TemplateChild<ListBox>,
|
||||
glib::wrapper! {
|
||||
pub struct BluetoothBox(ObjectSubclass<bluetoothBoxImpl::BluetoothBox>)
|
||||
@extends gtk::Box, gtk::Widget,
|
||||
@implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Orientable;
|
||||
}
|
||||
|
||||
#[glib::object_subclass]
|
||||
impl ObjectSubclass for BluetoothBox {
|
||||
const NAME: &'static str = "resetBluetooth";
|
||||
type Type = super::BluetoothBox;
|
||||
type ParentType = gtk::Box;
|
||||
|
||||
fn class_init(klass: &mut Self::Class) {
|
||||
BluetoothEntry::ensure_type();
|
||||
klass.bind_template();
|
||||
impl BluetoothBox {
|
||||
pub fn new() -> Self {
|
||||
Object::builder().build()
|
||||
}
|
||||
|
||||
fn instance_init(obj: &glib::subclass::InitializingObject<Self>) {
|
||||
obj.init_template();
|
||||
}
|
||||
}
|
||||
|
||||
impl ObjectImpl for BluetoothBox {
|
||||
fn constructed(&self) {
|
||||
self.parent_constructed();
|
||||
}
|
||||
}
|
||||
|
||||
impl BoxImpl for BluetoothBox {}
|
||||
|
||||
impl WidgetImpl for BluetoothBox {}
|
||||
|
||||
impl WindowImpl for BluetoothBox {}
|
||||
|
||||
impl ApplicationWindowImpl for BluetoothBox {}
|
||||
}
|
48
src/components/bluetooth/bluetoothBoxImpl.rs
Normal file
48
src/components/bluetooth/bluetoothBoxImpl.rs
Normal file
|
@ -0,0 +1,48 @@
|
|||
use gtk::{CompositeTemplate, glib, ListBox, Switch};
|
||||
use gtk::prelude::*;
|
||||
use gtk::subclass::prelude::*;
|
||||
|
||||
use crate::components::bluetooth::bluetoothBox;
|
||||
use crate::components::bluetooth::bluetoothEntry::BluetoothEntry;
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
#[derive(Default, CompositeTemplate)]
|
||||
#[template(resource = "/org/Xetibo/ReSet/resetBluetooth.ui")]
|
||||
pub struct BluetoothBox {
|
||||
#[template_child]
|
||||
pub resetBluetoothSwitch: TemplateChild<Switch>,
|
||||
#[template_child]
|
||||
pub resetBluetoothAvailableDevices: TemplateChild<ListBox>,
|
||||
#[template_child]
|
||||
pub resetBluetoothConnectedDevices: TemplateChild<ListBox>,
|
||||
}
|
||||
|
||||
#[glib::object_subclass]
|
||||
impl ObjectSubclass for BluetoothBox {
|
||||
const NAME: &'static str = "resetBluetooth";
|
||||
type Type = bluetoothBox::BluetoothBox;
|
||||
type ParentType = gtk::Box;
|
||||
|
||||
fn class_init(klass: &mut Self::Class) {
|
||||
BluetoothEntry::ensure_type();
|
||||
klass.bind_template();
|
||||
}
|
||||
|
||||
fn instance_init(obj: &glib::subclass::InitializingObject<Self>) {
|
||||
obj.init_template();
|
||||
}
|
||||
}
|
||||
|
||||
impl ObjectImpl for BluetoothBox {
|
||||
fn constructed(&self) {
|
||||
self.parent_constructed();
|
||||
}
|
||||
}
|
||||
|
||||
impl BoxImpl for BluetoothBox {}
|
||||
|
||||
impl WidgetImpl for BluetoothBox {}
|
||||
|
||||
impl WindowImpl for BluetoothBox {}
|
||||
|
||||
impl ApplicationWindowImpl for BluetoothBox {}
|
|
@ -1,43 +1,15 @@
|
|||
use gtk::{Button, CompositeTemplate, glib, Image, Label};
|
||||
use gtk::subclass::prelude::*;
|
||||
use adw::glib;
|
||||
use adw::glib::Object;
|
||||
use crate::components::bluetooth::bluetoothEntryImpl;
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
#[derive(Default, CompositeTemplate)]
|
||||
#[template(resource = "/org/Xetibo/ReSet/resetBluetoothEntry.ui")]
|
||||
pub struct BluetoothEntry {
|
||||
#[template_child]
|
||||
pub resetBluetoothDeviceType: TemplateChild<Image>,
|
||||
#[template_child]
|
||||
pub resetBluetoothLabel: TemplateChild<Label>,
|
||||
#[template_child]
|
||||
pub resetBluetoothButton: TemplateChild<Button>,
|
||||
glib::wrapper! {
|
||||
pub struct BluetoothEntry(ObjectSubclass<bluetoothEntryImpl::BluetoothEntry>)
|
||||
@extends gtk::Widget,
|
||||
@implements gtk::Accessible, gtk::Buildable, gtk::Actionable, gtk::ConstraintTarget;
|
||||
}
|
||||
|
||||
#[glib::object_subclass]
|
||||
impl ObjectSubclass for BluetoothEntry {
|
||||
const NAME: &'static str = "resetBluetoothEntry";
|
||||
type Type = super::BluetoothEntry;
|
||||
type ParentType = gtk::ListBoxRow;
|
||||
|
||||
fn class_init(klass: &mut Self::Class) {
|
||||
klass.bind_template();
|
||||
impl BluetoothEntry {
|
||||
pub fn new() -> Self {
|
||||
Object::builder().build()
|
||||
}
|
||||
|
||||
fn instance_init(obj: &glib::subclass::InitializingObject<Self>) {
|
||||
obj.init_template();
|
||||
}
|
||||
}
|
||||
|
||||
impl ObjectImpl for BluetoothEntry {
|
||||
fn constructed(&self) {
|
||||
self.parent_constructed();
|
||||
}
|
||||
}
|
||||
|
||||
impl ListBoxRowImpl for BluetoothEntry {}
|
||||
|
||||
impl WidgetImpl for BluetoothEntry {}
|
||||
|
||||
impl WindowImpl for BluetoothEntry {}
|
||||
|
||||
impl ApplicationWindowImpl for BluetoothEntry {}
|
||||
}
|
44
src/components/bluetooth/bluetoothEntryImpl.rs
Normal file
44
src/components/bluetooth/bluetoothEntryImpl.rs
Normal file
|
@ -0,0 +1,44 @@
|
|||
use gtk::{Button, CompositeTemplate, glib, Image, Label};
|
||||
use gtk::subclass::prelude::*;
|
||||
use crate::components::bluetooth::bluetoothEntry;
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
#[derive(Default, CompositeTemplate)]
|
||||
#[template(resource = "/org/Xetibo/ReSet/resetBluetoothEntry.ui")]
|
||||
pub struct BluetoothEntry {
|
||||
#[template_child]
|
||||
pub resetBluetoothDeviceType: TemplateChild<Image>,
|
||||
#[template_child]
|
||||
pub resetBluetoothLabel: TemplateChild<Label>,
|
||||
#[template_child]
|
||||
pub resetBluetoothButton: TemplateChild<Button>,
|
||||
}
|
||||
|
||||
#[glib::object_subclass]
|
||||
impl ObjectSubclass for BluetoothEntry {
|
||||
const NAME: &'static str = "resetBluetoothEntry";
|
||||
type Type = bluetoothEntry::BluetoothEntry;
|
||||
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 BluetoothEntry {
|
||||
fn constructed(&self) {
|
||||
self.parent_constructed();
|
||||
}
|
||||
}
|
||||
|
||||
impl ListBoxRowImpl for BluetoothEntry {}
|
||||
|
||||
impl WidgetImpl for BluetoothEntry {}
|
||||
|
||||
impl WindowImpl for BluetoothEntry {}
|
||||
|
||||
impl ApplicationWindowImpl for BluetoothEntry {}
|
|
@ -1,30 +1,5 @@
|
|||
#![allow(non_snake_case)]
|
||||
mod bluetoothBox;
|
||||
mod bluetoothEntry;
|
||||
|
||||
use adw::glib::Object;
|
||||
use gtk::{glib};
|
||||
|
||||
glib::wrapper! {
|
||||
pub struct BluetoothBox(ObjectSubclass<bluetoothBox::BluetoothBox>)
|
||||
@extends gtk::Box, gtk::Widget,
|
||||
@implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Orientable;
|
||||
}
|
||||
|
||||
glib::wrapper! {
|
||||
pub struct BluetoothEntry(ObjectSubclass<bluetoothEntry::BluetoothEntry>)
|
||||
@extends gtk::Widget,
|
||||
@implements gtk::Accessible, gtk::Buildable, gtk::Actionable, gtk::ConstraintTarget;
|
||||
}
|
||||
|
||||
impl BluetoothBox {
|
||||
pub fn new() -> Self {
|
||||
Object::builder().build()
|
||||
}
|
||||
}
|
||||
|
||||
impl BluetoothEntry {
|
||||
pub fn new() -> Self {
|
||||
Object::builder().build()
|
||||
}
|
||||
}
|
||||
pub mod bluetoothBox;
|
||||
pub mod bluetoothEntry;
|
||||
pub mod bluetoothBoxImpl;
|
||||
pub mod bluetoothEntryImpl;
|
Loading…
Add table
Add a link
Reference in a new issue