Add peripherals in sidebar

This commit is contained in:
takotori 2023-11-02 17:00:10 +01:00
parent 7c630579ae
commit 15a5333cc0
3 changed files with 61 additions and 4 deletions

View file

@ -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);
};

View file

@ -11,6 +11,7 @@ use crate::components::window::sidebarEntry;
pub enum Categories {
Connectivity,
Audio,
Peripherals,
#[default]
Misc,
}

View file

@ -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 {