Added workaroud for toggle after separator crash

This commit is contained in:
András 2024-12-08 00:03:07 +02:00 committed by Michael Murphy
parent 9f9bb9c673
commit 7eb47a71b3

View file

@ -749,20 +749,27 @@ impl cosmic::Application for CosmicNetworkApplet {
] ]
} else { } else {
column![ column![
vpn_ethernet_col, // TODO: remove excesive column!
padded_control( Element::from(
anim!( column![
//toggler vpn_ethernet_col,
AIRPLANE_MODE, padded_control(
&self.timeline, anim!(
fl!("airplane-mode"), //toggler
self.nm_state.airplane_mode, AIRPLANE_MODE,
|_chain, enable| { Message::ToggleAirplaneMode(enable) }, &self.timeline,
) fl!("airplane-mode"),
.text_size(14) self.nm_state.airplane_mode,
.width(Length::Fill) |_chain, enable| { Message::ToggleAirplaneMode(enable) },
)
.text_size(14)
.width(Length::Fill)
),
padded_control(divider::horizontal::default())
.padding([space_xxs, space_s]),
]
.align_x(Alignment::Center)
), ),
padded_control(divider::horizontal::default()).padding([space_xxs, space_s]),
padded_control( padded_control(
anim!( anim!(
//toggler //toggler
@ -840,17 +847,13 @@ impl cosmic::Application for CosmicNetworkApplet {
.symbolic(true) .symbolic(true)
.into(), .into(),
); );
// todo figure our crash here. It happens if both this thing in content as well as
// there is no new connection and we are viewing available networks(see insertion
// of `list_col` into `content` on L1083)
content = content.push(Element::from( content = content.push(Element::from(
column![menu_button( menu_button(
Row::with_children(btn_content) Row::with_children(btn_content)
.align_y(Alignment::Center) .align_y(Alignment::Center)
.spacing(8) .spacing(8)
) )
.on_press(Message::OpenHwDevice(Some(hw_device.clone())))] .on_press(Message::OpenHwDevice(Some(hw_device.clone()))),
.align_x(Alignment::Center),
)); ));
} }
@ -1077,9 +1080,6 @@ impl cosmic::Application for CosmicNetworkApplet {
.on_press(Message::SelectWirelessAccessPoint(ap.clone())); .on_press(Message::SelectWirelessAccessPoint(ap.clone()));
list_col.push(button.into()); list_col.push(button.into());
} }
// todo fixup crash that happens if both content gets update here and with such
// condition `if wireless_hw_devices.len() > 1 && self.hw_device_to_show.is_none()`
// See reference to it on L843
content = content content = content
.push(scrollable(Column::with_children(list_col)).height(Length::Fixed(300.0))); .push(scrollable(Column::with_children(list_col)).height(Length::Fixed(300.0)));
} }