dev-2025-11-08T02:57:58+01:00
This commit is contained in:
parent
96e7390a2b
commit
1f5a8f2c21
@ -272,6 +272,26 @@ impl PipewireManager {
|
||||
Some((id, self.devices.borrow()[&device_id].profiles[&id].description.clone()))
|
||||
});
|
||||
|
||||
let factory = gtk::SignalListItemFactory::new();
|
||||
|
||||
factory.connect_setup(move |factory, item| {
|
||||
let label = gtk::Label::new(None);
|
||||
item.downcast_ref::<gtk::ListItem>()
|
||||
.unwrap()
|
||||
.set_child(Some(&label));
|
||||
});
|
||||
|
||||
factory.connect_bind(move |factory, item| {
|
||||
let list_item = item.downcast_ref::<gtk::ListItem>().unwrap();
|
||||
let label = list_item.child().unwrap().downcast::<gtk::Label>().unwrap();
|
||||
|
||||
// using list_item.set_child( Some(&>label<) )
|
||||
// instead of label.set_label( >label<.label() )
|
||||
// results in weird broken behavior
|
||||
label.set_label(&list_item.item().unwrap().downcast::<gtk::Label>().unwrap().label())
|
||||
});
|
||||
|
||||
combo_row.set_factory(Some(&factory));
|
||||
|
||||
let model = adw::gio::ListStore::new::<gtk::Label>();
|
||||
|
||||
@ -316,9 +336,35 @@ impl PipewireManager {
|
||||
tx.send(
|
||||
Command::DeviceCommand(device_id, DeviceCommand::SetProfile(selected_profile_id))
|
||||
).unwrap();
|
||||
|
||||
|
||||
println!("{}", &selected_profile_name);
|
||||
}
|
||||
));
|
||||
|
||||
/*
|
||||
|
||||
// works, TODO: figure out preferred style
|
||||
|
||||
combo_row.set_use_subtitle(true);
|
||||
combo_row.connect_subtitle_notify(clone!(
|
||||
#[weak]
|
||||
model,
|
||||
move |c| {
|
||||
let model_entry = c.selected();
|
||||
let selected_profile_name = model
|
||||
.item(model_entry)
|
||||
.unwrap()
|
||||
.downcast::<gtk::Label>()
|
||||
.unwrap()
|
||||
.label();
|
||||
|
||||
c.set_subtitle(&selected_profile_name);
|
||||
}
|
||||
));
|
||||
|
||||
*/
|
||||
|
||||
if let Some((_, name)) = active_profile {
|
||||
if let Ok(position) = profile_names.binary_search(&&name) {
|
||||
combo_row.set_selected(position as u32)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user