mirror of
https://github.com/Xetibo/ReSet.git
synced 2025-07-03 08:47:45 +02:00
Restructure Reset
This commit is contained in:
parent
721e7d3f4e
commit
b3f1bfd59b
16 changed files with 54 additions and 30 deletions
46
src/components/bluetooth/bluetoothBox.rs
Normal file
46
src/components/bluetooth/bluetoothBox.rs
Normal file
|
@ -0,0 +1,46 @@
|
|||
use gtk::{CompositeTemplate, glib, ListBox, Switch};
|
||||
use gtk::prelude::*;
|
||||
use gtk::subclass::prelude::*;
|
||||
use crate::components::bluetooth::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 = super::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 {}
|
43
src/components/bluetooth/bluetoothEntry.rs
Normal file
43
src/components/bluetooth/bluetoothEntry.rs
Normal file
|
@ -0,0 +1,43 @@
|
|||
use gtk::{Button, CompositeTemplate, glib, Image, Label};
|
||||
use gtk::subclass::prelude::*;
|
||||
|
||||
#[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 = super::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 {}
|
30
src/components/bluetooth/mod.rs
Normal file
30
src/components/bluetooth/mod.rs
Normal file
|
@ -0,0 +1,30 @@
|
|||
#![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()
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue