mirror of
https://github.com/Xetibo/ReSet.git
synced 2025-04-12 08:28:32 +02:00
chore: Code cleanup
This commit is contained in:
parent
192dacb333
commit
cb3dd257f1
|
@ -12,6 +12,19 @@
|
|||
"dest": "cargo/vendor/ReSet-Lib-0.2.8",
|
||||
"dest-filename": ".cargo-checksum.json"
|
||||
},
|
||||
{
|
||||
"type": "archive",
|
||||
"archive-type": "tar-gzip",
|
||||
"url": "https://static.crates.io/crates/ReSet-Lib/ReSet-Lib-0.3.5.crate",
|
||||
"sha256": "a0f2428f460a6604b353461d8244b3ce8841adcd964a2165cd2f9b975462b19d",
|
||||
"dest": "cargo/vendor/ReSet-Lib-0.3.5"
|
||||
},
|
||||
{
|
||||
"type": "inline",
|
||||
"contents": "{\"package\": \"a0f2428f460a6604b353461d8244b3ce8841adcd964a2165cd2f9b975462b19d\", \"files\": {}}",
|
||||
"dest": "cargo/vendor/ReSet-Lib-0.3.5",
|
||||
"dest-filename": ".cargo-checksum.json"
|
||||
},
|
||||
{
|
||||
"type": "archive",
|
||||
"archive-type": "tar-gzip",
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
use std::cell::RefCell;
|
||||
use std::collections::HashMap;
|
||||
|
||||
use crate::components::base::listEntry::ListEntry;
|
||||
use gtk::subclass::prelude::*;
|
||||
use gtk::{glib, CompositeTemplate, TemplateChild, Label, DropDown, StringList};
|
||||
use gtk::{glib, CompositeTemplate, DropDown, Label, StringList, TemplateChild};
|
||||
|
||||
use super::cardEntry;
|
||||
|
||||
|
@ -19,7 +18,7 @@ pub struct CardEntry {
|
|||
pub resetCardList: TemplateChild<StringList>,
|
||||
// first string is the alias name, the first return string is the index of the adapter and the
|
||||
// second the name of the profile
|
||||
pub resetCardMap: RefCell<HashMap<String, (u32, String)>>
|
||||
pub resetCardMap: RefCell<HashMap<String, (u32, String)>>,
|
||||
}
|
||||
|
||||
#[glib::object_subclass]
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
use crate::components::base::listEntry;
|
||||
use gtk::subclass::prelude::*;
|
||||
use gtk::{glib, CompositeTemplate, DropDown, Label, StringList};
|
||||
use gtk::{glib, CompositeTemplate};
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
#[derive(Default, CompositeTemplate)]
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
pub mod settingBox;
|
||||
pub mod settingBoxImpl;
|
||||
pub mod cardEntry;
|
||||
pub mod cardEntryImpl;
|
||||
pub mod listEntry;
|
||||
pub mod listEntryImpl;
|
||||
pub mod popup;
|
||||
pub mod popupImpl;
|
||||
pub mod settingBox;
|
||||
pub mod settingBoxImpl;
|
||||
pub mod utils;
|
||||
pub mod cardEntry;
|
||||
pub mod cardEntryImpl;
|
||||
|
|
|
@ -17,3 +17,4 @@ impl SettingBox {
|
|||
entry
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ use crate::components::base::listEntry::ListEntry;
|
|||
use crate::components::base::utils::Listeners;
|
||||
use crate::components::bluetooth::bluetoothBoxImpl;
|
||||
use crate::components::bluetooth::bluetoothEntry::BluetoothEntry;
|
||||
use crate::components::bluetooth::bluetoothEntryImpl::DeviceTypes;
|
||||
// use crate::components::bluetooth::bluetoothEntryImpl::DeviceTypes;
|
||||
|
||||
glib::wrapper! {
|
||||
pub struct BluetoothBox(ObjectSubclass<bluetoothBoxImpl::BluetoothBox>)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::time::Duration;
|
||||
|
||||
use crate::components::bluetooth::bluetoothEntryImpl;
|
||||
use crate::components::bluetooth::bluetoothEntryImpl::DeviceTypes;
|
||||
// use crate::components::bluetooth::bluetoothEntryImpl::DeviceTypes;
|
||||
use adw::glib;
|
||||
use adw::glib::Object;
|
||||
use adw::subclass::prelude::ObjectSubclassIsExt;
|
||||
|
@ -23,7 +23,10 @@ impl BluetoothEntry {
|
|||
let entry: BluetoothEntry = Object::builder().build();
|
||||
let entryImp = entry.imp();
|
||||
entryImp.resetBluetoothLabel.get().set_text(&device.name);
|
||||
entryImp.resetBluetoothAddress.get().set_text(&device.address);
|
||||
entryImp
|
||||
.resetBluetoothAddress
|
||||
.get()
|
||||
.set_text(&device.address);
|
||||
// entryImp
|
||||
// .resetBluetoothDeviceType
|
||||
// .get()
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use crate::components::bluetooth::bluetoothEntry;
|
||||
use gtk::subclass::prelude::*;
|
||||
use gtk::{glib, Button, CompositeTemplate, Image, Label};
|
||||
use std::cell::RefCell;
|
||||
use ReSet_Lib::bluetooth::bluetooth::BluetoothDevice;
|
||||
use gtk::{Button, CompositeTemplate, glib, Image, Label};
|
||||
use gtk::subclass::prelude::*;
|
||||
use crate::components::bluetooth::bluetoothEntry;
|
||||
|
||||
#[derive(Default, Copy, Clone)]
|
||||
pub enum DeviceTypes {
|
||||
|
@ -26,7 +26,7 @@ pub struct BluetoothEntry {
|
|||
#[template_child]
|
||||
pub resetBluetoothButton: TemplateChild<Button>,
|
||||
pub deviceName: RefCell<String>,
|
||||
pub device: RefCell<BluetoothDevice>
|
||||
pub device: RefCell<BluetoothDevice>,
|
||||
}
|
||||
|
||||
#[glib::object_subclass]
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#![allow(non_snake_case)]
|
||||
pub mod bluetoothBox;
|
||||
pub mod bluetoothEntry;
|
||||
pub mod bluetoothBoxImpl;
|
||||
pub mod bluetoothEntry;
|
||||
pub mod bluetoothEntryImpl;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#![allow(non_snake_case)]
|
||||
pub mod sourceBox;
|
||||
pub mod sourceBoxImpl;
|
||||
pub mod outputStreamEntry;
|
||||
pub mod outputStreamEntryImpl;
|
||||
pub mod sourceBox;
|
||||
pub mod sourceBoxImpl;
|
||||
pub mod sourceEntry;
|
||||
pub mod sourceEntryImpl;
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
use std::sync::atomic::Ordering;
|
||||
use std::sync::Arc;
|
||||
use std::time::{Duration, SystemTime};
|
||||
|
||||
use crate::components::base::cardEntry::CardEntry;
|
||||
use crate::components::base::listEntry::ListEntry;
|
||||
use crate::components::base::utils::{
|
||||
Listeners, OutputStreamAdded, OutputStreamChanged, OutputStreamRemoved, SourceAdded,
|
||||
SourceChanged, SourceRemoved,
|
||||
OutputStreamAdded, OutputStreamChanged, OutputStreamRemoved, SourceAdded, SourceChanged,
|
||||
SourceRemoved,
|
||||
};
|
||||
use crate::components::input::sourceBoxImpl;
|
||||
use crate::components::input::sourceEntry::set_source_volume;
|
||||
|
|
|
@ -3,7 +3,7 @@ use std::sync::Arc;
|
|||
use std::time::SystemTime;
|
||||
|
||||
use gtk::subclass::prelude::*;
|
||||
use gtk::{glib, Button, CompositeTemplate, Label, ProgressBar, Scale, CheckButton};
|
||||
use gtk::{glib, Button, CheckButton, CompositeTemplate, Label, ProgressBar, Scale};
|
||||
use ReSet_Lib::audio::audio::Source;
|
||||
|
||||
use super::sourceEntry;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
pub mod window;
|
||||
pub mod wifi;
|
||||
pub mod bluetooth;
|
||||
pub mod output;
|
||||
mod base;
|
||||
pub mod bluetooth;
|
||||
mod input;
|
||||
pub mod output;
|
||||
pub mod wifi;
|
||||
pub mod window;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#![allow(non_snake_case)]
|
||||
pub mod sinkBox;
|
||||
pub mod sinkBoxImpl;
|
||||
pub mod inputStreamEntry;
|
||||
pub mod inputStreamEntryImpl;
|
||||
pub mod sinkBox;
|
||||
pub mod sinkBoxImpl;
|
||||
pub mod sinkEntry;
|
||||
pub mod sinkEntryImpl;
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
use std::sync::atomic::Ordering;
|
||||
use std::sync::Arc;
|
||||
use std::time::{Duration, SystemTime};
|
||||
|
||||
use crate::components::base::cardEntry::CardEntry;
|
||||
use crate::components::base::listEntry::ListEntry;
|
||||
use crate::components::base::utils::{
|
||||
InputStreamAdded, InputStreamChanged, InputStreamRemoved, Listeners, SinkAdded, SinkChanged,
|
||||
SinkRemoved,
|
||||
InputStreamAdded, InputStreamChanged, InputStreamRemoved, SinkAdded, SinkChanged, SinkRemoved,
|
||||
};
|
||||
use crate::components::output::sinkEntry::set_sink_volume;
|
||||
use adw::glib::Object;
|
||||
|
|
|
@ -4,7 +4,7 @@ use std::time::SystemTime;
|
|||
|
||||
use crate::components::output::sinkEntry;
|
||||
use gtk::subclass::prelude::*;
|
||||
use gtk::{glib, Button, CompositeTemplate, Label, ProgressBar, Scale, CheckButton};
|
||||
use gtk::{glib, Button, CheckButton, CompositeTemplate, Label, ProgressBar, Scale};
|
||||
use ReSet_Lib::audio::audio::Sink;
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#![allow(non_snake_case)]
|
||||
pub mod savedWifiEntry;
|
||||
pub mod savedWifiEntryImpl;
|
||||
pub mod wifiBox;
|
||||
pub mod wifiBoxImpl;
|
||||
pub mod wifiEntry;
|
||||
pub mod wifiEntryImpl;
|
||||
pub mod savedWifiEntryImpl;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
use std::collections::HashMap;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use gtk::{CompositeTemplate, glib, ListBox, Switch};
|
||||
use crate::components::wifi::wifiBox;
|
||||
use gtk::prelude::*;
|
||||
use gtk::subclass::prelude::*;
|
||||
use crate::components::wifi::wifiBox;
|
||||
use gtk::{glib, CompositeTemplate, ListBox, Switch};
|
||||
use std::collections::HashMap;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use crate::components::wifi::wifiEntry::WifiEntry;
|
||||
use crate::components::base::listEntry::ListEntry;
|
||||
use crate::components::wifi::wifiEntry::WifiEntry;
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
#[derive(Default, CompositeTemplate)]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use std::sync::Arc;
|
||||
use std::sync::atomic::AtomicBool;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
use adw::glib;
|
||||
|
@ -8,9 +8,9 @@ use adw::prelude::{ButtonExt, EditableExt, PopoverExt};
|
|||
use adw::subclass::prelude::ObjectSubclassIsExt;
|
||||
use dbus::blocking::Connection;
|
||||
use dbus::Error;
|
||||
use glib::{Cast, clone};
|
||||
use gtk::{AlertDialog, GestureClick};
|
||||
use glib::{clone, Cast};
|
||||
use gtk::prelude::WidgetExt;
|
||||
use gtk::{AlertDialog, GestureClick};
|
||||
use ReSet_Lib::network::network::{AccessPoint, WifiStrength};
|
||||
|
||||
use crate::components::wifi::wifiBox::getConnectionSettings;
|
||||
|
@ -144,8 +144,10 @@ pub fn click_stored_network(entry: Arc<WifiEntry>) {
|
|||
}
|
||||
|
||||
pub fn click_new_network(entry: Arc<WifiEntry>) {
|
||||
let connect_new_network =
|
||||
|result: Arc<AtomicBool>, entry: Arc<WifiEntry>, access_point: AccessPoint, password: String| {
|
||||
let connect_new_network = |result: Arc<AtomicBool>,
|
||||
entry: Arc<WifiEntry>,
|
||||
access_point: AccessPoint,
|
||||
password: String| {
|
||||
let entry_ref = entry.clone();
|
||||
let popup = entry.imp().resetWifiPopup.imp();
|
||||
popup.resetPopupLabel.set_text("Connecting...");
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#![allow(non_snake_case)]
|
||||
pub mod window;
|
||||
pub mod windowImpl;
|
||||
pub mod handleSidebarClick;
|
||||
pub mod sidebarEntry;
|
||||
pub mod sidebarEntryImpl;
|
||||
pub mod handleSidebarClick;
|
||||
pub mod window;
|
||||
pub mod windowImpl;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use adw::subclass::prelude::ObjectSubclassIsExt;
|
||||
use glib::Object;
|
||||
use gtk::{FlowBox, glib};
|
||||
use gtk::prelude::*;
|
||||
use crate::components::base::utils::Listeners;
|
||||
use crate::components::window::sidebarEntryImpl;
|
||||
use crate::components::window::sidebarEntryImpl::{Categories, SidebarAction};
|
||||
use adw::subclass::prelude::ObjectSubclassIsExt;
|
||||
use glib::Object;
|
||||
use gtk::prelude::*;
|
||||
use gtk::{glib, FlowBox};
|
||||
|
||||
glib::wrapper! {
|
||||
pub struct SidebarEntry(ObjectSubclass<sidebarEntryImpl::SidebarEntry>)
|
||||
|
|
|
@ -2,8 +2,8 @@ use std::cell::{Cell, RefCell};
|
|||
use std::sync::Arc;
|
||||
|
||||
use glib::subclass::InitializingObject;
|
||||
use gtk::{CompositeTemplate, FlowBox, glib, Image, Label, ListBoxRow};
|
||||
use gtk::subclass::prelude::*;
|
||||
use gtk::{glib, CompositeTemplate, FlowBox, Image, Label, ListBoxRow};
|
||||
|
||||
use crate::components::base::utils::Listeners;
|
||||
use crate::components::window::handleSidebarClick::HANDLE_HOME;
|
||||
|
@ -40,7 +40,7 @@ pub struct SidebarAction {
|
|||
impl Default for SidebarAction {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
onClickEvent: HANDLE_HOME
|
||||
onClickEvent: HANDLE_HOME,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue