breadcrumb wip

This commit is contained in:
takotori 2023-11-18 10:00:37 +01:00
parent ed00b26749
commit 022082b725
20 changed files with 391 additions and 125 deletions

View file

@ -20,6 +20,7 @@ tokio = { version = "1.33.0", features = [
"sync",
] }
fork = "0.1.22"
once_cell = "1.18.0"
[build-dependencies]
glib-build-tools = "0.18.0"

View file

@ -0,0 +1,66 @@
use adw::glib;
use adw::glib::Object;
use glib::{closure_local, ObjectExt, PropertyGet};
use glib::subclass::prelude::ObjectSubclassIsExt;
use gtk::Label;
use gtk::prelude::{BoxExt, WidgetExt};
use crate::components::breadcrumb::{breadcrumbImpl, CustomButton};
use crate::components::breadcrumb::breadcrumbItem::BreadcrumbItem;
glib::wrapper! {
pub struct Breadcrumb(ObjectSubclass<breadcrumbImpl::Breadcrumb>)
@extends gtk::Box, gtk::Widget,
@implements gtk::Accessible, gtk::Buildable, gtk::Actionable, gtk::ConstraintTarget;
}
impl Breadcrumb {
pub fn new() -> Self {
Object::builder().build()
}
pub fn resetAndSet(&self, name : &str) {
let selfImp = self.imp();
loop {
let option = selfImp.resetBox.last_child();
match option {
None => break,
Some(last) => selfImp.resetBox.remove(&last)
}
}
*selfImp.items.borrow_mut() = 0;
self.pushBreadcrumb(name);
}
pub fn pushBreadcrumb(&self, name: &str) {
let selfImp = self.imp();
let button = CustomButton::new();
button.connect_closure("max-number-reached",
false,
closure_local!(move |_button: CustomButton, number: i32| {
println!("The maximum number {} has been reached", number);
}));
let mut items = selfImp.items.borrow_mut();
if *items != 0 {
selfImp.resetBox.append(&Label::new(Some(">")));
};
*items += 1;
selfImp.resetBox.append(&BreadcrumbItem::new(name));
selfImp.resetBox.append(&button);
}
pub fn popBreadcrumb(&self) {
let selfImp = self.imp();
for _ in 0..2 {
let option = selfImp.resetBox.last_child();
match option {
None => break,
Some(last) => selfImp.resetBox.remove(&last)
}
}
}
}

View file

@ -0,0 +1,61 @@
use std::cell::{Cell, RefCell};
use glib::{Properties, StaticType, StaticTypeExt};
use glib::subclass::Signal;
use gtk::subclass::prelude::*;
use gtk::{glib, CompositeTemplate};
use once_cell::sync::Lazy;
use gtk::prelude::*;
use crate::components::breadcrumb::breadcrumb;
use crate::components::breadcrumb::breadcrumbItem::BreadcrumbItem;
#[allow(non_snake_case)]
#[derive(Properties, Default, CompositeTemplate)]
#[properties(wrapper_type = breadcrumb::Breadcrumb)]
#[template(resource = "/org/Xetibo/ReSet/resetBreadcrumb.ui")]
pub struct Breadcrumb {
#[template_child]
pub resetBox: TemplateChild<gtk::Box>,
pub items: RefCell<i32>,
#[property(get, set)]
number2: Cell<i32>,
}
#[glib::object_subclass]
impl ObjectSubclass for Breadcrumb {
const NAME: &'static str = "resetBreadcrumb";
type Type = breadcrumb::Breadcrumb;
type ParentType = gtk::Box;
fn class_init(klass: &mut Self::Class) {
BreadcrumbItem::ensure_type();
klass.bind_template();
}
fn instance_init(obj: &glib::subclass::InitializingObject<Self>) {
obj.init_template();
}
}
#[glib::derived_properties]
impl ObjectImpl for Breadcrumb {
fn signals () -> &'static [Signal] {
static SIGNALS: Lazy<Vec<Signal>> = Lazy::new(|| {
vec![Signal::builder("max-number-reached")
.param_types([i32::static_type()])
.build()]
});
SIGNALS.as_ref()
}
fn constructed(&self) {
self.parent_constructed();
}
}
impl BoxImpl for Breadcrumb {}
impl WidgetImpl for Breadcrumb {}
impl WindowImpl for Breadcrumb {}
impl ApplicationWindowImpl for Breadcrumb {}

View file

@ -0,0 +1,21 @@
use crate::components::breadcrumb::breadcrumbItemImpl;
use adw::glib;
use adw::glib::Object;
use glib::subclass::prelude::ObjectSubclassIsExt;
use gtk::prelude::ButtonExt;
glib::wrapper! {
pub struct BreadcrumbItem(ObjectSubclass<breadcrumbItemImpl::BreadcrumbItem>)
@extends gtk::Box, gtk::Widget,
@implements gtk::Accessible, gtk::Buildable, gtk::Actionable, gtk::ConstraintTarget;
}
impl BreadcrumbItem {
pub fn new(name : &str) -> Self {
let entry: BreadcrumbItem = Object::builder().build();
let entryImp = entry.imp();
entryImp.resetBreadcrumbButtonName.set_label(name);
entry
}
}

View file

