Merge pull request #64 from Xetibo/ina

Improve UI
This commit is contained in:
Dashie 2023-11-27 12:28:22 +01:00 committed by GitHub
commit 4f1eacf56e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 1106 additions and 1431 deletions

View file

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

View file

@ -5,12 +5,15 @@ use adw::glib::Object;
use adw::prelude::{ComboRowExt, PreferencesRowExt}; use adw::prelude::{ComboRowExt, PreferencesRowExt};
use dbus::blocking::Connection; use dbus::blocking::Connection;
use dbus::Error; use dbus::Error;
use glib::{Cast, clone, ObjectExt}; use glib::{Cast, clone};
use glib::subclass::types::ObjectSubclassIsExt; use glib::subclass::types::ObjectSubclassIsExt;
use gtk::{Align, gio, SignalListItemFactory, StringList, StringObject}; use gtk::{gio, StringList, StringObject};
use gtk::prelude::{GObjectPropertyExpressionExt, ListItemExt, WidgetExt};
use ReSet_Lib::audio::audio::Card; use ReSet_Lib::audio::audio::Card;
use components::utils::createDropdownLabelFactory;
use crate::components;
use super::cardEntryImpl; use super::cardEntryImpl;
glib::wrapper! { glib::wrapper! {
@ -55,18 +58,7 @@ impl CardEntry {
let (device_index, profile_name) = map.get(&selected).unwrap(); let (device_index, profile_name) = map.get(&selected).unwrap();
set_card_profile_of_device(*device_index, profile_name.clone()); set_card_profile_of_device(*device_index, profile_name.clone());
})); }));
entry.set_factory(Some(&createDropdownLabelFactory()));
let factory = &SignalListItemFactory::new();
factory.connect_setup(|_, item| {
let item = item.downcast_ref::<gtk::ListItem>().unwrap();
let label = gtk::Label::new(None);
label.set_halign(Align::Start);
item.property_expression("item")
.chain_property::<StringObject>("string")
.bind(&label, "label", gtk::Widget::NONE);
item.set_child(Some(&label));
});
entry.set_factory(Some(factory));
} }
entry entry
} }

View file

@ -3,20 +3,21 @@ use std::time::{Duration, SystemTime};
use adw::glib; use adw::glib;
use adw::glib::Object; use adw::glib::Object;
use adw::prelude::{ButtonExt, RangeExt}; use adw::prelude::{ButtonExt, ComboRowExt, PreferencesRowExt, RangeExt};
use dbus::blocking::Connection; use dbus::blocking::Connection;
use dbus::Error; use dbus::Error;
use glib::subclass::types::ObjectSubclassIsExt; use glib::subclass::types::ObjectSubclassIsExt;
use glib::{clone, Cast, Propagation}; use glib::{clone, Cast, Propagation};
use gtk::{gio, StringObject}; use gtk::{gio, StringObject};
use ReSet_Lib::audio::audio::OutputStream; use ReSet_Lib::audio::audio::OutputStream;
use crate::components::utils::{createDropdownLabelFactory, setComboRowEllipsis};
use super::outputStreamEntryImpl; use super::outputStreamEntryImpl;
use super::sourceBox::SourceBox; use super::sourceBox::SourceBox;
glib::wrapper! { glib::wrapper! {
pub struct OutputStreamEntry(ObjectSubclass<outputStreamEntryImpl::OutputStreamEntry>) pub struct OutputStreamEntry(ObjectSubclass<outputStreamEntryImpl::OutputStreamEntry>)
@extends gtk::Box, gtk::Widget, @extends adw::PreferencesGroup, gtk::Widget,
@implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Orientable; @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Orientable;
} }
@ -31,7 +32,9 @@ impl OutputStreamEntry {
let box_imp = source_box.imp(); let box_imp = source_box.imp();
let imp = obj.imp(); let imp = obj.imp();
let name = stream.application_name.clone() + ": " + stream.name.as_str(); let name = stream.application_name.clone() + ": " + stream.name.as_str();
imp.resetSourceName.set_text(name.as_str()); imp.resetSourceSelection.set_title(name.as_str());
imp.resetSourceSelection.set_factory(Some(&createDropdownLabelFactory()));
setComboRowEllipsis(imp.resetSourceSelection.get());
let volume = stream.volume.first().unwrap_or(&0_u32); let volume = stream.volume.first().unwrap_or(&0_u32);
let fraction = (*volume as f64 / 655.36).round(); let fraction = (*volume as f64 / 655.36).round();
let percentage = (fraction).to_string() + "%"; let percentage = (fraction).to_string() + "%";
@ -69,7 +72,7 @@ impl OutputStreamEntry {
// list = box_imp.resetModelList.try_borrow(); // list = box_imp.resetModelList.try_borrow();
// } // }
// let list = list.unwrap(); // let list = list.unwrap();
imp.resetSelectedSource.set_model(Some(&*list)); imp.resetSourceSelection.set_model(Some(&*list));
let map = box_imp.resetSourceMap.write().unwrap(); let map = box_imp.resetSourceMap.write().unwrap();
// while map.is_err() { // while map.is_err() {
// map = box_imp.resetSourceMap.try_borrow(); // map = box_imp.resetSourceMap.try_borrow();
@ -83,10 +86,10 @@ impl OutputStreamEntry {
let name = &name.alias; let name = &name.alias;
let index = map.get(name); let index = map.get(name);
if index.is_some() { if index.is_some() {
imp.resetSelectedSource.set_selected(index.unwrap().1); imp.resetSourceSelection.set_selected(index.unwrap().1);
} }
} }
imp.resetSelectedSource.connect_selected_notify( imp.resetSourceSelection.connect_selected_notify(
clone!(@weak imp, @weak box_imp => move |dropdown| { clone!(@weak imp, @weak box_imp => move |dropdown| {
let selected = dropdown.selected_item(); let selected = dropdown.selected_item();
if selected.is_none() { if selected.is_none() {

View file

@ -1,6 +1,8 @@
use std::cell::RefCell; use std::cell::RefCell;
use std::sync::Arc; use std::sync::Arc;
use std::time::SystemTime; use std::time::SystemTime;
use adw::{ComboRow, PreferencesGroup};
use adw::subclass::prelude::PreferencesGroupImpl;
use crate::components::input::outputStreamEntry; use crate::components::input::outputStreamEntry;
use gtk::subclass::prelude::*; use gtk::subclass::prelude::*;
@ -12,9 +14,7 @@ use ReSet_Lib::audio::audio::OutputStream;
#[template(resource = "/org/Xetibo/ReSet/resetOutputStreamEntry.ui")] #[template(resource = "/org/Xetibo/ReSet/resetOutputStreamEntry.ui")]
pub struct OutputStreamEntry { pub struct OutputStreamEntry {
#[template_child] #[template_child]
pub resetSourceName: TemplateChild<Label>, pub resetSourceSelection: TemplateChild<ComboRow>,
#[template_child]
pub resetSelectedSource: TemplateChild<DropDown>,
#[template_child] #[template_child]
pub resetSourceMute: TemplateChild<Button>, pub resetSourceMute: TemplateChild<Button>,
#[template_child] #[template_child]
@ -33,7 +33,7 @@ impl ObjectSubclass for OutputStreamEntry {
const ABSTRACT: bool = false; const ABSTRACT: bool = false;
const NAME: &'static str = "resetOutputStreamEntry"; const NAME: &'static str = "resetOutputStreamEntry";
type Type = outputStreamEntry::OutputStreamEntry; type Type = outputStreamEntry::OutputStreamEntry;
type ParentType = gtk::Box; type ParentType = PreferencesGroup;
fn class_init(klass: &mut Self::Class) { fn class_init(klass: &mut Self::Class) {
klass.bind_template(); klass.bind_template();
@ -44,7 +44,7 @@ impl ObjectSubclass for OutputStreamEntry {
} }
} }
impl BoxImpl for OutputStreamEntry {} impl PreferencesGroupImpl for OutputStreamEntry {}
impl ObjectImpl for OutputStreamEntry {} impl ObjectImpl for OutputStreamEntry {}

View file

@ -1,3 +1,4 @@
use adw::prelude::PreferencesRowExt;
use std::sync::Arc; use std::sync::Arc;
use std::time::{Duration, SystemTime}; use std::time::{Duration, SystemTime};
@ -9,8 +10,8 @@ use dbus::blocking::Connection;
use dbus::message::SignalArgs; use dbus::message::SignalArgs;
use glib::{Cast, clone, Propagation, Variant}; use glib::{Cast, clone, Propagation, Variant};
use glib::subclass::prelude::ObjectSubclassIsExt; use glib::subclass::prelude::ObjectSubclassIsExt;
use gtk::{Align, gio, SignalListItemFactory, StringObject}; use gtk::{gio, StringObject};
use gtk::prelude::{ActionableExt, GObjectPropertyExpressionExt, ListItemExt, WidgetExt}; use gtk::prelude::{ActionableExt};
use ReSet_Lib::audio::audio::{Card, OutputStream, Source}; use ReSet_Lib::audio::audio::{Card, OutputStream, Source};
use crate::components::base::cardEntry::CardEntry; use crate::components::base::cardEntry::CardEntry;
@ -21,6 +22,7 @@ use crate::components::base::utils::{
}; };
use crate::components::input::sourceBoxImpl; use crate::components::input::sourceBoxImpl;
use crate::components::input::sourceEntry::set_source_volume; use crate::components::input::sourceEntry::set_source_volume;
use crate::components::utils::{createDropdownLabelFactory, setComboRowEllipsis};
use super::outputStreamEntry::OutputStreamEntry; use super::outputStreamEntry::OutputStreamEntry;
use super::sourceEntry::{set_default_source, SourceEntry, toggle_source_mute}; use super::sourceEntry::{set_default_source, SourceEntry, toggle_source_mute};
@ -55,25 +57,15 @@ impl SourceBox {
selfImp selfImp
.resetCardsRow .resetCardsRow
.set_action_target_value(Some(&Variant::from("profileConfiguration"))); .set_action_target_value(Some(&Variant::from("profileConfiguration")));
selfImp
.resetOutputStreamButton
.set_action_name(Some("navigation.pop"));
selfImp
.resetInputCardsBackButton
.set_action_name(Some("navigation.pop"));
let factory = &SignalListItemFactory::new(); selfImp.resetOutputStreamButton.set_activatable(true);
factory.connect_setup(|_, item| { selfImp.resetOutputStreamButton.set_action_name(Some("navigation.pop"));
let item = item.downcast_ref::<gtk::ListItem>().unwrap();
let label = gtk::Label::new(None);
label.set_halign(Align::Start);
item.property_expression("item")
.chain_property::<StringObject>("string")
.bind(&label, "label", gtk::Widget::NONE);
item.set_child(Some(&label));
});
selfImp.resetSourceDropdown.set_factory(Some(factory)); selfImp.resetInputCardsBackButton.set_activatable(true);
selfImp.resetInputCardsBackButton.set_action_name(Some("navigation.pop"));
selfImp.resetSourceDropdown.set_factory(Some(&createDropdownLabelFactory()));
setComboRowEllipsis(selfImp.resetSourceDropdown.get());
} }
} }
@ -457,7 +449,7 @@ pub fn start_input_box_listener(conn: Connection, source_box: Arc<SourceBox>) ->
} else { } else {
imp.resetSelectedSource.set_active(false); imp.resetSelectedSource.set_active(false);
} }
imp.resetSourceName.set_text(ir.source.alias.clone().as_str()); imp.resetSourceName.set_title(ir.source.alias.clone().as_str());
imp.resetVolumePercentage.set_text(&percentage); imp.resetVolumePercentage.set_text(&percentage);
imp.resetVolumeSlider.set_value(*volume as f64); imp.resetVolumeSlider.set_value(*volume as f64);
@ -530,7 +522,7 @@ pub fn start_input_box_listener(conn: Connection, source_box: Arc<SourceBox>) ->
.set_icon_name("audio-input-microphone-symbolic"); .set_icon_name("audio-input-microphone-symbolic");
} }
let name = ir.stream.application_name.clone() + ": " + ir.stream.name.as_str(); let name = ir.stream.application_name.clone() + ": " + ir.stream.name.as_str();
imp.resetSourceName.set_text(name.as_str()); imp.resetSourceSelection.set_title(name.as_str());
let volume = ir.stream.volume.first().unwrap_or(&0_u32); let volume = ir.stream.volume.first().unwrap_or(&0_u32);
let fraction = (*volume as f64 / 655.36).round(); let fraction = (*volume as f64 / 655.36).round();
let percentage = (fraction).to_string() + "%"; let percentage = (fraction).to_string() + "%";
@ -539,7 +531,7 @@ pub fn start_input_box_listener(conn: Connection, source_box: Arc<SourceBox>) ->
let map = output_box_imp.resetSourceMap.read().unwrap(); let map = output_box_imp.resetSourceMap.read().unwrap();
let index = map.get(&alias); let index = map.get(&alias);
if index.is_some() { if index.is_some() {
imp.resetSelectedSource.set_selected(index.unwrap().1); imp.resetSourceSelection.set_selected(index.unwrap().1);
} }
}); });
}); });

View file

@ -35,11 +35,11 @@ pub struct SourceBox {
#[template_child] #[template_child]
pub resetSources: TemplateChild<gtk::Box>, pub resetSources: TemplateChild<gtk::Box>,
#[template_child] #[template_child]
pub resetOutputStreamButton: TemplateChild<ListEntry>, pub resetOutputStreamButton: TemplateChild<ActionRow>,
#[template_child] #[template_child]
pub resetOutputStreams: TemplateChild<gtk::Box>, pub resetOutputStreams: TemplateChild<gtk::Box>,
#[template_child] #[template_child]
pub resetInputCardsBackButton: TemplateChild<ListEntry>, pub resetInputCardsBackButton: TemplateChild<ActionRow>,
#[template_child] #[template_child]
pub resetCards: TemplateChild<PreferencesGroup>, pub resetCards: TemplateChild<PreferencesGroup>,
pub resetDefaultCheckButton: Arc<CheckButton>, pub resetDefaultCheckButton: Arc<CheckButton>,

View file

@ -3,7 +3,7 @@ use std::time::{Duration, SystemTime};
use adw::glib; use adw::glib;
use adw::glib::Object; use adw::glib::Object;
use adw::prelude::{ButtonExt, CheckButtonExt, RangeExt}; use adw::prelude::{ButtonExt, CheckButtonExt, PreferencesRowExt, RangeExt};
use dbus::blocking::Connection; use dbus::blocking::Connection;
use dbus::Error; use dbus::Error;
use glib::subclass::types::ObjectSubclassIsExt; use glib::subclass::types::ObjectSubclassIsExt;
@ -15,7 +15,7 @@ use super::sourceEntryImpl;
glib::wrapper! { glib::wrapper! {
pub struct SourceEntry(ObjectSubclass<sourceEntryImpl::SourceEntry>) pub struct SourceEntry(ObjectSubclass<sourceEntryImpl::SourceEntry>)
@extends gtk::Box, gtk::Widget, @extends adw::PreferencesGroup, gtk::Widget,
@implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Orientable; @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Orientable;
} }
@ -28,7 +28,7 @@ impl SourceEntry {
// TODO use event callback for progress bar -> this is the "im speaking" indicator // TODO use event callback for progress bar -> this is the "im speaking" indicator
{ {
let imp = obj.imp(); let imp = obj.imp();
imp.resetSourceName.set_text(stream.alias.clone().as_str()); imp.resetSourceName.set_title(stream.alias.clone().as_str());
let name = Arc::new(stream.name.clone()); let name = Arc::new(stream.name.clone());
let volume = stream.volume.first().unwrap_or(&0_u32); let volume = stream.volume.first().unwrap_or(&0_u32);
let fraction = (*volume as f64 / 655.36).round(); let fraction = (*volume as f64 / 655.36).round();

View file

@ -1,6 +1,8 @@
use std::cell::RefCell; use std::cell::RefCell;
use std::sync::Arc; use std::sync::Arc;
use std::time::SystemTime; use std::time::SystemTime;
use adw::{ActionRow, PreferencesGroup};
use adw::subclass::prelude::PreferencesGroupImpl;
use gtk::subclass::prelude::*; use gtk::subclass::prelude::*;
use gtk::{glib, Button, CheckButton, CompositeTemplate, Label, ProgressBar, Scale}; use gtk::{glib, Button, CheckButton, CompositeTemplate, Label, ProgressBar, Scale};
@ -13,7 +15,7 @@ use super::sourceEntry;
#[template(resource = "/org/Xetibo/ReSet/resetSourceEntry.ui")] #[template(resource = "/org/Xetibo/ReSet/resetSourceEntry.ui")]
pub struct SourceEntry { pub struct SourceEntry {
#[template_child] #[template_child]
pub resetSourceName: TemplateChild<Label>, pub resetSourceName: TemplateChild<ActionRow>,
#[template_child] #[template_child]
pub resetSelectedSource: TemplateChild<CheckButton>, pub resetSelectedSource: TemplateChild<CheckButton>,
#[template_child] #[template_child]
@ -33,7 +35,7 @@ impl ObjectSubclass for SourceEntry {
const ABSTRACT: bool = false; const ABSTRACT: bool = false;
const NAME: &'static str = "resetSourceEntry"; const NAME: &'static str = "resetSourceEntry";
type Type = sourceEntry::SourceEntry; type Type = sourceEntry::SourceEntry;
type ParentType = gtk::Box; type ParentType = PreferencesGroup;
fn class_init(klass: &mut Self::Class) { fn class_init(klass: &mut Self::Class) {
klass.bind_template(); klass.bind_template();
@ -44,7 +46,7 @@ impl ObjectSubclass for SourceEntry {
} }
} }
impl BoxImpl for SourceEntry {} impl PreferencesGroupImpl for SourceEntry {}
impl ObjectImpl for SourceEntry {} impl ObjectImpl for SourceEntry {}

View file

@ -4,4 +4,5 @@ mod input;
pub mod output; pub mod output;
pub mod wifi; pub mod wifi;
pub mod window; pub mod window;
pub mod utils;

View file

@ -3,20 +3,21 @@ use std::time::{Duration, SystemTime};
use adw::glib; use adw::glib;
use adw::glib::Object; use adw::glib::Object;
use adw::prelude::{ButtonExt, RangeExt}; use adw::prelude::{ButtonExt, ComboRowExt, PreferencesRowExt, RangeExt};
use dbus::blocking::Connection; use dbus::blocking::Connection;
use dbus::Error; use dbus::Error;
use glib::subclass::types::ObjectSubclassIsExt; use glib::subclass::types::ObjectSubclassIsExt;
use glib::{clone, Cast, Propagation}; use glib::{clone, Cast, Propagation};
use gtk::{gio, StringObject}; use gtk::{gio, StringObject};
use ReSet_Lib::audio::audio::InputStream; use ReSet_Lib::audio::audio::InputStream;
use crate::components::utils::{createDropdownLabelFactory, setComboRowEllipsis};
use super::inputStreamEntryImpl; use super::inputStreamEntryImpl;
use super::sinkBox::SinkBox; use super::sinkBox::SinkBox;
glib::wrapper! { glib::wrapper! {
pub struct InputStreamEntry(ObjectSubclass<inputStreamEntryImpl::InputStreamEntry>) pub struct InputStreamEntry(ObjectSubclass<inputStreamEntryImpl::InputStreamEntry>)
@extends gtk::Box, gtk::Widget, @extends adw::PreferencesGroup, gtk::Widget,
@implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Orientable; @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Orientable;
} }
@ -36,7 +37,9 @@ impl InputStreamEntry {
.set_icon_name("audio-volume-high-symbolic"); .set_icon_name("audio-volume-high-symbolic");
} }
let name = stream.application_name.clone() + ": " + stream.name.as_str(); let name = stream.application_name.clone() + ": " + stream.name.as_str();
imp.resetSinkName.set_text(name.as_str()); imp.resetSinkSelection.set_title(name.as_str());
imp.resetSinkSelection.set_factory(Some(&createDropdownLabelFactory()));
setComboRowEllipsis(imp.resetSinkSelection.get());
let volume = stream.volume.first().unwrap_or(&0_u32); let volume = stream.volume.first().unwrap_or(&0_u32);
let fraction = (*volume as f64 / 655.36).round(); let fraction = (*volume as f64 / 655.36).round();
let percentage = (fraction).to_string() + "%"; let percentage = (fraction).to_string() + "%";
@ -76,7 +79,7 @@ impl InputStreamEntry {
// list = box_imp.resetModelList.try_borrow(); // list = box_imp.resetModelList.try_borrow();
// } // }
// let list = list.unwrap(); // let list = list.unwrap();
imp.resetSelectedSink.set_model(Some(&*list)); imp.resetSinkSelection.set_model(Some(&*list));
let map = box_imp.resetSinkMap.read().unwrap(); let map = box_imp.resetSinkMap.read().unwrap();
let sink_list = box_imp.resetSinkList.read().unwrap(); let sink_list = box_imp.resetSinkList.read().unwrap();
let name = sink_list.get(&index); let name = sink_list.get(&index);
@ -84,7 +87,7 @@ impl InputStreamEntry {
let name = &name.unwrap().2; let name = &name.unwrap().2;
let index = map.get(name); let index = map.get(name);
if index.is_some() { if index.is_some() {
imp.resetSelectedSink.set_selected(index.unwrap().1); imp.resetSinkSelection.set_selected(index.unwrap().1);
} }
} else { } else {
let mut name = box_imp.resetDefaultSink.try_borrow(); let mut name = box_imp.resetDefaultSink.try_borrow();
@ -94,11 +97,11 @@ impl InputStreamEntry {
let name = &name.unwrap().alias; let name = &name.unwrap().alias;
let index = map.get(name); let index = map.get(name);
if index.is_some() { if index.is_some() {
imp.resetSelectedSink.set_selected(index.unwrap().1); imp.resetSinkSelection.set_selected(index.unwrap().1);
} }
} }
} }
imp.resetSelectedSink.connect_selected_notify( imp.resetSinkSelection.connect_selected_notify(
clone!(@weak imp, @weak box_imp => move |dropdown| { clone!(@weak imp, @weak box_imp => move |dropdown| {
let selected = dropdown.selected_item(); let selected = dropdown.selected_item();
if selected.is_none() { if selected.is_none() {

View file

@ -1,9 +1,11 @@
use std::cell::RefCell; use std::cell::RefCell;
use std::sync::Arc; use std::sync::Arc;
use std::time::SystemTime; use std::time::SystemTime;
use adw::{ComboRow, PreferencesGroup};
use adw::subclass::prelude::PreferencesGroupImpl;
use gtk::subclass::prelude::*; use gtk::subclass::prelude::*;
use gtk::{glib, Button, CompositeTemplate, DropDown, Label, ProgressBar, Scale}; use gtk::{glib, Button, CompositeTemplate, Label, ProgressBar, Scale};
use ReSet_Lib::audio::audio::InputStream; use ReSet_Lib::audio::audio::InputStream;
use super::inputStreamEntry; use super::inputStreamEntry;
@ -13,9 +15,7 @@ use super::inputStreamEntry;
#[template(resource = "/org/Xetibo/ReSet/resetInputStreamEntry.ui")] #[template(resource = "/org/Xetibo/ReSet/resetInputStreamEntry.ui")]
pub struct InputStreamEntry { pub struct InputStreamEntry {
#[template_child] #[template_child]
pub resetSinkName: TemplateChild<Label>, pub resetSinkSelection: TemplateChild<ComboRow>,
#[template_child]
pub resetSelectedSink: TemplateChild<DropDown>,
#[template_child] #[template_child]
pub resetSinkMute: TemplateChild<Button>, pub resetSinkMute: TemplateChild<Button>,
#[template_child] #[template_child]
@ -34,7 +34,7 @@ impl ObjectSubclass for InputStreamEntry {
const ABSTRACT: bool = false; const ABSTRACT: bool = false;
const NAME: &'static str = "resetInputStreamEntry"; const NAME: &'static str = "resetInputStreamEntry";
type Type = inputStreamEntry::InputStreamEntry; type Type = inputStreamEntry::InputStreamEntry;
type ParentType = gtk::Box; type ParentType = PreferencesGroup;
fn class_init(klass: &mut Self::Class) { fn class_init(klass: &mut Self::Class) {
klass.bind_template(); klass.bind_template();
@ -45,7 +45,7 @@ impl ObjectSubclass for InputStreamEntry {
} }
} }
impl BoxImpl for InputStreamEntry {} impl PreferencesGroupImpl for InputStreamEntry {}
impl ObjectImpl for InputStreamEntry {} impl ObjectImpl for InputStreamEntry {}

View file

@ -1,3 +1,4 @@
use adw::prelude::PreferencesRowExt;
use adw::prelude::PreferencesGroupExt; use adw::prelude::PreferencesGroupExt;
use std::sync::Arc; use std::sync::Arc;
use std::time::{Duration, SystemTime}; use std::time::{Duration, SystemTime};
@ -10,9 +11,8 @@ use dbus::blocking::Connection;
use dbus::message::SignalArgs; use dbus::message::SignalArgs;
use glib::{Cast, clone, Propagation, Variant}; use glib::{Cast, clone, Propagation, Variant};
use glib::subclass::prelude::ObjectSubclassIsExt; use glib::subclass::prelude::ObjectSubclassIsExt;
use gtk::{Align, gio, SignalListItemFactory, StringObject}; use gtk::{gio, StringObject};
use gtk::prelude::*; use gtk::prelude::ActionableExt;
use gtk::prelude::{ActionableExt, GObjectPropertyExpressionExt, ListItemExt};
use ReSet_Lib::audio::audio::{Card, InputStream, Sink}; use ReSet_Lib::audio::audio::{Card, InputStream, Sink};
use crate::components::base::cardEntry::CardEntry; use crate::components::base::cardEntry::CardEntry;
@ -21,6 +21,7 @@ use crate::components::base::utils::{
InputStreamAdded, InputStreamChanged, InputStreamRemoved, SinkAdded, SinkChanged, SinkRemoved, InputStreamAdded, InputStreamChanged, InputStreamRemoved, SinkAdded, SinkChanged, SinkRemoved,
}; };
use crate::components::output::sinkEntry::set_sink_volume; use crate::components::output::sinkEntry::set_sink_volume;
use crate::components::utils::{createDropdownLabelFactory, setComboRowEllipsis};
use super::inputStreamEntry::InputStreamEntry; use super::inputStreamEntry::InputStreamEntry;
use super::sinkBoxImpl; use super::sinkBoxImpl;
@ -64,25 +65,14 @@ impl SinkBox {
.set_action_target_value(Some(&Variant::from("profileConfiguration"))); .set_action_target_value(Some(&Variant::from("profileConfiguration")));
selfImp.resetCardsRow.connect_action_name_notify(|_| {}); selfImp.resetCardsRow.connect_action_name_notify(|_| {});
selfImp selfImp.resetInputStreamButton.set_activatable(true);
.resetInputStreamButton selfImp.resetInputStreamButton.set_action_name(Some("navigation.pop"));
.set_action_name(Some("navigation.pop"));
selfImp
.resetInputCardsBackButton
.set_action_name(Some("navigation.pop"));
let factory = &SignalListItemFactory::new(); selfImp.resetInputCardsBackButton.set_activatable(true);
factory.connect_setup(|_, item| { selfImp.resetInputCardsBackButton.set_action_name(Some("navigation.pop"));
let item = item.downcast_ref::<gtk::ListItem>().unwrap();
let label = gtk::Label::new(None);
label.set_halign(Align::Start);
item.property_expression("item")
.chain_property::<StringObject>("string")
.bind(&label, "label", gtk::Widget::NONE);
item.set_child(Some(&label));
});
selfImp.resetSinkDropdown.set_factory(Some(factory)); selfImp.resetSinkDropdown.set_factory(Some(&createDropdownLabelFactory()));
setComboRowEllipsis(selfImp.resetSinkDropdown.get());
} }
} }
@ -462,7 +452,7 @@ pub fn start_output_box_listener(conn: Connection, sink_box: Arc<SinkBox>) -> Co
} else { } else {
imp.resetSelectedSink.set_active(false); imp.resetSelectedSink.set_active(false);
} }
imp.resetSinkName.set_text(ir.sink.alias.clone().as_str()); imp.resetSinkName.set_title(ir.sink.alias.clone().as_str());
imp.resetVolumePercentage.set_text(&percentage); imp.resetVolumePercentage.set_text(&percentage);
imp.resetVolumeSlider.set_value(*volume as f64); imp.resetVolumeSlider.set_value(*volume as f64);
}); });
@ -531,7 +521,7 @@ pub fn start_output_box_listener(conn: Connection, sink_box: Arc<SinkBox>) -> Co
.set_icon_name("audio-volume-high-symbolic"); .set_icon_name("audio-volume-high-symbolic");
} }
let name = ir.stream.application_name.clone() + ": " + ir.stream.name.as_str(); let name = ir.stream.application_name.clone() + ": " + ir.stream.name.as_str();
imp.resetSinkName.set_text(name.as_str()); imp.resetSinkSelection.set_title(name.as_str());
let volume = ir.stream.volume.first().unwrap_or(&0_u32); let volume = ir.stream.volume.first().unwrap_or(&0_u32);
let fraction = (*volume as f64 / 655.36).round(); let fraction = (*volume as f64 / 655.36).round();
let percentage = (fraction).to_string() + "%"; let percentage = (fraction).to_string() + "%";
@ -540,7 +530,7 @@ pub fn start_output_box_listener(conn: Connection, sink_box: Arc<SinkBox>) -> Co
let map = output_box_imp.resetSinkMap.read().unwrap(); let map = output_box_imp.resetSinkMap.read().unwrap();
let index = map.get(&alias); let index = map.get(&alias);
if index.is_some() { if index.is_some() {
imp.resetSelectedSink.set_selected(index.unwrap().1); imp.resetSinkSelection.set_selected(index.unwrap().1);
} }
}); });
}); });

View file

@ -37,11 +37,11 @@ pub struct SinkBox {
#[template_child] #[template_child]
pub resetSinks: TemplateChild<Box>, pub resetSinks: TemplateChild<Box>,
#[template_child] #[template_child]
pub resetInputStreamButton: TemplateChild<ListEntry>, pub resetInputStreamButton: TemplateChild<ActionRow>,
#[template_child] #[template_child]
pub resetInputStreams: TemplateChild<Box>, pub resetInputStreams: TemplateChild<Box>,
#[template_child] #[template_child]
pub resetInputCardsBackButton: TemplateChild<ListEntry>, pub resetInputCardsBackButton: TemplateChild<ActionRow>,
#[template_child] #[template_child]
pub resetCards: TemplateChild<PreferencesGroup>, pub resetCards: TemplateChild<PreferencesGroup>,
pub resetDefaultCheckButton: Arc<CheckButton>, pub resetDefaultCheckButton: Arc<CheckButton>,

View file

@ -3,7 +3,7 @@ use std::time::{Duration, SystemTime};
use adw::glib; use adw::glib;
use adw::glib::Object; use adw::glib::Object;
use adw::prelude::{ButtonExt, CheckButtonExt, RangeExt}; use adw::prelude::{ButtonExt, CheckButtonExt, PreferencesRowExt, RangeExt};
use dbus::blocking::Connection; use dbus::blocking::Connection;
use dbus::Error; use dbus::Error;
use glib::subclass::types::ObjectSubclassIsExt; use glib::subclass::types::ObjectSubclassIsExt;
@ -15,7 +15,7 @@ use super::sinkEntryImpl;
glib::wrapper! { glib::wrapper! {
pub struct SinkEntry(ObjectSubclass<sinkEntryImpl::SinkEntry>) pub struct SinkEntry(ObjectSubclass<sinkEntryImpl::SinkEntry>)
@extends gtk::Box, gtk::Widget, @extends adw::PreferencesGroup, gtk::Widget,
@implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Orientable; @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Orientable;
} }
@ -26,7 +26,7 @@ impl SinkEntry {
// TODO handle events // TODO handle events
{ {
let imp = obj.imp(); let imp = obj.imp();
imp.resetSinkName.set_text(stream.alias.clone().as_str()); imp.resetSinkName.set_title(stream.alias.clone().as_str());
let name = Arc::new(stream.name.clone()); let name = Arc::new(stream.name.clone());
let volume = stream.volume.first().unwrap_or(&0_u32); let volume = stream.volume.first().unwrap_or(&0_u32);
let fraction = (*volume as f64 / 655.36).round(); let fraction = (*volume as f64 / 655.36).round();

View file

@ -1,6 +1,8 @@
use std::cell::RefCell; use std::cell::RefCell;
use std::sync::Arc; use std::sync::Arc;
use std::time::SystemTime; use std::time::SystemTime;
use adw::{ActionRow, PreferencesGroup};
use adw::subclass::prelude::PreferencesGroupImpl;
use crate::components::output::sinkEntry; use crate::components::output::sinkEntry;
use gtk::subclass::prelude::*; use gtk::subclass::prelude::*;
@ -12,7 +14,7 @@ use ReSet_Lib::audio::audio::Sink;
#[template(resource = "/org/Xetibo/ReSet/resetSinkEntry.ui")] #[template(resource = "/org/Xetibo/ReSet/resetSinkEntry.ui")]
pub struct SinkEntry { pub struct SinkEntry {
#[template_child] #[template_child]
pub resetSinkName: TemplateChild<Label>, pub resetSinkName: TemplateChild<ActionRow>,
#[template_child] #[template_child]
pub resetSelectedSink: TemplateChild<CheckButton>, pub resetSelectedSink: TemplateChild<CheckButton>,
#[template_child] #[template_child]
@ -32,7 +34,7 @@ impl ObjectSubclass for SinkEntry {
const ABSTRACT: bool = false; const ABSTRACT: bool = false;
const NAME: &'static str = "resetSinkEntry"; const NAME: &'static str = "resetSinkEntry";
type Type = sinkEntry::SinkEntry; type Type = sinkEntry::SinkEntry;
type ParentType = gtk::Box; type ParentType = PreferencesGroup;
fn class_init(klass: &mut Self::Class) { fn class_init(klass: &mut Self::Class) {
klass.bind_template(); klass.bind_template();
@ -43,7 +45,7 @@ impl ObjectSubclass for SinkEntry {
} }
} }
impl BoxImpl for SinkEntry {} impl PreferencesGroupImpl for SinkEntry {}
impl ObjectImpl for SinkEntry {} impl ObjectImpl for SinkEntry {}

37
src/components/utils.rs Normal file
View file

@ -0,0 +1,37 @@
use adw::ComboRow;
use adw::gdk::pango::EllipsizeMode;
use adw::prelude::ListModelExtManual;
use glib::{Cast, Object};
use gtk::{Align, SignalListItemFactory, StringObject};
use gtk::prelude::{GObjectPropertyExpressionExt, ListBoxRowExt, ListItemExt, WidgetExt};
pub fn createDropdownLabelFactory() -> SignalListItemFactory {
let factory = SignalListItemFactory::new();
factory.connect_setup(|_, item| {
let item = item.downcast_ref::<gtk::ListItem>().unwrap();
let label = gtk::Label::new(None);
label.set_halign(Align::Start);
item.property_expression("item")
.chain_property::<StringObject>("string")
.bind(&label, "label", gtk::Widget::NONE);
item.set_child(Some(&label));
});
factory
}
pub fn setComboRowEllipsis(element: ComboRow) {
for (i, child) in element.child().unwrap().observe_children().iter::<Object>().enumerate() {
if i == 2 {
if let Ok(object) = child {
if let Some(item) = object.downcast_ref::<gtk::Box>() {
if let Some(widget) = item.first_child() {
if let Some(label) = widget.downcast_ref::<gtk::Label>() {
label.set_ellipsize(EllipsizeMode::End);
label.set_max_width_chars(1);
}
}
}
}
}
}
}

View file

@ -10,4 +10,5 @@ pub mod wifiOptionsImpl;
pub mod wifiAddressEntry; pub mod wifiAddressEntry;
pub mod wifiAddressEntryImpl; pub mod wifiAddressEntryImpl;
pub mod wifiRouteEntry; pub mod wifiRouteEntry;
pub mod wifiRouteEntryImpl; pub mod wifiRouteEntryImpl;
pub mod utils;

View file

@ -10,6 +10,7 @@ use glib::subclass::types::ObjectSubclassIsExt;
use glib::{clone, PropertySet}; use glib::{clone, PropertySet};
use gtk::gio; use gtk::gio;
use gtk::prelude::ListBoxRowExt; use gtk::prelude::ListBoxRowExt;
use crate::components::wifi::wifiBoxImpl::WifiBox;
glib::wrapper! { glib::wrapper! {
pub struct SavedWifiEntry(ObjectSubclass<savedWifiEntryImpl::SavedWifiEntry>) pub struct SavedWifiEntry(ObjectSubclass<savedWifiEntryImpl::SavedWifiEntry>)
@ -18,11 +19,17 @@ glib::wrapper! {
} }
impl SavedWifiEntry { impl SavedWifiEntry {
pub fn new(name: &String, path: Path<'static>) -> Self { pub fn new(name: &String, path: Path<'static>, wifiBox: &WifiBox) -> Self {
let entry: SavedWifiEntry = Object::builder().build(); let entry: SavedWifiEntry = Object::builder().build();
entry.set_activatable(false); entry.set_activatable(false);
let entryImp = entry.imp(); let entryImp = entry.imp();
// TODO handle edit
entryImp.resetEditSavedWifiButton.connect_clicked(clone!(@ weak entryImp, @ weak wifiBox => move |_| {
// TODO accesspoint has to be saved somewhere i guess
// let _option = getConnectionSettings(entryImp.accessPoint.borrow().associated_connection.clone());
// wifiBox.resetWifiNavigation.push(&*WifiOptions::new(_option));
}));
entryImp.resetSavedWifiLabel.set_text(name); entryImp.resetSavedWifiLabel.set_text(name);
entryImp.resetConnectionPath.set(path); entryImp.resetConnectionPath.set(path);
entryImp.resetDeleteSavedWifiButton.connect_clicked( entryImp.resetDeleteSavedWifiButton.connect_clicked(

View file

@ -6,6 +6,7 @@ use adw::subclass::prelude::ActionRowImpl;
use dbus::Path; use dbus::Path;
use gtk::subclass::prelude::*; use gtk::subclass::prelude::*;
use gtk::{glib, Button, CompositeTemplate, Label}; use gtk::{glib, Button, CompositeTemplate, Label};
use ReSet_Lib::network::network::AccessPoint;
use super::savedWifiEntry; use super::savedWifiEntry;
@ -20,6 +21,7 @@ pub struct SavedWifiEntry {
#[template_child] #[template_child]
pub resetSavedWifiLabel: TemplateChild<Label>, pub resetSavedWifiLabel: TemplateChild<Label>,
pub resetConnectionPath: RefCell<Path<'static>>, pub resetConnectionPath: RefCell<Path<'static>>,
pub accessPoint: RefCell<AccessPoint>,
} }
unsafe impl Send for SavedWifiEntry {} unsafe impl Send for SavedWifiEntry {}

View file

@ -0,0 +1,29 @@
use std::collections::HashMap;
use std::time::Duration;
use dbus::arg::{RefArg};
use dbus::blocking::Connection;
use dbus::Error;
use dbus::Path;
use ReSet_Lib::network::connection::Connection as ResetConnection;
pub fn getConnectionSettings(path: Path<'static>) -> ResetConnection {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.xetibo.ReSet",
"/org/xetibo/ReSet",
Duration::from_millis(1000),
);
let res: Result<
(HashMap<String, HashMap<String, dbus::arg::Variant<Box<dyn RefArg>>>>,),
Error,
> = proxy.method_call("org.xetibo.ReSet", "GetConnectionSettings", (path,));
if res.is_err() {
ResetConnection::default();
}
let (res,) = res.unwrap();
let res = ResetConnection::convert_from_propmap(res);
if res.is_err() {
ResetConnection::default();
}
res.unwrap()
}

View file

@ -1,5 +1,3 @@
use std::collections::HashMap;
use std::sync::atomic::Ordering; use std::sync::atomic::Ordering;
use std::sync::Arc; use std::sync::Arc;
@ -24,6 +22,7 @@ use gtk::prelude::{ActionableExt, WidgetExt};
use ReSet_Lib::network::network::{AccessPoint, WifiStrength}; use ReSet_Lib::network::network::{AccessPoint, WifiStrength};
use ReSet_Lib::signals::{AccessPointAdded}; use ReSet_Lib::signals::{AccessPointAdded};
use ReSet_Lib::signals::{AccessPointChanged, AccessPointRemoved}; use ReSet_Lib::signals::{AccessPointChanged, AccessPointRemoved};
use crate::components::utils::setComboRowEllipsis;
use crate::components::wifi::wifiBoxImpl; use crate::components::wifi::wifiBoxImpl;
@ -31,7 +30,6 @@ use crate::components::wifi::wifiEntry::WifiEntry;
use super::savedWifiEntry::SavedWifiEntry; use super::savedWifiEntry::SavedWifiEntry;
use ReSet_Lib::network::connection::Connection as ResetConnection;
glib::wrapper! { glib::wrapper! {
pub struct WifiBox(ObjectSubclass<wifiBoxImpl::WifiBox>) pub struct WifiBox(ObjectSubclass<wifiBoxImpl::WifiBox>)
@ -57,9 +55,9 @@ impl WifiBox {
.resetSavedNetworks .resetSavedNetworks
.set_action_target_value(Some(&Variant::from("saved"))); .set_action_target_value(Some(&Variant::from("saved")));
selfImp selfImp.resetAvailableNetworks.set_activatable(true);
.resetAvailableNetworks selfImp.resetAvailableNetworks.set_action_name(Some("navigation.pop"));
.set_action_name(Some("navigation.pop")); setComboRowEllipsis(selfImp.resetWiFiDevice.get());
} }
} }
@ -103,7 +101,7 @@ pub fn show_stored_connections(wifiBox: Arc<WifiBox>) {
// TODO include button for settings // TODO include button for settings
let name = let name =
&String::from_utf8(connection.1).unwrap_or_else(|_| String::from("")); &String::from_utf8(connection.1).unwrap_or_else(|_| String::from(""));
let entry = SavedWifiEntry::new(name, connection.0); let entry = SavedWifiEntry::new(name, connection.0, selfImp);
selfImp.resetStoredWifiList.add(&entry); selfImp.resetStoredWifiList.add(&entry);
} }
}); });
@ -154,28 +152,6 @@ pub fn get_stored_connections() -> Vec<(Path<'static>, Vec<u8>)> {
connections connections
} }
pub fn getConnectionSettings(path: Path<'static>) -> ResetConnection {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
"org.xetibo.ReSet",
"/org/xetibo/ReSet",
Duration::from_millis(1000),
);
let res: Result<
(HashMap<String, HashMap<String, dbus::arg::Variant<Box<dyn RefArg>>>>,),
Error,
> = proxy.method_call("org.xetibo.ReSet", "GetConnectionSettings", (path,));
if res.is_err() {
ResetConnection::default();
}
let (res,) = res.unwrap();
let res = ResetConnection::convert_from_propmap(res);
if res.is_err() {
ResetConnection::default();
}
res.unwrap()
}
pub fn start_event_listener(listeners: Arc<Listeners>, wifi_box: Arc<WifiBox>) { pub fn start_event_listener(listeners: Arc<Listeners>, wifi_box: Arc<WifiBox>) {
gio::spawn_blocking(move || { gio::spawn_blocking(move || {
if listeners.network_listener.load(Ordering::SeqCst) { if listeners.network_listener.load(Ordering::SeqCst) {

View file

@ -29,7 +29,7 @@ pub struct WifiBox {
#[template_child] #[template_child]
pub resetStoredWifiList: TemplateChild<PreferencesGroup>, pub resetStoredWifiList: TemplateChild<PreferencesGroup>,
#[template_child] #[template_child]
pub resetAvailableNetworks: TemplateChild<ListEntry>, pub resetAvailableNetworks: TemplateChild<ActionRow>,
pub wifiEntries: Arc<Mutex<HashMap<Vec<u8>, Arc<WifiEntry>>>>, pub wifiEntries: Arc<Mutex<HashMap<Vec<u8>, Arc<WifiEntry>>>>,
pub wifiEntriesPath: Arc<Mutex<HashMap<Path<'static>, Arc<WifiEntry>>>>, pub wifiEntriesPath: Arc<Mutex<HashMap<Path<'static>, Arc<WifiEntry>>>>,
pub savedWifiEntries: Arc<Mutex<Vec<ListEntry>>>, pub savedWifiEntries: Arc<Mutex<Vec<ListEntry>>>,

View file

@ -12,8 +12,8 @@ use glib::clone;
use gtk::gio; use gtk::gio;
use gtk::prelude::{ListBoxRowExt, WidgetExt}; use gtk::prelude::{ListBoxRowExt, WidgetExt};
use ReSet_Lib::network::network::{AccessPoint, WifiStrength}; use ReSet_Lib::network::network::{AccessPoint, WifiStrength};
use crate::components::wifi::utils::getConnectionSettings;
use crate::components::wifi::wifiBox::getConnectionSettings;
use crate::components::wifi::wifiBoxImpl::WifiBox; use crate::components::wifi::wifiBoxImpl::WifiBox;
use crate::components::wifi::wifiEntryImpl; use crate::components::wifi::wifiEntryImpl;
use crate::components::wifi::wifiOptions::WifiOptions; use crate::components::wifi::wifiOptions::WifiOptions;

View file

@ -5,8 +5,9 @@ use adw::glib::Object;
use adw::prelude::{ActionRowExt, ComboRowExt, PreferencesGroupExt}; use adw::prelude::{ActionRowExt, ComboRowExt, PreferencesGroupExt};
use adw::subclass::prelude::ObjectSubclassIsExt; use adw::subclass::prelude::ObjectSubclassIsExt;
use dbus::arg::PropMap; use dbus::arg::PropMap;
use glib::{PropertySet, ObjectExt}; use glib::{clone, PropertySet};
use gtk::prelude::{EditableExt, WidgetExt}; use gtk::prelude::{EditableExt, WidgetExt};
use regex::Regex;
use ReSet_Lib::network::connection::{Connection, Enum, TypeSettings}; use ReSet_Lib::network::connection::{Connection, Enum, TypeSettings};
use crate::components::wifi::wifiAddressEntry::WifiAddressEntry; use crate::components::wifi::wifiAddressEntry::WifiAddressEntry;
@ -24,7 +25,8 @@ impl WifiOptions {
let wifiOption: Arc<WifiOptions> = Arc::new(Object::builder().build()); let wifiOption: Arc<WifiOptions> = Arc::new(Object::builder().build());
wifiOption.imp().connection.set(connection); wifiOption.imp().connection.set(connection);
wifiOption.initializeUI(); wifiOption.initializeUI();
setupCallbacks(wifiOption) setupCallbacks(&wifiOption);
wifiOption
} }
pub fn initializeUI(&self) { pub fn initializeUI(&self) {
@ -35,8 +37,25 @@ impl WifiOptions {
selfImp.resetWifiAutoConnect.set_active(conn.settings.autoconnect); selfImp.resetWifiAutoConnect.set_active(conn.settings.autoconnect);
selfImp.resetWifiMetered.set_active(conn.settings.metered != -1); selfImp.resetWifiMetered.set_active(conn.settings.metered != -1);
match &conn.device { match &conn.device {
TypeSettings::WIFI(_wifi) => {} TypeSettings::WIFI(wifi) => {
TypeSettings::ETHERNET(_ethernet) => {} selfImp.resetWifiLinkSpeed.set_visible(false);
selfImp.resetWifiIP4Addr.set_visible(false);
selfImp.resetWifiIP6Addr.set_visible(false);
selfImp.resetWifiDNS.set_visible(false);
selfImp.resetWifiGateway.set_visible(false);
selfImp.resetWifiLastUsed.set_visible(true);
selfImp.resetWifiMac.set_subtitle(&*wifi.cloned_mac_address);
}
TypeSettings::ETHERNET(ethernet) => {
selfImp.resetWifiLinkSpeed.set_visible(true);
selfImp.resetWifiIP4Addr.set_visible(true);
selfImp.resetWifiIP6Addr.set_visible(true);
selfImp.resetWifiDNS.set_visible(true);
selfImp.resetWifiGateway.set_visible(true);
selfImp.resetWifiLastUsed.set_visible(false);
selfImp.resetWifiMac.set_subtitle(&*ethernet.cloned_mac_address);
selfImp.resetWifiLinkSpeed.set_subtitle(&*ethernet.speed.to_string());
}
TypeSettings::VPN(_vpn) => {} TypeSettings::VPN(_vpn) => {}
TypeSettings::None => {} TypeSettings::None => {}
}; };
@ -147,20 +166,51 @@ impl WifiOptions {
} }
} }
fn setupCallbacks(wifiOptions: Arc<WifiOptions>) -> Arc<WifiOptions> { fn setupCallbacks(wifiOptions: &Arc<WifiOptions>) {
let imp = wifiOptions.imp(); let imp = wifiOptions.imp();
let wifiOptionsRef = wifiOptions.clone();
let wifiOptionsRef2 = wifiOptions.clone();
imp.resetIP4Method.connect_selected_notify(move |dropdown| { // General
imp.resetWifiAutoConnect.connect_active_notify(clone!(@weak imp => move |x| {
imp.connection.borrow_mut().settings.autoconnect = x.is_active();
}));
imp.resetWifiMetered.connect_active_notify(clone!(@weak imp => move |x| {
imp.connection.borrow_mut().settings.metered = if x.is_active() { 1 } else { 2 };
}));
// IPv4
let wifiOptionsIP4 = wifiOptions.clone();
imp.resetIP4Method.connect_selected_notify(clone!(@weak imp => move |dropdown| {
let selected = dropdown.selected(); let selected = dropdown.selected();
wifiOptionsRef.setIP4Visibility(selected); wifiOptionsIP4.setIP4Visibility(selected);
}); }));
imp.resetIP6Method.connect_selected_notify(move |dropdown| {
let dnsRegex = Regex::new(r"^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$").unwrap();
imp.resetIP4DNS.connect_changed(clone!(@weak imp => move |entry| {
let dnsInput = entry.text();
let mut conn = imp.connection.borrow_mut();
conn.ipv4.dns.clear();
if dnsInput.as_str().is_empty() {
imp.resetIP4DNS.remove_css_class("error");
return;
}
for dnsEntry in dnsInput.as_str().split(',').collect::<Vec<&str>>() {
if dnsRegex.is_match(dnsEntry) {
imp.resetIP4DNS.remove_css_class("error");
let dnsParts = dnsEntry.split('.')
.map(|s| s.parse::<u8>().unwrap())
.collect::<Vec<u8>>();
conn.ipv4.dns.push(dnsParts);
} else {
imp.resetIP4DNS.add_css_class("error");
}
}
}));
// IPv6
let wifiOptionsIP6 = wifiOptions.clone();
imp.resetIP6Method.connect_selected_notify(clone!(@weak imp => move |dropdown| {
let selected = dropdown.selected(); let selected = dropdown.selected();
wifiOptionsRef2.setIP6Visibility(selected); wifiOptionsIP6.setIP6Visibility(selected);
}); }));
wifiOptions // Security
} }
pub fn getValueFromKey(map: &PropMap, key: &str) -> String { pub fn getValueFromKey(map: &PropMap, key: &str) -> String {

View file

@ -4,7 +4,7 @@ use adw::{ActionRow, ComboRow, EntryRow, NavigationPage, PreferencesGroup, Switc
use adw::subclass::prelude::NavigationPageImpl; use adw::subclass::prelude::NavigationPageImpl;
use crate::components::wifi::{wifiOptions}; use crate::components::wifi::{wifiOptions};
use gtk::subclass::prelude::*; use gtk::subclass::prelude::*;
use gtk::{glib, CompositeTemplate}; use gtk::{glib, CompositeTemplate, Button};
use ReSet_Lib::network::connection::Connection; use ReSet_Lib::network::connection::Connection;
#[allow(non_snake_case)] #[allow(non_snake_case)]
@ -27,6 +27,8 @@ pub struct WifiOptions {
#[template_child] #[template_child]
pub resetWifiDNS: TemplateChild<ActionRow>, pub resetWifiDNS: TemplateChild<ActionRow>,
#[template_child] #[template_child]
pub resetWifiLastUsed: TemplateChild<ActionRow>,
#[template_child]
pub resetWifiAutoConnect: TemplateChild<SwitchRow>, pub resetWifiAutoConnect: TemplateChild<SwitchRow>,
#[template_child] #[template_child]
pub resetWifiMetered: TemplateChild<SwitchRow>, pub resetWifiMetered: TemplateChild<SwitchRow>,
@ -54,6 +56,8 @@ pub struct WifiOptions {
pub resetIP6RoutesGroup: TemplateChild<PreferencesGroup>, pub resetIP6RoutesGroup: TemplateChild<PreferencesGroup>,
// Security // Security
// Misc // Misc
#[template_child]
pub wifiOptionsApplyButton: TemplateChild<Button>,
pub connection: Rc<RefCell<Connection>> pub connection: Rc<RefCell<Connection>>
} }

View file

@ -131,33 +131,16 @@
<object class="GtkBox"> <object class="GtkBox">
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<child> <child>
<object class="GtkListBox"> <object class="AdwPreferencesGroup">
<property name="css-classes">boxed-list</property>
<property name="margin-bottom">10</property>
<property name="margin-end">5</property>
<property name="margin-start">5</property>
<property name="margin-top">5</property>
<property name="show-separators">True</property>
<property name="valign">start</property>
<child> <child>
<object class="resetListBoxRow" id="resetOutputStreamButton"> <object class="AdwActionRow" id="resetOutputStreamButton">
<property name="title">Input Streams</property>
<child> <child>
<object class="GtkBox"> <object class="GtkImage">
<property name="height-request">40</property> <property name="halign">end</property>
<child> <property name="hexpand">True</property>
<object class="GtkLabel"> <property name="icon-name">go-previous-symbolic</property>
<property name="label">Input Streams</property> <property name="margin-end">5</property>
<property name="margin-start">5</property>
</object>
</child>
<child>
<object class="GtkImage">
<property name="halign">end</property>
<property name="hexpand">True</property>
<property name="icon-name">go-previous-symbolic</property>
<property name="margin-end">5</property>
</object>
</child>
</object> </object>
</child> </child>
</object> </object>
@ -190,33 +173,16 @@
<object class="GtkBox"> <object class="GtkBox">
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<child> <child>
<object class="GtkListBox"> <object class="AdwPreferencesGroup">
<property name="css-classes">boxed-list</property>
<property name="margin-bottom">10</property>
<property name="margin-end">5</property>
<property name="margin-start">5</property>
<property name="margin-top">5</property>
<property name="show-separators">True</property>
<property name="valign">start</property>
<child> <child>
<object class="resetListBoxRow" id="resetInputCardsBackButton"> <object class="AdwActionRow" id="resetInputCardsBackButton">
<property name="title">Input Streams</property>
<child> <child>
<object class="GtkBox"> <object class="GtkImage">
<property name="height-request">40</property> <property name="halign">end</property>
<child> <property name="hexpand">True</property>
<object class="GtkLabel"> <property name="icon-name">go-previous-symbolic</property>
<property name="label">Input Streams</property> <property name="margin-end">5</property>
<property name="margin-start">5</property>
</object>
</child>
<child>
<object class="GtkImage">
<property name="halign">end</property>
<property name="hexpand">True</property>
<property name="icon-name">go-previous-symbolic</property>
<property name="margin-end">5</property>
</object>
</child>
</object> </object>
</child> </child>
</object> </object>

View file

@ -131,33 +131,16 @@
<object class="GtkBox"> <object class="GtkBox">
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<child> <child>
<object class="GtkListBox"> <object class="AdwPreferencesGroup">
<property name="css-classes">boxed-list</property>
<property name="margin-bottom">10</property>
<property name="margin-end">5</property>
<property name="margin-start">5</property>
<property name="margin-top">5</property>
<property name="show-separators">True</property>
<property name="valign">start</property>
<child> <child>
<object class="resetListBoxRow" id="resetInputStreamButton"> <object class="AdwActionRow" id="resetInputStreamButton">
<property name="title">Output Streams</property>
<child> <child>
<object class="GtkBox"> <object class="GtkImage">
<property name="height-request">40</property> <property name="halign">end</property>
<child> <property name="hexpand">True</property>
<object class="GtkLabel"> <property name="icon-name">go-previous-symbolic</property>
<property name="label">Output Streams</property> <property name="margin-end">5</property>
<property name="margin-start">5</property>
</object>
</child>
<child>
<object class="GtkImage">
<property name="halign">end</property>
<property name="hexpand">True</property>
<property name="icon-name">go-previous-symbolic</property>
<property name="margin-end">5</property>
</object>
</child>
</object> </object>
</child> </child>
</object> </object>
@ -193,33 +176,16 @@
<object class="GtkBox"> <object class="GtkBox">
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<child> <child>
<object class="GtkListBox"> <object class="AdwPreferencesGroup">
<property name="css-classes">boxed-list</property>
<property name="margin-bottom">10</property>
<property name="margin-end">5</property>
<property name="margin-start">5</property>
<property name="margin-top">5</property>
<property name="show-separators">True</property>
<property name="valign">start</property>
<child> <child>
<object class="resetListBoxRow" id="resetInputCardsBackButton"> <object class="AdwActionRow" id="resetInputCardsBackButton">
<property name="title">Output Streams</property>
<child> <child>
<object class="GtkBox"> <object class="GtkImage">
<property name="height-request">40</property> <property name="halign">end</property>
<child> <property name="hexpand">True</property>
<object class="GtkLabel"> <property name="icon-name">go-previous-symbolic</property>
<property name="label">Output Streams</property> <property name="margin-end">5</property>
<property name="margin-start">5</property>
</object>
</child>
<child>
<object class="GtkImage">
<property name="halign">end</property>
<property name="hexpand">True</property>
<property name="icon-name">go-previous-symbolic</property>
<property name="margin-end">5</property>
</object>
</child>
</object> </object>
</child> </child>
</object> </object>
@ -229,11 +195,11 @@
<child> <child>
<object class="GtkLabel"/> <object class="GtkLabel"/>
</child> </child>
</object> <child>
</child> <object class="AdwPreferencesGroup" id="resetCards">
<child> <property name="title">Devices</property>
<object class="AdwPreferencesGroup" id="resetCards"> </object>
<property name="title">Devices</property> </child>
</object> </object>
</child> </child>
</object> </object>

View file

@ -2,71 +2,72 @@
<!-- Created with Cambalache 0.17.0 --> <!-- Created with Cambalache 0.17.0 -->
<interface> <interface>
<requires lib="gtk" version="4.12"/> <requires lib="gtk" version="4.12"/>
<template class="resetInputStreamEntry" parent="GtkBox"> <requires lib="libadwaita" version="1.4"/>
<property name="margin-bottom">5</property> <template class="resetInputStreamEntry" parent="AdwPreferencesGroup">
<property name="margin-end">5</property> <property name="margin-bottom">10</property>
<property name="margin-start">5</property>
<property name="margin-top">5</property>
<property name="orientation">vertical</property>
<child> <child>
<object class="GtkBox"> <object class="GtkSeparator">
<property name="margin-bottom">5</property> <property name="margin-top">10</property>
<child>
<object class="GtkLabel" id="resetSinkName">
<property name="label">text</property>
<property name="margin-start">5</property>
<property name="wrap">True</property>
</object>
</child>
<child>
<object class="GtkDropDown" id="resetSelectedSink">
<property name="halign">end</property>
<property name="hexpand">True</property>
<property name="margin-end">5</property>
</object>
</child>
</object> </object>
</child> </child>
<child> <child>
<object class="GtkBox"> <object class="AdwComboRow" id="resetSinkSelection">
<property name="margin-bottom">5</property> <property name="css-classes">audioRow</property>
<property name="margin-top">5</property> <property name="title">asadf</property>
<child> <property name="use-subtitle">True</property>
<object class="GtkButton" id="resetSinkMute"> </object>
<property name="icon-name">audio-volume-high-symbolic</property> </child>
<property name="margin-end">5</property> <child>
<property name="valign">center</property> <object class="AdwActionRow">
</object> <property name="child">
</child> <object class="GtkBox">
<child> <property name="orientation">vertical</property>
<object class="GtkScale" id="resetVolumeSlider"> <child>
<property name="adjustment"> <object class="GtkBox">
<object class="GtkAdjustment"> <property name="margin-bottom">5</property>
<property name="page-increment">2005.4016</property> <property name="margin-top">5</property>
<property name="step-increment">2005.4016</property> <child>
<property name="upper">100270.08</property> <object class="GtkButton" id="resetSinkMute">
<property name="icon-name">audio-input-microphone-symbolic</property>
<property name="margin-end">5</property>
<property name="valign">center</property>
</object>
</child>
<child>
<object class="GtkScale" id="resetVolumeSlider">
<property name="adjustment">
<object class="GtkAdjustment">
<property name="page-increment">2005.4016</property>
<property name="step-increment">2005.4016</property>
<property name="upper">100270.08</property>
</object>
</property>
<property name="hexpand">True</property>
<property name="valign">center</property>
<property name="value-pos">bottom</property>
<marks>
<mark position="bottom" value="65536.0">100%</mark>
</marks>
</object>
</child>
<child>
<object class="GtkLabel" id="resetVolumePercentage">
<property name="label">100%</property>
<property name="lines">1</property>
<property name="width-request">40</property>
</object>
</child>
</object> </object>
</property> </child>
<property name="hexpand">True</property> <child>
<property name="valign">center</property> <object class="GtkProgressBar" id="resetVolumeMeter">
<property name="value-pos">bottom</property> <property name="margin-top">5</property>
<marks> </object>
<mark position="bottom" value="65536.0">100%</mark> </child>
</marks>
</object> </object>
</child> </property>
<child> <property name="css-classes">audioRow
<object class="GtkLabel" id="resetVolumePercentage"> </property>
<property name="label">100%</property>
<property name="lines">1</property>
<property name="width-request">40</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkProgressBar" id="resetVolumeMeter">
<property name="margin-top">5</property>
</object> </object>
</child> </child>
</template> </template>

View file

@ -2,71 +2,71 @@
<!-- Created with Cambalache 0.17.0 --> <!-- Created with Cambalache 0.17.0 -->
<interface> <interface>
<requires lib="gtk" version="4.12"/> <requires lib="gtk" version="4.12"/>
<template class="resetOutputStreamEntry" parent="GtkBox"> <requires lib="libadwaita" version="1.4"/>
<property name="margin-bottom">5</property> <template class="resetOutputStreamEntry" parent="AdwPreferencesGroup">
<property name="margin-end">5</property>
<property name="margin-start">5</property>
<property name="margin-top">5</property>
<property name="orientation">vertical</property>
<child> <child>
<object class="GtkBox"> <object class="GtkSeparator">
<property name="margin-bottom">5</property> <property name="margin-top">10</property>
<child>
<object class="GtkLabel" id="resetSourceName">
<property name="label">text</property>
<property name="margin-start">5</property>
<property name="wrap">True</property>
</object>
</child>
<child>
<object class="GtkDropDown" id="resetSelectedSource">
<property name="halign">end</property>
<property name="hexpand">True</property>
<property name="margin-end">5</property>
</object>
</child>
</object> </object>
</child> </child>
<child> <child>
<object class="GtkBox"> <object class="AdwComboRow" id="resetSourceSelection">
<property name="margin-bottom">5</property> <property name="css-classes">audioRow</property>
<property name="margin-top">5</property> <property name="title">asadf</property>
<child> <property name="use-subtitle">True</property>
<object class="GtkButton" id="resetSourceMute"> </object>
<property name="icon-name">audio-input-microphone-symbolic</property> </child>
<property name="margin-end">5</property> <child>
<property name="valign">center</property> <object class="AdwActionRow">
</object> <property name="child">
</child> <object class="GtkBox">
<child> <property name="orientation">vertical</property>
<object class="GtkScale" id="resetVolumeSlider"> <child>
<property name="adjustment"> <object class="GtkBox">
<object class="GtkAdjustment"> <property name="margin-bottom">5</property>
<property name="page-increment">2005.4016</property> <property name="margin-top">5</property>
<property name="step-increment">2005.4016</property> <child>
<property name="upper">100270.08</property> <object class="GtkButton" id="resetSourceMute">
<property name="icon-name">audio-input-microphone-symbolic</property>
<property name="margin-end">5</property>
<property name="valign">center</property>
</object>
</child>
<child>
<object class="GtkScale" id="resetVolumeSlider">
<property name="adjustment">
<object class="GtkAdjustment">
<property name="page-increment">2005.4016</property>
<property name="step-increment">2005.4016</property>
<property name="upper">100270.08</property>
</object>
</property>
<property name="hexpand">True</property>
<property name="valign">center</property>
<property name="value-pos">bottom</property>
<marks>
<mark position="bottom" value="65536.0">100%</mark>
</marks>
</object>
</child>
<child>
<object class="GtkLabel" id="resetVolumePercentage">
<property name="label">100%</property>
<property name="lines">1</property>
<property name="width-request">40</property>
</object>
</child>
</object> </object>
</property> </child>
<property name="hexpand">True</property> <child>
<property name="valign">center</property> <object class="GtkProgressBar" id="resetVolumeMeter">
<property name="value-pos">bottom</property> <property name="margin-top">5</property>
<marks> </object>
<mark position="bottom" value="65536.0">100%</mark> </child>
</marks>
</object> </object>
</child> </property>
<child> <property name="css-classes">audioRow
<object class="GtkLabel" id="resetVolumePercentage"> </property>
<property name="label">100%</property>
<property name="lines">1</property>
<property name="width-request">40</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkProgressBar" id="resetVolumeMeter">
<property name="margin-top">5</property>
</object> </object>
</child> </child>
</template> </template>

View file

@ -2,22 +2,13 @@
<!-- Created with Cambalache 0.17.0 --> <!-- Created with Cambalache 0.17.0 -->
<interface> <interface>
<requires lib="gtk" version="4.12"/> <requires lib="gtk" version="4.12"/>
<template class="resetSinkEntry" parent="GtkBox"> <requires lib="libadwaita" version="1.3"/>
<property name="margin-bottom">5</property> <template class="resetSinkEntry" parent="AdwPreferencesGroup">
<property name="margin-end">5</property>
<property name="margin-start">5</property>
<property name="margin-top">5</property>
<property name="orientation">vertical</property>
<child> <child>
<object class="GtkBox"> <object class="AdwActionRow" id="resetSinkName">
<property name="margin-bottom">5</property> <property name="css-classes">audioRow</property>
<child> <property name="title">aaaaaaaaaaaaaaa</property>
<object class="GtkLabel" id="resetSinkName"> <property name="title-lines">3</property>
<property name="label">text</property>
<property name="margin-start">5</property>
<property name="wrap">True</property>
</object>
</child>
<child> <child>
<object class="GtkCheckButton" id="resetSelectedSink"> <object class="GtkCheckButton" id="resetSelectedSink">
<property name="halign">end</property> <property name="halign">end</property>
@ -28,44 +19,61 @@
</object> </object>
</child> </child>
<child> <child>
<object class="GtkBox"> <object class="AdwActionRow">
<property name="margin-bottom">5</property> <property name="child">
<property name="margin-top">5</property> <object class="GtkBox">
<child> <property name="orientation">vertical</property>
<object class="GtkButton" id="resetSinkMute"> <child>
<property name="icon-name">audio-volume-high-symbolic</property> <object class="GtkBox">
<property name="margin-end">5</property> <property name="margin-bottom">5</property>
<property name="valign">center</property> <property name="margin-top">5</property>
</object> <child>
</child> <object class="GtkButton" id="resetSinkMute">
<child> <property name="icon-name">audio-input-microphone-symbolic</property>
<object class="GtkScale" id="resetVolumeSlider"> <property name="margin-end">5</property>
<property name="adjustment"> <property name="valign">center</property>
<object class="GtkAdjustment"> </object>
<property name="page-increment">2005.4016</property> </child>
<property name="step-increment">2005.4016</property> <child>
<property name="upper">100270.08</property> <object class="GtkScale" id="resetVolumeSlider">
<property name="adjustment">
<object class="GtkAdjustment">
<property name="page-increment">2005.4016</property>
<property name="step-increment">2005.4016</property>
<property name="upper">100270.08</property>
</object>
</property>
<property name="hexpand">True</property>
<property name="valign">center</property>
<property name="value-pos">bottom</property>
<marks>
<mark position="bottom" value="65536.0">100%</mark>
</marks>
</object>
</child>
<child>
<object class="GtkLabel" id="resetVolumePercentage">
<property name="label">100%</property>
<property name="lines">1</property>
<property name="width-request">40</property>
</object>
</child>
</object> </object>
</property> </child>
<property name="hexpand">True</property> <child>
<property name="valign">center</property> <object class="GtkProgressBar" id="resetVolumeMeter">
<property name="value-pos">bottom</property> <property name="margin-top">5</property>
<marks> </object>
<mark position="bottom" value="65536.0">100%</mark> </child>
</marks>
</object> </object>
</child> </property>
<child> <property name="css-classes">audioRow
<object class="GtkLabel" id="resetVolumePercentage"> </property>
<property name="label">100%</property>
<property name="lines">1</property>
<property name="width-request">40</property>
</object>
</child>
</object> </object>
</child> </child>
<child> <child>
<object class="GtkProgressBar" id="resetVolumeMeter"> <object class="GtkSeparator">
<property name="margin-bottom">5</property>
<property name="margin-top">5</property> <property name="margin-top">5</property>
</object> </object>
</child> </child>

View file

@ -2,22 +2,13 @@
<!-- Created with Cambalache 0.17.0 --> <!-- Created with Cambalache 0.17.0 -->
<interface> <interface>
<requires lib="gtk" version="4.12"/> <requires lib="gtk" version="4.12"/>
<template class="resetSourceEntry" parent="GtkBox"> <requires lib="libadwaita" version="1.3"/>
<property name="margin-bottom">5</property> <template class="resetSourceEntry" parent="AdwPreferencesGroup">
<property name="margin-end">5</property>
<property name="margin-start">5</property>
<property name="margin-top">5</property>
<property name="orientation">vertical</property>
<child> <child>
<object class="GtkBox"> <object class="AdwActionRow" id="resetSourceName">
<property name="margin-bottom">5</property> <property name="css-classes">audioRow</property>
<child> <property name="title">text</property>
<object class="GtkLabel" id="resetSourceName"> <property name="title-lines">3</property>
<property name="label">text</property>
<property name="margin-start">5</property>
<property name="wrap">True</property>
</object>
</child>
<child> <child>
<object class="GtkCheckButton" id="resetSelectedSource"> <object class="GtkCheckButton" id="resetSelectedSource">
<property name="halign">end</property> <property name="halign">end</property>
@ -28,44 +19,61 @@
</object> </object>
</child> </child>
<child> <child>
<object class="GtkBox"> <object class="AdwActionRow">
<property name="margin-bottom">5</property> <property name="child">
<property name="margin-top">5</property> <object class="GtkBox">
<child> <property name="orientation">vertical</property>
<object class="GtkButton" id="resetSourceMute"> <child>
<property name="icon-name">microphone-sensitivity-high-symbolic</property> <object class="GtkBox">
<property name="margin-end">5</property> <property name="margin-bottom">5</property>
<property name="valign">center</property> <property name="margin-top">5</property>
</object> <child>
</child> <object class="GtkButton" id="resetSourceMute">
<child> <property name="icon-name">audio-input-microphone-symbolic</property>
<object class="GtkScale" id="resetVolumeSlider"> <property name="margin-end">5</property>
<property name="adjustment"> <property name="valign">center</property>
<object class="GtkAdjustment"> </object>
<property name="page-increment">2005.4016</property> </child>
<property name="step-increment">2005.4016</property> <child>
<property name="upper">100270.08</property> <object class="GtkScale" id="resetVolumeSlider">
<property name="adjustment">
<object class="GtkAdjustment">
<property name="page-increment">2005.4016</property>
<property name="step-increment">2005.4016</property>
<property name="upper">100270.08</property>
</object>
</property>
<property name="hexpand">True</property>
<property name="valign">center</property>
<property name="value-pos">bottom</property>
<marks>
<mark position="bottom" value="65536.0">100%</mark>
</marks>
</object>
</child>
<child>
<object class="GtkLabel" id="resetVolumePercentage">
<property name="label">100%</property>
<property name="lines">1</property>
<property name="width-request">40</property>
</object>
</child>
</object> </object>
</property> </child>
<property name="hexpand">True</property> <child>
<property name="valign">center</property> <object class="GtkProgressBar" id="resetVolumeMeter">
<property name="value-pos">bottom</property> <property name="margin-top">5</property>
<marks> </object>
<mark position="bottom" value="65536.0">100%</mark> </child>
</marks>
</object> </object>
</child> </property>
<child> <property name="css-classes">audioRow
<object class="GtkLabel" id="resetVolumePercentage"> </property>
<property name="label">100%</property>
<property name="lines">1</property>
<property name="width-request">40</property>
</object>
</child>
</object> </object>
</child> </child>
<child> <child>
<object class="GtkProgressBar" id="resetVolumeMeter"> <object class="GtkSeparator">
<property name="margin-bottom">5</property>
<property name="margin-top">5</property> <property name="margin-top">5</property>
</object> </object>
</child> </child>

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<!-- Created with Cambalache 0.17.0 --> <!-- Created with Cambalache 0.17.0 -->
<interface> <interface>
<requires lib="gtk" version="4.12"/> <requires lib="gtk" version="4.6"/>
<requires lib="libadwaita" version="1.4"/> <requires lib="libadwaita" version="1.4"/>
<template class="resetWifi" parent="GtkBox"> <template class="resetWifi" parent="GtkBox">
<property name="hexpand">True</property> <property name="hexpand">True</property>
@ -87,179 +87,6 @@
</child> </child>
</object> </object>
</child> </child>
<child>
<object class="AdwPreferencesGroup">
<child>
<object class="AdwComboRow">
<property name="activatable-widget">
<object class="GtkLabel"/>
</property>
<property name="model">
<object class="GtkStringList">
<items>
<item>asdf</item>
<item>dsfds</item>
</items>
</object>
</property>
<property name="title">asadf</property>
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="child">
<object class="GtkBox">
<child>
<object class="GtkBox">
<property name="hexpand">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox" id="resetOutputStreamEntry">
<property name="margin-bottom">5</property>
<property name="margin-end">5</property>
<property name="margin-start">5</property>
<property name="margin-top">5</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="margin-bottom">5</property>
<property name="margin-top">5</property>
<child>
<object class="GtkButton" id="resetSourceMute">
<property name="icon-name">audio-input-microphone-symbolic</property>
<property name="margin-end">5</property>
<property name="valign">center</property>
</object>
</child>
<child>
<object class="GtkScale" id="resetVolumeSlider">
<property name="adjustment">
<object class="GtkAdjustment">
<property name="page-increment">2005.4016</property>
<property name="step-increment">2005.4016</property>
<property name="upper">100270.08</property>
</object>
</property>
<property name="hexpand">True</property>
<property name="valign">center</property>
<property name="value-pos">bottom</property>
<marks>
<mark position="bottom" value="65536.0">100%</mark>
</marks>
</object>
</child>
<child>
<object class="GtkLabel" id="resetVolumePercentage">
<property name="label">100%</property>
<property name="lines">1</property>
<property name="width-request">40</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkProgressBar" id="resetVolumeMeter">
<property name="margin-top">5</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkSeparator"/>
</child>
<child>
<object class="AdwPreferencesGroup">
<child>
<object class="AdwComboRow">
<property name="activatable-widget">
<object class="GtkLabel"/>
</property>
<property name="model">
<object class="GtkStringList">
<items>
<item>asdf</item>
<item>dsfds</item>
</items>
</object>
</property>
<property name="title">asadf</property>
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="child">
<object class="GtkBox">
<child>
<object class="GtkBox">
<property name="hexpand">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox" id="resetOutputStreamEn2try">
<property name="margin-bottom">5</property>
<property name="margin-end">5</property>
<property name="margin-start">5</property>
<property name="margin-top">5</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="margin-bottom">5</property>
<property name="margin-top">5</property>
<child>
<object class="GtkButton" id="resetSou2rceMute">
<property name="icon-name">audio-input-microphone-symbolic</property>
<property name="margin-end">5</property>
<property name="valign">center</property>
</object>
</child>
<child>
<object class="GtkScale" id="resetVolum2eSlider">
<property name="adjustment">
<object class="GtkAdjustment">
<property name="page-increment">2005.4016</property>
<property name="step-increment">2005.4016</property>
<property name="upper">100270.08</property>
</object>
</property>
<property name="hexpand">True</property>
<property name="valign">center</property>
<property name="value-pos">bottom</property>
<marks>
<mark position="bottom" value="65536.0">100%</mark>
</marks>
</object>
</child>
<child>
<object class="GtkLabel" id="resetVolum2ePercentage">
<property name="label">100%</property>
<property name="lines">1</property>
<property name="width-request">40</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkProgressBar" id="resetVolu2meMeter">
<property name="margin-top">5</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</property>
</object>
</child>
</object>
</child>
</object> </object>
</child> </child>
</object> </object>
@ -272,33 +99,16 @@
<object class="GtkBox"> <object class="GtkBox">
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<child> <child>
<object class="GtkListBox"> <object class="AdwPreferencesGroup">
<property name="css-classes">boxed-list</property>
<property name="margin-bottom">10</property>
<property name="margin-end">5</property>
<property name="margin-start">5</property>
<property name="margin-top">5</property>
<property name="show-separators">True</property>
<property name="valign">start</property>
<child> <child>
<object class="resetListBoxRow" id="resetAvailableNetworks"> <object class="AdwActionRow" id="resetAvailableNetworks">
<property name="title">Available Networks</property>
<child> <child>
<object class="GtkBox"> <object class="GtkImage">
<property name="height-request">40</property> <property name="halign">end</property>
<child> <property name="hexpand">True</property>
<object class="GtkLabel"> <property name="icon-name">go-previous-symbolic</property>
<property name="label">Available Networks</property> <property name="margin-end">5</property>
<property name="margin-start">5</property>
</object>
</child>
<child>
<object class="GtkImage">
<property name="halign">end</property>
<property name="hexpand">True</property>
<property name="icon-name">go-previous-symbolic</property>
<property name="margin-end">5</property>
</object>
</child>
</object> </object>
</child> </child>
</object> </object>

View file

@ -5,252 +5,270 @@
<requires lib="libadwaita" version="1.4"/> <requires lib="libadwaita" version="1.4"/>
<template class="resetWifiOptions" parent="AdwNavigationPage"> <template class="resetWifiOptions" parent="AdwNavigationPage">
<child> <child>
<object class="GtkNotebook"> <object class="GtkBox">
<property name="scrollable">True</property> <property name="orientation">vertical</property>
<property name="show-border">False</property>
<child> <child>
<object class="GtkBox"> <object class="GtkNotebook">
<property name="orientation">vertical</property> <property name="scrollable">True</property>
<property name="show-border">False</property>
<child> <child>
<object class="AdwPreferencesGroup"> <object class="GtkBox">
<property name="orientation">vertical</property>
<child> <child>
<object class="AdwActionRow" id="resetWifiName"> <object class="AdwPreferencesGroup">
<property name="css-classes">property</property> <child>
<property name="title">WiFi Name</property> <object class="AdwActionRow" id="resetWifiName">
</object> <property name="css-classes">property</property>
</child> <property name="title">WiFi Name</property>
<child> </object>
<object class="AdwActionRow" id="resetWifiMac"> </child>
<property name="css-classes">property</property> <child>
<property name="title">MAC-Address</property> <object class="AdwActionRow" id="resetWifiMac">
</object> <property name="css-classes">property</property>
</child> <property name="title">MAC-Address</property>
<child> </object>
<object class="AdwActionRow" id="resetWifiLinkSpeed"> </child>
<property name="css-classes">property</property> <child>
<property name="title">Link Speed</property> <object class="AdwActionRow" id="resetWifiLinkSpeed">
</object> <property name="css-classes">property</property>
</child> <property name="title">Link Speed</property>
<child> </object>
<object class="AdwActionRow" id="resetWifiIP4Addr"> </child>
<property name="css-classes">property</property> <child>
<property name="title">IPv4 Address</property> <object class="AdwActionRow" id="resetWifiIP4Addr">
</object> <property name="css-classes">property</property>
</child> <property name="title">IPv4 Address</property>
<child> </object>
<object class="AdwActionRow" id="resetWifiIP6Addr"> </child>
<property name="css-classes">property</property> <child>
<property name="title">IPv6 Address</property> <object class="AdwActionRow" id="resetWifiIP6Addr">
</object> <property name="css-classes">property</property>
</child> <property name="title">IPv6 Address</property>
<child> </object>
<object class="AdwActionRow" id="resetWifiGateway"> </child>
<property name="css-classes">property</property> <child>
<property name="title">Gateway</property> <object class="AdwActionRow" id="resetWifiGateway">
</object> <property name="css-classes">property</property>
</child> <property name="title">Gateway</property>
<child> </object>
<object class="AdwActionRow" id="resetWifiDNS"> </child>
<property name="css-classes">property</property> <child>
<property name="title">DNS</property> <object class="AdwActionRow" id="resetWifiDNS">
</object> <property name="css-classes">property</property>
</child> <property name="title">DNS</property>
<child> </object>
<object class="AdwSwitchRow" id="resetWifiAutoConnect"> </child>
<property name="title">Connect automatically</property> <child>
</object> <object class="AdwActionRow" id="resetWifiLastUsed">
</child> <property name="css-classes">property</property>
<child> <property name="title">Last Used</property>
<object class="AdwSwitchRow" id="resetWifiMetered"> </object>
<property name="title">Metered Connection</property> </child>
<child>
<object class="AdwSwitchRow" id="resetWifiAutoConnect">
<property name="title">Connect automatically</property>
</object>
</child>
<child>
<object class="AdwSwitchRow" id="resetWifiMetered">
<property name="title">Metered Connection</property>
</object>
</child>
</object> </object>
</child> </child>
</object> </object>
</child> </child>
</object> <child type="tab">
</child> <object class="GtkLabel">
<child type="tab"> <property name="label">General</property>
<object class="GtkLabel"> </object>
<property name="label">General</property> </child>
</object>
</child>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child> <child>
<object class="AdwPreferencesGroup"> <object class="GtkBox">
<property name="orientation">vertical</property>
<child> <child>
<object class="AdwComboRow" id="resetIP4Method"> <object class="AdwPreferencesGroup">
<property name="model"> <child>
<object class="GtkStringList"> <object class="AdwComboRow" id="resetIP4Method">
<items> <property name="model">
<item>Automatic (DHCP)</item> <object class="GtkStringList">
<item>Manual</item> <items>
<item>Link-Local Only</item> <item>Automatic (DHCP)</item>
<item>Shared to other computers</item> <item>Manual</item>
<item>Disabled</item> <item>Link-Local Only</item>
</items> <item>Shared to other computers</item>
<item>Disabled</item>
</items>
</object>
</property>
<property name="title">IPv4 Method</property>
</object>
</child>
<child>
<object class="AdwEntryRow" id="resetIP4DNS">
<property name="title">DNS (separate IP by comma, empty for automatic)</property>
</object>
</child>
<child>
<object class="AdwEntryRow" id="resetIP4Gateway">
<property name="title">Gateway</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup" id="resetIP4AddressGroup">
<property name="margin-top">10</property>
<property name="title">Addresses</property>
</object>
</child>
<child>
<object class="AdwPreferencesGroup" id="resetIP4RoutesGroup">
<property name="header-suffix">
<object class="GtkBox">
<child>
<object class="GtkLabel">
<property name="label">Automatic</property>
<property name="margin-end">5</property>
</object>
</child>
<child>
<object class="GtkSwitch">
<property name="valign">center</property>
</object>
</child>
</object> </object>
</property> </property>
<property name="title">IPv4 Method</property> <property name="margin-top">10</property>
</object> <property name="title">Routes</property>
</child>
<child>
<object class="AdwEntryRow" id="resetIP4DNS">
<property name="title">DNS (separate IP by comma, empty for automatic)</property>
</object>
</child>
<child>
<object class="AdwEntryRow" id="resetIP4Gateway">
<property name="title">Gateway</property>
</object> </object>
</child> </child>
</object> </object>
</child> </child>
<child type="tab">
<object class="GtkLabel">
<property name="label">IPv4</property>
</object>
</child>
<child> <child>
<object class="AdwPreferencesGroup" id="resetIP4AddressGroup"> <object class="GtkBox">
<property name="margin-top">10</property> <property name="orientation">vertical</property>
<property name="title">Addresses</property> <child>
</object> <object class="AdwPreferencesGroup">
</child>
<child>
<object class="AdwPreferencesGroup" id="resetIP4RoutesGroup">
<property name="header-suffix">
<object class="GtkBox">
<child> <child>
<object class="GtkLabel"> <object class="AdwComboRow" id="resetIP6Method">
<property name="label">Automatic</property> <property name="model">
<property name="margin-end">5</property> <object class="GtkStringList">
<items>
<item>Automatic</item>
<item>Automatic (DHCP)</item>
<item>Manual</item>
<item>Link-Local Only</item>
<item>Shared to other computers</item>
<item>Disabled</item>
</items>
</object>
</property>
<property name="title">IPv6 Method</property>
</object> </object>
</child> </child>
<child> <child>
<object class="GtkSwitch"> <object class="AdwEntryRow" id="resetIP6DNS">
<property name="valign">center</property> <property name="title">DNS (separate IP by comma, empty for automatic)</property>
</object>
</child>
<child>
<object class="AdwEntryRow" id="resetIP6Gateway">
<property name="title">Gateway</property>
</object> </object>
</child> </child>
</object> </object>
</property> </child>
<property name="margin-top">10</property> <child>
<property name="title">Routes</property> <object class="AdwPreferencesGroup" id="resetIP6AddressGroup">
<property name="margin-top">10</property>
<property name="title">Addresses</property>
</object>
</child>
<child>
<object class="AdwPreferencesGroup" id="resetIP6RoutesGroup">
<property name="header-suffix">
<object class="GtkBox">
<child>
<object class="GtkLabel">
<property name="label">Automatic</property>
<property name="margin-end">5</property>
</object>
</child>
<child>
<object class="GtkSwitch">
<property name="valign">center</property>
</object>
</child>
</object>
</property>
<property name="margin-top">10</property>
<property name="title">Routes</property>
</object>
</child>
</object>
</child>
<child type="tab">
<object class="GtkLabel">
<property name="label">IPv6</property>
</object>
</child>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="AdwPreferencesGroup">
<child>
<object class="AdwComboRow">
<property name="model">
<object class="GtkStringList">
<items>
<item>None</item>
<item>Enhanced Open</item>
<item>WEP 40/128-bit Key (Hex or ASCII)</item>
<item>WEP 128-bit Passphrase</item>
<item>LEAP</item>
<item>Dynamic WEP (802.1X)</item>
<item>WPA &amp; WPA2 Personal</item>
<item>WPA &amp; WPA2 Enterprise</item>
<item>WPA3 Personal</item>
</items>
</object>
</property>
<property name="title">Security</property>
</object>
</child>
<child>
<object class="AdwEntryRow">
<property name="title">Username</property>
</object>
</child>
<child>
<object class="AdwPasswordEntryRow">
<property name="title">Password</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child type="tab">
<object class="GtkLabel">
<property name="label">Security</property>
</object> </object>
</child> </child>
</object>
</child>
<child type="tab">
<object class="GtkLabel">
<property name="label">IPv4</property>
</object> </object>
</child> </child>
<child> <child>
<object class="GtkBox"> <object class="GtkButton" id="wifiOptionsApplyButton">
<property name="orientation">vertical</property> <property name="halign">end</property>
<child> <property name="label">Apply</property>
<object class="AdwPreferencesGroup"> <property name="margin-top">10</property>
<child>
<object class="AdwComboRow" id="resetIP6Method">
<property name="model">
<object class="GtkStringList">
<items>
<item>Automatic</item>
<item>Automatic (DHCP)</item>
<item>Manual</item>
<item>Link-Local Only</item>
<item>Shared to other computers</item>
<item>Disabled</item>
</items>
</object>
</property>
<property name="title">IPv6 Method</property>
</object>
</child>
<child>
<object class="AdwEntryRow" id="resetIP6DNS">
<property name="title">DNS (separate IP by comma, empty for automatic)</property>
</object>
</child>
<child>
<object class="AdwEntryRow" id="resetIP6Gateway">
<property name="title">Gateway</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup" id="resetIP6AddressGroup">
<property name="margin-top">10</property>
<property name="title">Addresses</property>
</object>
</child>
<child>
<object class="AdwPreferencesGroup" id="resetIP6RoutesGroup">
<property name="header-suffix">
<object class="GtkBox">
<child>
<object class="GtkLabel">
<property name="label">Automatic</property>
<property name="margin-end">5</property>
</object>
</child>
<child>
<object class="GtkSwitch">
<property name="valign">center</property>
</object>
</child>
</object>
</property>
<property name="margin-top">10</property>
<property name="title">Routes</property>
</object>
</child>
</object>
</child>
<child type="tab">
<object class="GtkLabel">
<property name="label">IPv6</property>
</object>
</child>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="AdwPreferencesGroup">
<child>
<object class="AdwComboRow">
<property name="model">
<object class="GtkStringList">
<items>
<item>None</item>
<item>Enhanced Open</item>
<item>WEP 40/128-bit Key (Hex or ASCII)</item>
<item>WEP 128-bit Passphrase</item>
<item>LEAP</item>
<item>Dynamic WEP (802.1X)</item>
<item>WPA &amp; WPA2 Personal</item>
<item>WPA &amp; WPA2 Enterprise</item>
<item>WPA3 Personal</item>
</items>
</object>
</property>
<property name="title">Security</property>
</object>
</child>
<child>
<object class="AdwEntryRow">
<property name="title">Username</property>
</object>
</child>
<child>
<object class="AdwPasswordEntryRow">
<property name="title">Password</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child type="tab">
<object class="GtkLabel">
<property name="label">Security</property>
</object> </object>
</child> </child>
</object> </object>

View file

@ -20,3 +20,7 @@ label.resetSettingLabel {
font-size: 32px; font-size: 32px;
font-weight: bold; font-weight: bold;
} }
row.audioRow {
border-color: transparent;
}