From 15a5333cc0205bb84cce5597ab8dbdcf9d1e40f5 Mon Sep 17 00:00:00 2001 From: takotori Date: Thu, 2 Nov 2023 17:00:10 +0100 Subject: [PATCH] Add peripherals in sidebar --- src/components/window/handleSidebarClick.rs | 24 +++++++++++++ src/components/window/sidebarEntryImpl.rs | 1 + src/components/window/window.rs | 40 ++++++++++++++++++--- 3 files changed, 61 insertions(+), 4 deletions(-) diff --git a/src/components/window/handleSidebarClick.rs b/src/components/window/handleSidebarClick.rs index 672bcee..646c8ac 100644 --- a/src/components/window/handleSidebarClick.rs +++ b/src/components/window/handleSidebarClick.rs @@ -54,3 +54,27 @@ pub const HANDLE_MICROPHONE_CLICK: fn(FlowBox) = |resetMain: FlowBox| { 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(); + resetMain.insert(&label, -1); +}; + +pub const HANDLE_MONITOR_CLICK: fn(FlowBox) = |resetMain: FlowBox| { + let label = Label::new(Some("not implemented yet")); + resetMain.remove_all(); + resetMain.insert(&label, -1); +}; + +pub const HANDLE_MOUSE_CLICK: fn(FlowBox) = |resetMain: FlowBox| { + let label = Label::new(Some("not implemented yet")); + resetMain.remove_all(); + resetMain.insert(&label, -1); +}; + +pub const HANDLE_KEYBOARD_CLICK: fn(FlowBox) = |resetMain: FlowBox| { + let label = Label::new(Some("not implemented yet")); + resetMain.remove_all(); + resetMain.insert(&label, -1); +}; \ No newline at end of file diff --git a/src/components/window/sidebarEntryImpl.rs b/src/components/window/sidebarEntryImpl.rs index c0f3f2a..3497890 100644 --- a/src/components/window/sidebarEntryImpl.rs +++ b/src/components/window/sidebarEntryImpl.rs @@ -11,6 +11,7 @@ use crate::components::window::sidebarEntry; pub enum Categories { Connectivity, Audio, + Peripherals, #[default] Misc, } diff --git a/src/components/window/window.rs b/src/components/window/window.rs index ec8f97d..85618fe 100644 --- a/src/components/window/window.rs +++ b/src/components/window/window.rs @@ -5,10 +5,7 @@ use glib::Object; use gtk::{Application, gio, glib, Orientation}; use gtk::prelude::*; -use crate::components::window::handleSidebarClick::{ - HANDLE_AUDIO_CLICK, HANDLE_BLUETOOTH_CLICK, HANDLE_CONNECTIVITY_CLICK, HANDLE_MICROPHONE_CLICK, - HANDLE_VOLUME_CLICK, HANDLE_VPN_CLICK, HANDLE_WIFI_CLICK, -}; +use crate::components::window::handleSidebarClick::*; use crate::components::window::sidebarEntry::SidebarEntry; use crate::components::window::sidebarEntryImpl::Categories; use crate::components::window::windowImpl; @@ -171,6 +168,41 @@ impl Window { audioList, )); + let peripheralsList = vec![ + SidebarEntry::new( + "Displays", + "video-display-symbolic", + Categories::Peripherals, + true, + HANDLE_MONITOR_CLICK, + ), + SidebarEntry::new( + "Mouse", + "input-mouse-symbolic", + Categories::Peripherals, + true, + HANDLE_MOUSE_CLICK, + ), + SidebarEntry::new( + "Keyboard", + "input-keyboard-symbolic", + Categories::Peripherals, + true, + HANDLE_KEYBOARD_CLICK, + ), + ]; + + sidebarEntries.push(( + SidebarEntry::new( + "Peripherals", + "preferences-system-devices-symbolic", + Categories::Peripherals, + false, + HANDLE_PERIPHERALS_CLICK, + ), + peripheralsList, + )); + for (mainEntry, subEntries) in sidebarEntries.iter() { selfImp.resetSidebarList.append(mainEntry); for subEntry in subEntries {