@ -0,0 +1,40 @@
use gtk::subclass::prelude::*;
use gtk::{glib, CompositeTemplate, Button};
use crate::components::breadcrumb::breadcrumbItem;
#[allow(non_snake_case)]
#[derive(Default, CompositeTemplate)]
#[template(resource = "/org/Xetibo/ReSet/resetBreadcrumbItem.ui")]
pub struct BreadcrumbItem {
#[template_child]
pub resetBreadcrumbButtonName: TemplateChild<Button>,
}
#[glib::object_subclass]
impl ObjectSubclass for BreadcrumbItem {
const NAME: &'static str = "resetBreadcrumbItem";
type Type = breadcrumbItem::BreadcrumbItem;
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 BreadcrumbItem {
fn constructed(&self) {
self.parent_constructed();
}
}
impl BoxImpl for BreadcrumbItem {}
impl WidgetImpl for BreadcrumbItem {}
impl WindowImpl for BreadcrumbItem {}
impl ApplicationWindowImpl for BreadcrumbItem {}

View file

@ -0,0 +1,5 @@
#![allow(non_snake_case)]
pub mod breadcrumb;
pub mod breadcrumbImpl;
pub mod breadcrumbItem;
pub mod breadcrumbItemImpl;

View file

@ -3,4 +3,5 @@ pub mod wifi;
pub mod bluetooth;
pub mod output;
mod base;
mod input;
mod input;
mod breadcrumb;

View file

@ -1,35 +1,39 @@
use std::collections::HashMap;
use std::rc::Rc;
use std::sync::Arc;
use std::sync::atomic::Ordering;
use std::sync::mpsc::{channel, Receiver, Sender};
use std::sync::Arc;
use std::thread;
use std::time::Duration;
use crate::components::base::listEntry::ListEntry;
use crate::components::base::utils::Listeners;
use adw::glib;
use adw::{ApplicationWindow, glib};
use adw::glib::Object;
use adw::prelude::ListBoxRowExt;
use adw::prelude::{ListBoxRowExt, ListModelExtManual, NavigationPageExt};
use adw::subclass::prelude::ObjectSubclassIsExt;
use dbus::arg::{AppendAll, ReadAll, RefArg};
use dbus::blocking::Connection;
use dbus::Error;
use dbus::Path;
use gtk::gio;
use glib::{clone, ObjectExt, StaticType};
use gtk::{Button, gio, ListBoxRow};
use gtk::gio::ActionEntry;
use gtk::glib::Variant;
use gtk::prelude::ActionableExt;
use ReSet_Lib::network::connection::Connection as ResetConnection;
use ReSet_Lib::network::network::AccessPoint;
use ReSet_Lib::signals::AccessPointRemoved;
use ReSet_Lib::signals::{AccessPointAdded, GetVal};
use ReSet_Lib::signals::AccessPointRemoved;
use ReSet_Lib::utils::Events;
use crate::components::base::listEntry::ListEntry;
use crate::components::base::utils::Listeners;
use crate::components::breadcrumb::breadcrumb;
use crate::components::breadcrumb::breadcrumb::Breadcrumb;
use crate::components::wifi::wifiBoxImpl;
use crate::components::wifi::wifiEntry::WifiEntry;
use super::savedWifiEntry::SavedWifiEntry;
use ReSet_Lib::network::connection::Connection as ResetConnection;
glib::wrapper! {
pub struct WifiBox(ObjectSubclass<wifiBoxImpl::WifiBox>)
@extends gtk::Box, gtk::Widget,
@ -40,8 +44,14 @@ unsafe impl Send for WifiBox {}
unsafe impl Sync for WifiBox {}
impl WifiBox {
pub fn new() -> Self {
Object::builder().build()
pub fn new(resetPath: Option<Breadcrumb>) -> Self {
let object: WifiBox = Object::builder().build();
object
.imp()
.breadcrumb
.replace(Some(Rc::new(resetPath.unwrap())));
object.setupCallbacks();
object
}
pub fn setupCallbacks(&self) {
@ -53,6 +63,28 @@ impl WifiBox {
.resetSavedNetworks
.set_action_target_value(Some(&Variant::from("saved")));
let sadf:i32 = 2312;
// self.emit_by_name::<()>("max-number-reached", &[&sadf]);
// let builder1 = Signal::builder("custom").action();
// let signal = builder1.build();
//
// Breadcrumb::new().emit_by_name::<()>("max-number-reached", &[&sadf]);
selfImp
.resetWifiNav
.connect_popped(clone!(@ weak selfImp => move |x, y| {
let o = x.visible_page();
selfImp.breadcrumb.borrow().clone().unwrap().popBreadcrumb();
}));
selfImp.resetWifiNav.connect_pushed(clone!(@ weak selfImp => move |x| {
let o = x.visible_page();
selfImp.breadcrumb.borrow().clone().unwrap().pushBreadcrumb(o.unwrap().tag().unwrap().as_str());
}));
selfImp
.resetAvailableNetworks
.set_action_name(Some("navigation.pop"));

View file

@ -1,17 +1,27 @@
use std::cell::{RefCell};
use std::collections::HashMap;
use std::rc::Rc;
use std::sync::{Arc, Mutex};
use adw::NavigationView;
use glib::Properties;
use glib::subclass::Signal;
use gtk::{CompositeTemplate, glib, ListBox, Switch};
use gtk::prelude::*;
use gtk::subclass::prelude::*;
use once_cell::sync::Lazy;
use crate::components::wifi::wifiBox;
use crate::components::wifi::wifiEntry::WifiEntry;
use crate::components::base::listEntry::ListEntry;
use crate::components::breadcrumb::breadcrumb;
use crate::components::breadcrumb::breadcrumb::Breadcrumb;
#[allow(non_snake_case)]
#[derive(Default, CompositeTemplate)]
#[template(resource = "/org/Xetibo/ReSet/resetWiFi.ui")]
pub struct WifiBox {
#[template_child]
pub resetWifiNav: TemplateChild<NavigationView>,
#[template_child]
pub resetWifiDetails: TemplateChild<ListBox>,
#[template_child]
@ -24,8 +34,9 @@ pub struct WifiBox {
pub resetStoredWifiList: TemplateChild<ListBox>,
#[template_child]
pub resetAvailableNetworks: TemplateChild<ListEntry>,
pub wifiEntries: Arc<Mutex<HashMap<Vec<u8>,Arc<ListEntry>>>>,
pub wifiEntries: Arc<Mutex<HashMap<Vec<u8>, Arc<ListEntry>>>>,
pub savedWifiEntries: Arc<Mutex<Vec<ListEntry>>>,
pub breadcrumb: RefCell<Option<Rc<Breadcrumb>>>,
}
unsafe impl Send for WifiBox {}
@ -51,9 +62,6 @@ impl ObjectSubclass for WifiBox {
impl ObjectImpl for WifiBox {
fn constructed(&self) {
self.parent_constructed();
let obj = self.obj();
obj.setupCallbacks();
}
}

View file

@ -1,3 +1,4 @@
use std::rc::Rc;
use gtk::prelude::FrameExt;
use std::sync::atomic::Ordering;
use std::sync::Arc;
@ -10,56 +11,65 @@ use crate::components::output::audioBox::{populate_streams, AudioBox, populate_s
use crate::components::wifi::wifiBox::{scanForWifi, show_stored_connections, WifiBox};
use gtk::prelude::WidgetExt;
use gtk::{FlowBox, Frame, Label};
use crate::components::breadcrumb::breadcrumb;
use crate::components::breadcrumb::breadcrumb::Breadcrumb;
use crate::components::breadcrumb::breadcrumbItem::BreadcrumbItem;
pub const HANDLE_CONNECTIVITY_CLICK: fn(Arc<Listeners>, FlowBox) =
|listeners: Arc<Listeners>, resetMain: FlowBox| {
pub const HANDLE_CONNECTIVITY_CLICK: fn(Arc<Listeners>, FlowBox, Breadcrumb) =
|listeners: Arc<Listeners>, resetMain: FlowBox, resetPath: Breadcrumb| {
listeners.pulse_listener.store(false, Ordering::SeqCst);
let wifiBox = Arc::new(WifiBox::new());
resetPath.resetAndSet("Connectivity");
let wifiBox = Arc::new(WifiBox::new(Some(resetPath)));
show_stored_connections(wifiBox.clone());
scanForWifi(listeners.clone(), wifiBox.clone());
let wifiFrame = wrapInFrame(SettingBox::new(&*wifiBox));
let bluetoothFrame = wrapInFrame(SettingBox::new(&BluetoothBox::new()));
resetMain.remove_all();
resetMain.insert(&wifiFrame, -1);
resetMain.insert(&bluetoothFrame, -1);
resetMain.set_max_children_per_line(2);
};
pub const HANDLE_WIFI_CLICK: fn(Arc<Listeners>, FlowBox) =
|listeners: Arc<Listeners>, resetMain: FlowBox| {
pub const HANDLE_WIFI_CLICK: fn(Arc<Listeners>, FlowBox, Breadcrumb) =
|listeners: Arc<Listeners>, resetMain: FlowBox, resetPath: Breadcrumb| {
listeners.bluetooth_listener.store(false, Ordering::SeqCst);
listeners.pulse_listener.store(false, Ordering::SeqCst);
let wifiBox = Arc::new(WifiBox::new());
resetPath.resetAndSet("WiFi");
let wifiBox = Arc::new(WifiBox::new(Some(resetPath)));
scanForWifi(listeners.clone(), wifiBox.clone());
let wifiFrame = wrapInFrame(SettingBox::new(&*wifiBox));
resetMain.remove_all();
resetMain.insert(&wifiFrame, -1);
resetMain.set_max_children_per_line(1);
};
pub const HANDLE_BLUETOOTH_CLICK: fn(Arc<Listeners>, FlowBox) =
|listeners: Arc<Listeners>, resetMain: FlowBox| {
pub const HANDLE_BLUETOOTH_CLICK: fn(Arc<Listeners>, FlowBox, Breadcrumb) =
|listeners: Arc<Listeners>, resetMain: FlowBox, resetPath: Breadcrumb| {
listeners.stop_network_listener();
listeners.pulse_listener.store(false, Ordering::SeqCst);
let bluetoothFrame = wrapInFrame(SettingBox::new(&BluetoothBox::new()));
resetPath.resetAndSet("Bluetooth");
resetMain.remove_all();
resetMain.insert(&bluetoothFrame, -1);
resetMain.set_max_children_per_line(1);
};
pub const HANDLE_VPN_CLICK: fn(Arc<Listeners>, FlowBox) =
|listeners: Arc<Listeners>, resetMain: FlowBox| {
pub const HANDLE_VPN_CLICK: fn(Arc<Listeners>, FlowBox, Breadcrumb) =
|listeners: Arc<Listeners>, resetMain: FlowBox, resetPath: Breadcrumb| {
listeners.stop_network_listener();
listeners.bluetooth_listener.store(false, Ordering::SeqCst);
listeners.pulse_listener.store(false, Ordering::SeqCst);
let label = Label::new(Some("not implemented yet"));
resetPath.resetAndSet("VPN");
resetMain.remove_all();
resetMain.insert(&label, -1);
resetMain.set_max_children_per_line(1);
};
pub const HANDLE_AUDIO_CLICK: fn(Arc<Listeners>, FlowBox) =
|listeners: Arc<Listeners>, resetMain: FlowBox| {
pub const HANDLE_AUDIO_CLICK: fn(Arc<Listeners>, FlowBox, Breadcrumb) =
|listeners: Arc<Listeners>, resetMain: FlowBox, resetPath: Breadcrumb| {
listeners.stop_network_listener();
listeners.bluetooth_listener.store(false, Ordering::SeqCst);
listeners.pulse_listener.store(true, Ordering::SeqCst);
@ -68,14 +78,15 @@ pub const HANDLE_AUDIO_CLICK: fn(Arc<Listeners>, FlowBox) =
populate_sinks(audioOutput.clone());
let audioFrame = wrapInFrame(SettingBox::new(&*audioOutput));
let sourceFrame = wrapInFrame(SettingBox::new(&SourceBox::new()));
resetPath.resetAndSet("Audio");
resetMain.remove_all();
resetMain.insert(&audioFrame, -1);
resetMain.insert(&sourceFrame, -1);
resetMain.set_max_children_per_line(2);
};
pub const HANDLE_VOLUME_CLICK: fn(Arc<Listeners>, FlowBox) =
|listeners: Arc<Listeners>, resetMain: FlowBox| {
pub const HANDLE_VOLUME_CLICK: fn(Arc<Listeners>, FlowBox, Breadcrumb) =
|listeners: Arc<Listeners>, resetMain: FlowBox, resetPath: Breadcrumb| {
listeners.stop_network_listener();
listeners.bluetooth_listener.store(false, Ordering::SeqCst);
listeners.pulse_listener.store(false, Ordering::SeqCst);
@ -83,72 +94,79 @@ pub const HANDLE_VOLUME_CLICK: fn(Arc<Listeners>, FlowBox) =
populate_streams(listeners.clone(), audioOutput.clone());
populate_sinks(audioOutput.clone());
let audioFrame = wrapInFrame(SettingBox::new(&*audioOutput));
resetPath.resetAndSet("Output");
resetMain.remove_all();
resetMain.insert(&audioFrame, -1);
resetMain.set_max_children_per_line(1);
};
pub const HANDLE_MICROPHONE_CLICK: fn(Arc<Listeners>, FlowBox) =
|listeners: Arc<Listeners>, resetMain: FlowBox| {
pub const HANDLE_MICROPHONE_CLICK: fn(Arc<Listeners>, FlowBox, Breadcrumb) =
|listeners: Arc<Listeners>, resetMain: FlowBox, resetPath: Breadcrumb| {
listeners.stop_network_listener();
listeners.bluetooth_listener.store(false, Ordering::SeqCst);
listeners.pulse_listener.store(false, Ordering::SeqCst);
let sourceFrame = wrapInFrame(SettingBox::new(&SourceBox::new()));
resetPath.resetAndSet("Input");
resetMain.remove_all();
resetMain.insert(&sourceFrame, -1);
resetMain.set_max_children_per_line(1);
};
pub const HANDLE_PERIPHERALS_CLICK: fn(Arc<Listeners>, FlowBox) =
|listeners: Arc<Listeners>, resetMain: FlowBox| {
pub const HANDLE_PERIPHERALS_CLICK: fn(Arc<Listeners>, FlowBox, Breadcrumb) =
|listeners: Arc<Listeners>, resetMain: FlowBox, resetPath: Breadcrumb| {
listeners.stop_network_listener();
listeners.bluetooth_listener.store(false, Ordering::SeqCst);
listeners.pulse_listener.store(false, Ordering::SeqCst);
let label = Label::new(Some("not implemented yet"));
resetPath.resetAndSet("Peripherals");
resetMain.remove_all();
resetMain.insert(&label, -1);
resetMain.set_max_children_per_line(1);
};
pub const HANDLE_MONITOR_CLICK: fn(Arc<Listeners>, FlowBox) =
|listeners: Arc<Listeners>, resetMain: FlowBox| {
pub const HANDLE_MONITOR_CLICK: fn(Arc<Listeners>, FlowBox, Breadcrumb) =
|listeners: Arc<Listeners>, resetMain: FlowBox, resetPath: Breadcrumb| {
listeners.stop_network_listener();
listeners.bluetooth_listener.store(false, Ordering::SeqCst);
listeners.pulse_listener.store(false, Ordering::SeqCst);
let label = Label::new(Some("not implemented yet"));
resetPath.resetAndSet("Monitor");
resetMain.remove_all();
resetMain.insert(&label, -1);
resetMain.set_max_children_per_line(1);
};
pub const HANDLE_MOUSE_CLICK: fn(Arc<Listeners>, FlowBox) =
|listeners: Arc<Listeners>, resetMain: FlowBox| {
pub const HANDLE_MOUSE_CLICK: fn(Arc<Listeners>, FlowBox, Breadcrumb) =
|listeners: Arc<Listeners>, resetMain: FlowBox, resetPath: Breadcrumb| {
listeners.stop_network_listener();
listeners.bluetooth_listener.store(false, Ordering::SeqCst);
listeners.pulse_listener.store(false, Ordering::SeqCst);
let label = Label::new(Some("not implemented yet"));
resetPath.resetAndSet("Mouse");
resetMain.remove_all();
resetMain.insert(&label, -1);
resetMain.set_max_children_per_line(1);
};
pub const HANDLE_KEYBOARD_CLICK: fn(Arc<Listeners>, FlowBox) =
|listeners: Arc<Listeners>, resetMain: FlowBox| {
pub const HANDLE_KEYBOARD_CLICK: fn(Arc<Listeners>, FlowBox, Breadcrumb) =
|listeners: Arc<Listeners>, resetMain: FlowBox, resetPath: Breadcrumb| {
listeners.stop_network_listener();
listeners.bluetooth_listener.store(false, Ordering::SeqCst);
listeners.pulse_listener.store(false, Ordering::SeqCst);
let label = Label::new(Some("not implemented yet"));
resetPath.resetAndSet("Keyboard");
resetMain.remove_all();
resetMain.insert(&label, -1);
resetMain.set_max_children_per_line(1);
};
pub const HANDLE_HOME: fn(Arc<Listeners>, FlowBox) =
|listeners: Arc<Listeners>, resetMain: FlowBox| {
pub const HANDLE_HOME: fn(Arc<Listeners>, FlowBox, Breadcrumb) =
|listeners: Arc<Listeners>, resetMain: FlowBox, resetPath: Breadcrumb| {
listeners.stop_network_listener();
listeners.network_listener.store(false, Ordering::SeqCst);
listeners.bluetooth_listener.store(false, Ordering::SeqCst);
listeners.pulse_listener.store(false, Ordering::SeqCst);
resetPath.resetAndSet("Home");
resetMain.remove_all();
};

View file

@ -5,6 +5,8 @@ use glib::Object;
use gtk::{FlowBox, glib};
use gtk::prelude::*;
use crate::components::base::utils::Listeners;
use crate::components::breadcrumb::breadcrumb;
use crate::components::breadcrumb::breadcrumb::Breadcrumb;
use crate::components::window::sidebarEntryImpl;
use crate::components::window::sidebarEntryImpl::{Categories, SidebarAction};
@ -20,7 +22,7 @@ impl SidebarEntry {
iconName: &str,
category: Categories,
isSubcategory: bool,
clickEvent: fn(Arc<Listeners>, FlowBox),
clickEvent: fn(Arc<Listeners>, FlowBox, Breadcrumb),
) -> Self {
let entry: SidebarEntry = Object::builder().build();
let entryImp = entry.imp();

View file

@ -6,6 +6,8 @@ use gtk::{CompositeTemplate, FlowBox, glib, Image, Label, ListBoxRow};
use gtk::subclass::prelude::*;
use crate::components::base::utils::Listeners;
use crate::components::breadcrumb::breadcrumb;
use crate::components::breadcrumb::breadcrumb::Breadcrumb;
use crate::components::window::handleSidebarClick::HANDLE_HOME;
use crate::components::window::sidebarEntry;
@ -34,7 +36,7 @@ pub struct SidebarEntry {
#[allow(non_snake_case)]
pub struct SidebarAction {
pub onClickEvent: fn(Arc<Listeners>,FlowBox),
pub onClickEvent: fn(Arc<Listeners>, FlowBox, Breadcrumb),
}
impl Default for SidebarAction {

View file

@ -1,10 +1,13 @@
use adw::BreakpointCondition;
use adw::glib::clone;
use adw::subclass::prelude::ObjectSubclassIsExt;
use adw::BreakpointCondition;
use glib::Object;
use glib::{closure_local, Object};
use gtk::{Application, gio, glib, ListBoxRow, Orientation};
use gtk::prelude::*;
use gtk::{gio, glib, Application, ListBoxRow, Orientation};
use crate::components::breadcrumb::breadcrumb;
use crate::components::breadcrumb::breadcrumb::Breadcrumb;
use crate::components::wifi::wifiBox::WifiBox;
use crate::components::window::handleSidebarClick::*;
use crate::components::window::sidebarEntry::SidebarEntry;
use crate::components::window::sidebarEntryImpl::Categories;
@ -29,6 +32,19 @@ impl Window {
pub fn setupCallback(&self) {
let selfImp = self.imp();
selfImp.resetPath.connect_closure("max-number-reached", false, closure_local!(move |x : Breadcrumb, y : i32| {
print!("askdfj");
}));
let sadf:i32 = 2312;
Breadcrumb::new().emit_by_name::<()>("max-number-reached", &[&sadf]);
let breadcrumb= Breadcrumb::new();
breadcrumb.emit_by_name::<()>("max-number-reached", &[&sadf]);
selfImp
.resetSearchEntry
.connect_search_changed(clone!(@ weak self as window => move |_| {
@ -45,7 +61,7 @@ impl Window {
clone!(@ weak selfImp as flowbox => move |_, y| {
let result = y.downcast_ref::<SidebarEntry>().unwrap();
let clickEvent = result.imp().onClickEvent.borrow().onClickEvent;
(clickEvent)(flowbox.listeners.clone(), flowbox.resetMain.get());
(clickEvent)(flowbox.listeners.clone(), flowbox.resetMain.get(), flowbox.resetPath.get());
}),
);
@ -54,11 +70,6 @@ impl Window {
.connect_clicked(clone!(@ weak self as window => move |_| {
window.close();
}));
// selfImp.resetMenu.connect_clicked(|_| {
// WifiBox::donotdisturb();
//
// });
}
pub fn handleDynamicSidebar(&self) {

View file

@ -6,10 +6,12 @@ use adw::subclass::prelude::AdwApplicationWindowImpl;
use adw::{Breakpoint, OverlaySplitView};
use glib::subclass::InitializingObject;
use gtk::subclass::prelude::*;
use gtk::{glib, Box, Button, CompositeTemplate, FlowBox, ListBox, PopoverMenu, SearchEntry};
use gtk::{glib, Button, CompositeTemplate, FlowBox, ListBox, PopoverMenu, SearchEntry};
use crate::APP_ID;
use crate::components::base::utils::Listeners;
use crate::components::wifi::wifiBox::WifiBox;
use crate::components::breadcrumb::breadcrumb;
use crate::components::breadcrumb::breadcrumb::Breadcrumb;
use crate::components::window::sidebarEntry::SidebarEntry;
use crate::components::window::window;
@ -30,7 +32,7 @@ pub struct Window {
#[template_child]
pub resetSideBarToggle: TemplateChild<Button>,
#[template_child]
pub resetPath: TemplateChild<Box>,
pub resetPath: TemplateChild<Breadcrumb>,
#[template_child]
pub resetPopoverMenu: TemplateChild<PopoverMenu>,
#[template_child]
@ -55,7 +57,7 @@ impl ObjectSubclass for Window {
type ParentType = adw::ApplicationWindow;
fn class_init(klass: &mut Self::Class) {
WifiBox::ensure_type();
Breadcrumb::ensure_type();
klass.bind_template();
}

View file

@ -0,0 +1,14 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Created with Cambalache 0.17.0 -->
<interface>
<requires lib="gtk" version="4.0"/>
<template class="resetBreadcrumb" parent="GtkBox">
<property name="halign">start</property>
<property name="hexpand">True</property>
<property name="hexpand-set">True</property>
<property name="valign">center</property>
<child>
<object class="GtkBox" id="resetBox"/>
</child>
</template>
</interface>

View file

@ -0,0 +1,15 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Created with Cambalache 0.17.0 -->
<interface>
<requires lib="gtk" version="4.12"/>
<template class="resetBreadcrumbItem" parent="GtkBox">
<property name="halign">start</property>
<property name="valign">start</property>
<child>
<object class="GtkButton" id="resetBreadcrumbButtonName">
<property name="has-frame">False</property>
<property name="label">Home</property>
</object>
</child>
</template>
</interface>

View file

@ -24,6 +24,12 @@
<child>
<object class="GtkBox">
<property name="valign">start</property>
<child>
<object class="GtkButton" id="resetSideBarToggle">
<property name="icon-name">sidebar-show-symbolic</property>
<property name="visible">False</property>
</object>
</child>
<child>
<object class="GtkButton" id="resetBack">
<property name="has-frame">False</property>
@ -31,12 +37,6 @@
<property name="valign">start</property>
</object>
</child>
<child>
<object class="GtkButton" id="resetSideBarToggle">
<property name="icon-name">sidebar-show-symbolic</property>
<property name="visible">False</property>
</object>
</child>
<child>
<object class="GtkButton" id="resetForward">
<property name="has-frame">False</property>
@ -45,40 +45,7 @@
</object>
</child>
<child>
<object class="GtkBox" id="resetPath">
<property name="halign">start</property>
<property name="hexpand">True</property>
<property name="hexpand-set">True</property>
<property name="valign">center</property>
<child>
<object class="GtkButton">
<property name="has-frame">False</property>
<property name="label">Home</property>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">&gt;</property>
</object>
</child>
<child>
<object class="GtkButton">
<property name="has-frame">False</property>
<property name="label">WiFi</property>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">&gt;</property>
</object>
</child>
<child>
<object class="GtkButton">
<property name="has-frame">False</property>
<property name="label">Advanced</property>
</object>
</child>
</object>
<object class="resetBreadcrumb" id="resetPath"/>
</child>
<child>
<object class="GtkMenuButton">

View file

@ -15,7 +15,9 @@
(14,3,None,"resetSettingBox.ui",None,None,None,None,None,None,None),
(15,1,None,"resetListBoxRow.ui",None,None,None,None,None,None,None),
(16,6,None,"resetPopup.ui",None,None,None,None,None,None,None),
(17,1,None,"resetSavedWifiEntry.ui",None,None,None,None,None,None,None)
(17,1,None,"resetSavedWifiEntry.ui",None,None,None,None,None,None,None),
(18,1,None,"resetBreadcrumb.ui",None,None,None,None,None,None,None),
(19,1,None,"resetBreadcrumbItem.ui",None,None,None,None,None,None,None)
</ui>
<object>
(3,1,"AdwApplicationWindow","resetUI",None,None,None,None,-1," &lt;child&gt;\n &lt;object id=\"resetSidebarBreakpoint\" class=\"AdwBreakpoint\"&gt;\n &lt;/object&gt;\n &lt;/child&gt;"),
@ -27,12 +29,11 @@
(3,20,"GtkSearchEntry","resetSearchEntry",19,None,None,None,None,None),
(3,24,"GtkWindowHandle",None,3,None,None,None,None,None),
(3,25,"GtkBox",None,24,None,None,None,None,None),
(3,26,"GtkButton","resetSideBarToggle",25,None,None,None,1,None),
(3,27,"GtkButton","resetBack",25,None,None,None,None,None),
(3,26,"GtkButton","resetSideBarToggle",25,None,None,None,None,None),
(3,27,"GtkButton","resetBack",25,None,None,None,1,None),
(3,28,"GtkButton","resetForward",25,None,None,None,2,None),
(3,31,"GtkButton","resetClose",25,None,None,None,5,None),
(3,33,"GtkMenuButton",None,25,None,None,None,4,None),
(3,34,"GtkBox","resetPath",25,None,None,None,3,None),
(3,35,"GtkPopoverMenu","resetPopoverMenu",33,None,None,None,-1,None),
(3,36,"GtkBox",None,35,None,None,None,-1,None),
(3,38,"GtkButton","resetPreferenceButton",36,None,None,None,1,None),
@ -43,14 +44,10 @@
(3,43,"GtkScrolledWindow",None,3,None,None,None,1,None),
(3,44,"GtkViewport",None,43,None,None,None,None,None),
(3,45,"GtkFlowBox","resetMain",44,None,None,None,None,None),
(3,46,"GtkButton",None,34,None,None,None,None,None),
(3,47,"GtkButton",None,34,None,None,None,2,None),
(3,48,"GtkButton",None,34,None,None,None,4,None),
(3,49,"GtkLabel",None,34,None,None,None,1,None),
(3,50,"GtkLabel",None,34,None,None,None,3,None),
(3,51,"GtkButton","resetShortcutsButton",36,None,None,None,None,None),
(3,52,"resetBreadcrumb","resetPath",25,None,None,None,3,None),
(4,7,"GtkBox","resetWifi",None,None,None,None,None,None),
(4,152,"AdwNavigationView",None,7,None,None,None,1,None),
(4,152,"AdwNavigationView","resetWifiNav",7,None,None,None,1,None),
(4,153,"AdwNavigationPage",None,152,None,None,None,None,None),
(4,154,"GtkBox",None,153,None,None,None,None,None),
(4,155,"GtkListBox","resetWifiDetails",154,None,None,None,1,None),
@ -62,7 +59,7 @@
(4,174,"AdwNavigationPage",None,152,None,None,None,2,None),
(4,175,"GtkBox",None,174,None,None,None,None,None),
(4,178,"GtkListBox","resetStoredWifiList",175,None,None,None,2,None),
(4,182,"GtkBox",None,7,None,None,None,None,None),
(4,182,"GtkBox","resetContent",7,None,None,None,None,None),
(4,183,"GtkLabel",None,182,None,None,None,None,None),
(4,184,"GtkSwitch","resetWifiSwitch",182,None,None,None,1,None),
(4,185,"GtkListBox",None,175,None,None,None,None,None),
@ -71,7 +68,7 @@
(4,188,"GtkLabel",None,187,None,None,None,None,None),
(4,189,"GtkImage",None,187,None,None,None,1,None),
(4,190,"GtkLabel",None,175,None,None,None,1,None),
(4,191,"resetListBoxRow",None,155,None,None,None,1,None),
(4,191,"resetListBoxRow",None,155,None,None,None,None,None),
(4,192,"GtkBox",None,191,None,None,None,None,None),
(4,193,"GtkLabel",None,192,None,None,None,None,None),
(4,194,"GtkDropDown","resetWiFiDevice",192,None,None,None,1,None),
@ -79,6 +76,7 @@
(4,196,"GtkBox",None,195,None,None,None,None,None),
(4,197,"GtkLabel",None,196,None,None,None,None,None),
(4,198,"GtkImage",None,196,None,None,None,1,None),
(4,199,"resetBreadcrumb","asdf",182,None,None,None,-1,None),
(5,2,"GtkBox","resetWifiEntry",None,None,None,None,None,None),
(5,3,"GtkBox",None,2,None,None,None,None,None),
(5,4,"GtkImage","resetWifiStrength",3,None,None,None,None,None),
@ -225,7 +223,11 @@
(17,1,"GtkBox","resetSavedWifiEntry",None,None,None,None,-1,None),
(17,2,"GtkLabel","resetSavedWifiLabel",1,None,None,None,None,None),
(17,3,"GtkButton","resetEditSavedWifiButton",1,None,None,None,1,None),
(17,4,"GtkButton","resetDeleteSavedWifiButton",1,None,None,None,2,None)
(17,4,"GtkButton","resetDeleteSavedWifiButton",1,None,None,None,2,None),
(18,1,"GtkBox","resetBreadcrumb",None,None,None,None,None,None),
(18,2,"GtkBox","resetBox",1,None,None,None,-1,None),
(19,1,"GtkBox","resetBreadcrumbItem",None,None,None,None,-1,None),
(19,2,"GtkButton","resetBreadcrumbButtonName",1,None,None,None,None,None)
</object>
<object_property>
(3,1,"GtkWidget","height-request","200",None,None,None,None,None,None,None,None,None),
@ -268,10 +270,6 @@
(3,33,"GtkWidget","hexpand-set","True",None,None,None,None,None,None,None,None,None),
(3,33,"GtkWidget","valign","end",None,None,None,None,None,None,None,None,None),
(3,33,"GtkWidget","vexpand","True",None,None,None,None,None,None,None,None,None),
(3,34,"GtkWidget","halign","start",None,None,None,None,None,None,None,None,None),
(3,34,"GtkWidget","hexpand","True",None,None,None,None,None,None,None,None,None),
(3,34,"GtkWidget","hexpand-set","True",None,None,None,None,None,None,None,None,None),
(3,34,"GtkWidget","valign","center",None,None,None,None,None,None,None,None,None),
(3,35,"GtkPopover","child",None,None,None,None,None,36,None,None,None,None),
(3,36,"GtkOrientable","orientation","vertical",None,None,None,None,None,None,None,None,None),
(3,38,"GtkButton","has-frame","False",None,None,None,None,None,None,None,None,None),
@ -292,14 +290,6 @@
(3,45,"GtkWidget","hexpand-set","True",None,None,None,None,None,None,None,None,None),
(3,45,"GtkWidget","margin-top","5",None,None,None,None,None,None,None,None,None),
(3,45,"GtkWidget","valign","start",None,None,None,None,None,None,None,None,None),
(3,46,"GtkButton","has-frame","False",None,None,None,None,None,None,None,None,None),
(3,46,"GtkButton","label","Home",None,None,None,None,None,None,None,None,None),
(3,47,"GtkButton","has-frame","False",None,None,None,None,None,None,None,None,None),
(3,47,"GtkButton","label","WiFi",None,None,None,None,None,None,None,None,None),
(3,48,"GtkButton","has-frame","False",None,None,None,None,None,None,None,None,None),
(3,48,"GtkButton","label","Advanced",None,None,None,None,None,None,None,None,None),
(3,49,"GtkLabel","label","&gt;",None,None,None,None,None,None,None,None,None),
(3,50,"GtkLabel","label","&gt;",None,None,None,None,None,None,None,None,None),
(3,51,"GtkButton","has-frame","False",None,None,None,None,None,None,None,None,None),
(3,51,"GtkButton","label","Shortcuts",None,None,None,None,None,None,None,None,None),
(4,7,"GtkOrientable","orientation","vertical",None,None,None,None,None,None,None,None,None),
@ -714,7 +704,15 @@
(17,3,"GtkWidget","halign","end",None,None,None,None,None,None,None,None,None),
(17,3,"GtkWidget","hexpand","True",None,None,None,None,None,None,None,None,None),
(17,4,"GtkButton","has-frame","False",None,None,None,None,None,None,None,None,None),
(17,4,"GtkButton","icon-name","user-trash-symbolic",None,None,None,None,None,None,None,None,None)
(17,4,"GtkButton","icon-name","user-trash-symbolic",None,None,None,None,None,None,None,None,None),
(18,1,"GtkWidget","halign","start",None,None,None,None,None,None,None,None,None),
(18,1,"GtkWidget","hexpand","True",None,None,None,None,None,None,None,None,None),
(18,1,"GtkWidget","hexpand-set","True",None,None,None,None,None,None,None,None,None),
(18,1,"GtkWidget","valign","center",None,None,None,None,None,None,None,None,None),
(19,1,"GtkWidget","halign","start",None,None,None,None,None,None,None,None,None),
(19,1,"GtkWidget","valign","start",None,None,None,None,None,None,None,None,None),
(19,2,"GtkButton","has-frame","False",None,None,None,None,None,None,None,None,None),
(19,2,"GtkButton","label","Home",None,None,None,None,None,None,None,None,None)
</object_property>
<object_data>
(3,42,"GtkWidget",1,1,None,None,None,None,None,None),

View file

@ -9,7 +9,7 @@
<property name="orientation">vertical</property>
<property name="valign">start</property>
<child>
<object class="GtkBox">
<object class="GtkBox" id="resetContent">
<property name="height-request">40</property>
<child>
<object class="GtkLabel">
@ -30,7 +30,7 @@
</object>
</child>
<child>
<object class="AdwNavigationView">
<object class="AdwNavigationView" id="resetWifiNav">
<child>
<object class="AdwNavigationPage">
<property name="tag">main</property>

View file

@ -4,6 +4,8 @@
<file compressed="true" preprocess="xml-stripblanks">resetMainWindow.ui</file>
<file compressed="true" preprocess="xml-stripblanks">resetSidebarEntry.ui</file>
<file compressed="true" preprocess="xml-stripblanks">resetSettingBox.ui</file>
<file compressed="true" preprocess="xml-stripblanks">resetBreadcrumb.ui</file>
<file compressed="true" preprocess="xml-stripblanks">resetBreadcrumbItem.ui</file>
<file compressed="true" preprocess="xml-stripblanks">resetListBoxRow.ui</file>
<file compressed="true" preprocess="xml-stripblanks">resetWiFi.ui</file>
<file compressed="true" preprocess="xml-stripblanks">resetWifiEntry.ui</file>