Dynamically add wifientries

Update wifi UI
Increase size of setting
This commit is contained in:
takotori 2023-10-30 09:51:37 +01:00
parent bf1baf5ca3
commit f06a436aed
10 changed files with 197 additions and 71 deletions

View file

@ -1,6 +1,16 @@
use std::cell::RefCell;
use gtk::{Button, CompositeTemplate, glib, Image, Label};
use gtk::subclass::prelude::*;
#[derive(Default, Copy, Clone)]
pub enum WifiStrength {
Excellent,
Ok,
Weak,
#[default]
None,
}
#[allow(non_snake_case)]
#[derive(Default, CompositeTemplate)]
#[template(resource = "/org/Xetibo/ReSet/resetWifiEntry.ui")]
@ -8,9 +18,13 @@ pub struct WifiEntry {
#[template_child]
pub resetWifiStrength: TemplateChild<Image>,
#[template_child]
pub resetWifiEncrypted: TemplateChild<Image>,
#[template_child]
pub resetWifiLabel: TemplateChild<Label>,
#[template_child]
pub resetWifiButton: TemplateChild<Button>,
pub wifiName: RefCell<String>,
pub wifiStrength: RefCell<WifiStrength>,
}
#[glib::object_subclass]
@ -22,7 +36,7 @@ impl ObjectSubclass for WifiEntry {
fn class_init(klass: &mut Self::Class) {
klass.bind_template();
}
fn instance_init(obj: &glib::subclass::InitializingObject<Self>) {
obj.init_template();
}