I need to try to understand relm4 more.

This commit is contained in:
Lucy 2022-03-09 16:53:51 -05:00
parent 5127904fc4
commit a470c3187c
No known key found for this signature in database
GPG key ID: EBC517FAD666BBF1

View file

@ -1,6 +1,6 @@
use gtk4::{ use gtk4::{
prelude::*, Box as GtkBox, Image, ListBox, Orientation, PositionType, Revealer, prelude::*, Box as GtkBox, Image, ListBox, Orientation, PositionType, RevealerTransitionType,
RevealerTransitionType, Scale, Separator, Window, Scale, Separator, Stack, Window,
}; };
use libcosmic_widgets::LabeledItem; use libcosmic_widgets::LabeledItem;
use pulsectl::controllers::types::DeviceInfo; use pulsectl::controllers::types::DeviceInfo;
@ -15,6 +15,7 @@ pub struct App {
} }
pub struct Widgets { pub struct Widgets {
output_stack: Stack,
inputs: ListBox, inputs: ListBox,
outputs: ListBox, outputs: ListBox,
} }
@ -83,8 +84,16 @@ impl Component for App {
append: _sep = &Separator { append: _sep = &Separator {
set_orientation: Orientation::Horizontal, set_orientation: Orientation::Horizontal,
}, },
append: output_revealer = &Revealer { append: output_stack = &Stack {
set_transition_type: RevealerTransitionType::SlideLeft add_child: current_output = &Label {
set_text: watch! { model.name.unwrap_or_else(|| "Output Device".into()) }
},
add_child: list_outputs = &GtkBox {
append: outputs = &ListBox {
set_selection_mode: gtk4::SelectionMode::None,
set_activate_on_single_click: true,
},
}
} }
} }
} }