diff --git a/src/components/input/outputStreamEntry.rs b/src/components/input/outputStreamEntry.rs index b47ed21..e0e6fdb 100644 --- a/src/components/input/outputStreamEntry.rs +++ b/src/components/input/outputStreamEntry.rs @@ -3,7 +3,7 @@ use std::time::{Duration, SystemTime}; use adw::glib; use adw::glib::Object; -use adw::prelude::{ButtonExt, RangeExt}; +use adw::prelude::{ButtonExt, ComboRowExt, PreferencesRowExt, RangeExt}; use dbus::blocking::Connection; use dbus::Error; use glib::subclass::types::ObjectSubclassIsExt; @@ -16,7 +16,7 @@ use super::sourceBox::SourceBox; glib::wrapper! { pub struct OutputStreamEntry(ObjectSubclass) - @extends gtk::Box, gtk::Widget, + @extends adw::PreferencesGroup, gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Orientable; } @@ -31,7 +31,7 @@ impl OutputStreamEntry { let box_imp = source_box.imp(); let imp = obj.imp(); let name = stream.application_name.clone() + ": " + stream.name.as_str(); - imp.resetSourceName.set_text(name.as_str()); + imp.resetSourceSelection.set_title(name.as_str()); let volume = stream.volume.first().unwrap_or(&0_u32); let fraction = (*volume as f64 / 655.36).round(); let percentage = (fraction).to_string() + "%"; @@ -69,7 +69,7 @@ impl OutputStreamEntry { // list = box_imp.resetModelList.try_borrow(); // } // let list = list.unwrap(); - imp.resetSelectedSource.set_model(Some(&*list)); + imp.resetSourceSelection.set_model(Some(&*list)); let map = box_imp.resetSourceMap.write().unwrap(); // while map.is_err() { // map = box_imp.resetSourceMap.try_borrow(); @@ -83,10 +83,10 @@ impl OutputStreamEntry { let name = &name.alias; let index = map.get(name); 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| { let selected = dropdown.selected_item(); if selected.is_none() { diff --git a/src/components/input/outputStreamEntryImpl.rs b/src/components/input/outputStreamEntryImpl.rs index 641db53..0bc4359 100644 --- a/src/components/input/outputStreamEntryImpl.rs +++ b/src/components/input/outputStreamEntryImpl.rs @@ -1,6 +1,8 @@ use std::cell::RefCell; use std::sync::Arc; use std::time::SystemTime; +use adw::{ComboRow, PreferencesGroup}; +use adw::subclass::prelude::PreferencesGroupImpl; use crate::components::input::outputStreamEntry; use gtk::subclass::prelude::*; @@ -12,9 +14,7 @@ use ReSet_Lib::audio::audio::OutputStream; #[template(resource = "/org/Xetibo/ReSet/resetOutputStreamEntry.ui")] pub struct OutputStreamEntry { #[template_child] - pub resetSourceName: TemplateChild