mirror of
https://github.com/Xetibo/ReSet.git
synced 2025-07-01 15:57:46 +02:00
Add title and border to settingbox
Fix padding around window Add some styling
This commit is contained in:
parent
179a2b44cc
commit
9f3815476d
12 changed files with 313 additions and 258 deletions
|
@ -1,19 +1,21 @@
|
|||
use crate::components::base::settingBoxImpl;
|
||||
use adw::glib;
|
||||
use adw::glib::{IsA, Object};
|
||||
use gtk::prelude::BoxExt;
|
||||
use glib::subclass::prelude::ObjectSubclassIsExt;
|
||||
use gtk::prelude::FrameExt;
|
||||
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;
|
||||
@extends gtk::Frame, gtk::Widget,
|
||||
@implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget;
|
||||
}
|
||||
|
||||
impl SettingBox {
|
||||
pub fn new(child: &impl IsA<Widget>) -> Self {
|
||||
pub fn new(child: &impl IsA<Widget>, title: &str) -> Self {
|
||||
let entry: SettingBox = Object::builder().build();
|
||||
entry.append(child);
|
||||
entry.set_child(Some(child));
|
||||
entry.imp().resetSettingLabel.set_text(title);
|
||||
entry
|
||||
}
|
||||
}
|
|
@ -1,17 +1,20 @@
|
|||
use gtk::{CompositeTemplate, glib};
|
||||
use gtk::{CompositeTemplate, glib, Label};
|
||||
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 {}
|
||||
pub struct SettingBox {
|
||||
#[template_child]
|
||||
pub resetSettingLabel: TemplateChild<Label>,
|
||||
}
|
||||
|
||||
#[glib::object_subclass]
|
||||
impl ObjectSubclass for SettingBox {
|
||||
const NAME: &'static str = "resetSetting";
|
||||
const NAME: &'static str = "resetSettingFrame";
|
||||
type Type = settingBox::SettingBox;
|
||||
type ParentType = gtk::Box;
|
||||
type ParentType = gtk::Frame;
|
||||
|
||||
fn class_init(klass: &mut Self::Class) {
|
||||
klass.bind_template();
|
||||
|
@ -28,7 +31,7 @@ impl ObjectImpl for SettingBox {
|
|||
}
|
||||
}
|
||||
|
||||
impl BoxImpl for SettingBox {}
|
||||
impl FrameImpl for SettingBox {}
|
||||
|
||||
impl WidgetImpl for SettingBox {}
|
||||
|
||||
|
|
|
@ -10,12 +10,10 @@ use adw::subclass::prelude::ObjectSubclassIsExt;
|
|||
use dbus::blocking::Connection;
|
||||
use dbus::Error;
|
||||
use dbus::Path;
|
||||
use gtk::glib::{clone, Variant};
|
||||
use gtk::glib::Variant;
|
||||
use gtk::prelude::ActionableExt;
|
||||
use ReSet_Lib::network::network::{AccessPoint, WifiStrength};
|
||||
use ReSet_Lib::signals::{
|
||||
AccessPointAdded, AccessPointRemoved, BluetoothDeviceAdded, BluetoothDeviceRemoved,
|
||||
};
|
||||
use ReSet_Lib::network::network::AccessPoint;
|
||||
use ReSet_Lib::signals::{AccessPointAdded, AccessPointRemoved};
|
||||
use ReSet_Lib::utils::Events;
|
||||
|
||||
use crate::components::wifi::wifiBoxImpl;
|
||||
|
@ -38,12 +36,8 @@ impl WifiBox {
|
|||
pub fn setupCallbacks(&self) {
|
||||
let selfImp = self.imp();
|
||||
|
||||
selfImp
|
||||
.resetSavedNetworks
|
||||
.set_action_name(Some("navigation.push"));
|
||||
selfImp
|
||||
.resetSavedNetworks
|
||||
.set_action_target_value(Some(&Variant::from("saved")));
|
||||
selfImp.resetWifiSwitchRow.set_action_name(Some("navigation.push"));
|
||||
selfImp.resetWifiSwitchRow.set_action_target_value(Some(&Variant::from("saved")))
|
||||
}
|
||||
|
||||
pub fn donotdisturb() {
|
||||
|
|
|
@ -9,8 +9,8 @@ use crate::components::wifi::wifiBox::{WifiBox, scanForWifi};
|
|||
pub const HANDLE_CONNECTIVITY_CLICK: fn(FlowBox) = |resetMain: FlowBox| {
|
||||
let wifiBox = Arc::new(WifiBox::new());
|
||||
scanForWifi(wifiBox.clone());
|
||||
let wifiBox = SettingBox::new(&*wifiBox);
|
||||
let bluetoothBox = SettingBox::new(&BluetoothBox::new());
|
||||
let wifiBox = SettingBox::new(&*wifiBox, "WiFi");
|
||||
let bluetoothBox = SettingBox::new(&BluetoothBox::new(), "Bluetooth");
|
||||
resetMain.remove_all();
|
||||
resetMain.insert(&wifiBox, -1);
|
||||
resetMain.insert(&bluetoothBox, -1);
|
||||
|
@ -18,14 +18,16 @@ pub const HANDLE_CONNECTIVITY_CLICK: fn(FlowBox) = |resetMain: FlowBox| {
|
|||
};
|
||||
|
||||
pub const HANDLE_WIFI_CLICK: fn(FlowBox) = |resetMain: FlowBox| {
|
||||
let wifiBox = SettingBox::new(&WifiBox::new());
|
||||
let wifiBox = Arc::new(WifiBox::new());
|
||||
scanForWifi(wifiBox.clone());
|
||||
let wifiBox = SettingBox::new(&*wifiBox, "WiFi");
|
||||
resetMain.remove_all();
|
||||
resetMain.insert(&wifiBox, -1);
|
||||
resetMain.set_max_children_per_line(1);
|
||||
};
|
||||
|
||||
pub const HANDLE_BLUETOOTH_CLICK: fn(FlowBox) = |resetMain: FlowBox| {
|
||||
let bluetoothBox = SettingBox::new(&BluetoothBox::new());
|
||||
let bluetoothBox = SettingBox::new(&BluetoothBox::new(), "Bluetooth");
|
||||
resetMain.remove_all();
|
||||
resetMain.insert(&bluetoothBox, -1);
|
||||
resetMain.set_max_children_per_line(1);
|
||||
|
@ -39,14 +41,14 @@ pub const HANDLE_VPN_CLICK: fn(FlowBox) = |resetMain: FlowBox| {
|
|||
};
|
||||
|
||||
pub const HANDLE_AUDIO_CLICK: fn(FlowBox) = |resetMain: FlowBox| {
|
||||
let audioBox = AudioBox::new();
|
||||
let audioBox = SettingBox::new(&AudioBox::new(), "Audio");
|
||||
resetMain.remove_all();
|
||||
resetMain.insert(&audioBox, -1);
|
||||
resetMain.set_max_children_per_line(1);
|
||||
};
|
||||
|
||||
pub const HANDLE_VOLUME_CLICK: fn(FlowBox) = |resetMain: FlowBox| {
|
||||
let audioBox = AudioBox::new();
|
||||
let audioBox = SettingBox::new(&AudioBox::new(), "Audio");
|
||||
resetMain.remove_all();
|
||||
resetMain.insert(&audioBox, -1);
|
||||
resetMain.set_max_children_per_line(1);
|
||||
|
@ -59,10 +61,6 @@ pub const HANDLE_MICROPHONE_CLICK: fn(FlowBox) = |resetMain: FlowBox| {
|
|||
resetMain.set_max_children_per_line(1);
|
||||
};
|
||||
|
||||
pub const HANDLE_HOME: fn(FlowBox) = |resetMain: FlowBox| {
|
||||
resetMain.remove_all();
|
||||
};
|
||||
|
||||
pub const HANDLE_PERIPHERALS_CLICK: fn(FlowBox) = |resetMain: FlowBox| {
|
||||
let label = Label::new(Some("not implemented yet"));
|
||||
resetMain.remove_all();
|
||||
|
@ -90,3 +88,7 @@ pub const HANDLE_KEYBOARD_CLICK: fn(FlowBox) = |resetMain: FlowBox| {
|
|||
resetMain.insert(&label, -1);
|
||||
resetMain.set_max_children_per_line(1);
|
||||
};
|
||||
|
||||
pub const HANDLE_HOME: fn(FlowBox) = |resetMain: FlowBox| {
|
||||
resetMain.remove_all();
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue