fix(network): remove extra divider when there are no known wifi connections
This commit is contained in:
parent
3a39874291
commit
1d6b5d7ec9
1 changed files with 11 additions and 6 deletions
|
|
@ -453,7 +453,7 @@ impl cosmic::Application for CosmicNetworkApplet {
|
||||||
|
|
||||||
fn view_window(&self, _id: window::Id) -> Element<Message> {
|
fn view_window(&self, _id: window::Id) -> Element<Message> {
|
||||||
let mut vpn_ethernet_col = column![];
|
let mut vpn_ethernet_col = column![];
|
||||||
let mut known_wifi = column![];
|
let mut known_wifi = Vec::new();
|
||||||
for conn in &self.nm_state.active_conns {
|
for conn in &self.nm_state.active_conns {
|
||||||
match conn {
|
match conn {
|
||||||
ActiveConnectionInfo::Vpn { name, ip_addresses } => {
|
ActiveConnectionInfo::Vpn { name, ip_addresses } => {
|
||||||
|
|
@ -556,7 +556,7 @@ impl cosmic::Application for CosmicNetworkApplet {
|
||||||
),
|
),
|
||||||
_ => {}
|
_ => {}
|
||||||
};
|
};
|
||||||
known_wifi = known_wifi.push(
|
known_wifi.push(Element::from(
|
||||||
column![menu_button(
|
column![menu_button(
|
||||||
Row::with_children(btn_content)
|
Row::with_children(btn_content)
|
||||||
.align_items(Alignment::Center)
|
.align_items(Alignment::Center)
|
||||||
|
|
@ -564,7 +564,7 @@ impl cosmic::Application for CosmicNetworkApplet {
|
||||||
)
|
)
|
||||||
.on_press(Message::Disconnect(name.clone()))]
|
.on_press(Message::Disconnect(name.clone()))]
|
||||||
.align_items(Alignment::Center),
|
.align_items(Alignment::Center),
|
||||||
);
|
));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -665,9 +665,15 @@ impl cosmic::Application for CosmicNetworkApplet {
|
||||||
DeviceState::Activated => btn.on_press(Message::Disconnect(known.ssid.clone())),
|
DeviceState::Activated => btn.on_press(Message::Disconnect(known.ssid.clone())),
|
||||||
_ => btn,
|
_ => btn,
|
||||||
};
|
};
|
||||||
known_wifi = known_wifi.push(row![btn].align_items(Alignment::Center));
|
known_wifi.push(Element::from(row![btn].align_items(Alignment::Center)));
|
||||||
}
|
}
|
||||||
content = content.push(known_wifi);
|
|
||||||
|
let has_known_wifi = !known_wifi.is_empty();
|
||||||
|
content = content.push(Column::with_children(known_wifi));
|
||||||
|
if has_known_wifi {
|
||||||
|
content = content.push(padded_control(divider::horizontal::default()));
|
||||||
|
}
|
||||||
|
|
||||||
let dropdown_icon = if self.show_visible_networks {
|
let dropdown_icon = if self.show_visible_networks {
|
||||||
"go-down-symbolic"
|
"go-down-symbolic"
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -686,7 +692,6 @@ impl cosmic::Application for CosmicNetworkApplet {
|
||||||
.height(Length::Fixed(24.0)),
|
.height(Length::Fixed(24.0)),
|
||||||
])
|
])
|
||||||
.on_press(Message::ToggleVisibleNetworks);
|
.on_press(Message::ToggleVisibleNetworks);
|
||||||
content = content.push(padded_control(divider::horizontal::default()));
|
|
||||||
content = content.push(available_connections_btn);
|
content = content.push(available_connections_btn);
|
||||||
}
|
}
|
||||||
if self.show_visible_networks {
|
if self.show_visible_networks {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue