From a470c3187cecb465fd228f2ff14f1748aa3e1972 Mon Sep 17 00:00:00 2001 From: Lucy Date: Wed, 9 Mar 2022 16:53:51 -0500 Subject: [PATCH] I need to try to understand relm4 more. --- applets/cosmic-applet-audio/src/app.rs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/applets/cosmic-applet-audio/src/app.rs b/applets/cosmic-applet-audio/src/app.rs index 5652f800..e00f72ab 100644 --- a/applets/cosmic-applet-audio/src/app.rs +++ b/applets/cosmic-applet-audio/src/app.rs @@ -1,6 +1,6 @@ use gtk4::{ - prelude::*, Box as GtkBox, Image, ListBox, Orientation, PositionType, Revealer, - RevealerTransitionType, Scale, Separator, Window, + prelude::*, Box as GtkBox, Image, ListBox, Orientation, PositionType, RevealerTransitionType, + Scale, Separator, Stack, Window, }; use libcosmic_widgets::LabeledItem; use pulsectl::controllers::types::DeviceInfo; @@ -15,6 +15,7 @@ pub struct App { } pub struct Widgets { + output_stack: Stack, inputs: ListBox, outputs: ListBox, } @@ -83,8 +84,16 @@ impl Component for App { append: _sep = &Separator { set_orientation: Orientation::Horizontal, }, - append: output_revealer = &Revealer { - set_transition_type: RevealerTransitionType::SlideLeft + append: output_stack = &Stack { + 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, + }, + } } } }