audio: Fix setting default source/sink
This commit is contained in:
parent
a431457468
commit
2e04938bbd
3 changed files with 14 additions and 24 deletions
|
|
@ -1,4 +1,4 @@
|
|||
use gtk4::{prelude::*, Button, Label, ListBox};
|
||||
use gtk4::{glib::clone, prelude::*, Button, Label, ListBox};
|
||||
use libcosmic_widgets::{relm4::RelmContainerExt, LabeledItem};
|
||||
use std::rc::Rc;
|
||||
|
||||
|
|
@ -40,15 +40,9 @@ pub async fn refresh_input_widgets(pa: &PA, inputs: &ListBox) {
|
|||
.unwrap_or(&name),
|
||||
set_child: set_current_input_device = &Button {
|
||||
set_label: "Switch",
|
||||
connect_clicked: move |_| {
|
||||
// XXX Need mutable borrow? Is this a problem for async?
|
||||
/*
|
||||
SourceController::create()
|
||||
.expect("failed to create input controller")
|
||||
.set_default_device(&name)
|
||||
.expect("failed to set default device");
|
||||
*/
|
||||
}
|
||||
connect_clicked: clone!(@strong pa => move |_| {
|
||||
pa.set_default_source(&name);
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use gtk4::{prelude::*, Button, Label, ListBox};
|
||||
use gtk4::{glib::clone, prelude::*, Button, Label, ListBox};
|
||||
use libcosmic_widgets::{relm4::RelmContainerExt, LabeledItem};
|
||||
use std::rc::Rc;
|
||||
|
||||
|
|
@ -40,15 +40,9 @@ pub async fn refresh_output_widgets(pa: &PA, outputs: &ListBox) {
|
|||
.unwrap_or(&name),
|
||||
set_child: set_current_input_device = &Button {
|
||||
set_label: "Switch",
|
||||
connect_clicked: move |_| {
|
||||
// XXX Need mutable borrow? Is this a problem for async?
|
||||
/*
|
||||
SinkController::create()
|
||||
.expect("failed to create output controller")
|
||||
.set_default_device(&name)
|
||||
.expect("failed to set default device");
|
||||
*/
|
||||
}
|
||||
connect_clicked: clone!(@strong pa => move |_| {
|
||||
pa.set_default_sink(&name);
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -144,12 +144,14 @@ impl PA {
|
|||
receiver.await.unwrap()
|
||||
}
|
||||
|
||||
/*
|
||||
// XXX async wait and handle error
|
||||
pub fn set_default_sink(&mut self, name: &str) {
|
||||
self.0.context.set_default_sink(name, |_| {});
|
||||
pub fn set_default_sink(&self, name: &str) {
|
||||
self.0.context.borrow_mut().set_default_sink(name, |_| {});
|
||||
}
|
||||
|
||||
pub fn set_default_source(&self, name: &str) {
|
||||
self.0.context.borrow_mut().set_default_source(name, |_| {});
|
||||
}
|
||||
*/
|
||||
|
||||
pub async fn get_source_info_list(&self) -> Result<Vec<DeviceInfo>, ()> {
|
||||
let (sender, receiver) = oneshot::channel();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue