improv(networking): match page list item to design
Also includes various minor fixes.
This commit is contained in:
parent
85d9f9dbfc
commit
f0b80a90bd
8 changed files with 88 additions and 28 deletions
|
|
@ -931,6 +931,7 @@ impl SettingsApp {
|
||||||
page_list.push(crate::widget::page_list_item(
|
page_list.push(crate::widget::page_list_item(
|
||||||
sub_page.title.as_str(),
|
sub_page.title.as_str(),
|
||||||
sub_page.description.as_str(),
|
sub_page.description.as_str(),
|
||||||
|
"",
|
||||||
&sub_page.icon_name,
|
&sub_page.icon_name,
|
||||||
entity,
|
entity,
|
||||||
))
|
))
|
||||||
|
|
|
||||||
|
|
@ -81,20 +81,44 @@ impl page::Page<crate::pages::Message> for Page {
|
||||||
sections: &mut SlotMap<section::Entity, Section<crate::pages::Message>>,
|
sections: &mut SlotMap<section::Entity, Section<crate::pages::Message>>,
|
||||||
) -> Option<page::Content> {
|
) -> Option<page::Content> {
|
||||||
crate::slab!(descriptions {
|
crate::slab!(descriptions {
|
||||||
vpn_txt = fl!("connections-and-profiles", variant = "vpn");
|
wifi_desc = fl!("connections-and-profiles", variant = "wifi");
|
||||||
|
wired_desc = fl!("connections-and-profiles", variant = "wired");
|
||||||
|
vpn_desc = fl!("connections-and-profiles", variant = "vpn");
|
||||||
});
|
});
|
||||||
|
|
||||||
let device_list = Section::default().descriptions(descriptions).view::<Self>(
|
let device_list = Section::default().descriptions(descriptions).view::<Self>(
|
||||||
move |_binder, page, section| {
|
move |_binder, page, section| {
|
||||||
let descs = §ion.descriptions;
|
let descs = §ion.descriptions;
|
||||||
|
|
||||||
|
let multiple_wifi_adapters = page
|
||||||
|
.devices
|
||||||
|
.iter()
|
||||||
|
.filter(|device| device.device_type == DeviceType::Wifi)
|
||||||
|
.count()
|
||||||
|
> 1;
|
||||||
|
let multiple_wired_adapters = page
|
||||||
|
.devices
|
||||||
|
.iter()
|
||||||
|
.filter(|device| device.device_type == DeviceType::Ethernet)
|
||||||
|
.count()
|
||||||
|
> 1;
|
||||||
|
|
||||||
let wifi_devices = page
|
let wifi_devices = page
|
||||||
.devices
|
.devices
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|device| device.device_type == DeviceType::Wifi)
|
.filter(|device| device.device_type == DeviceType::Wifi)
|
||||||
.map(|device| {
|
.map(|device| {
|
||||||
crate::widget::page_list_item(
|
crate::widget::page_list_item(
|
||||||
fl!("wifi", "adapter", id = device.interface.as_str()),
|
if multiple_wifi_adapters {
|
||||||
|
fl!("wifi", "adapter", id = device.interface.as_str())
|
||||||
|
} else {
|
||||||
|
fl!("wifi")
|
||||||
|
},
|
||||||
|
if multiple_wifi_adapters {
|
||||||
|
""
|
||||||
|
} else {
|
||||||
|
&descs[wifi_desc]
|
||||||
|
},
|
||||||
match device.state {
|
match device.state {
|
||||||
DeviceState::Activated => fl!("network-device-state", "activated"),
|
DeviceState::Activated => fl!("network-device-state", "activated"),
|
||||||
DeviceState::Config => fl!("network-device-state", "config"),
|
DeviceState::Config => fl!("network-device-state", "config"),
|
||||||
|
|
@ -132,7 +156,16 @@ impl page::Page<crate::pages::Message> for Page {
|
||||||
.filter(|device| device.device_type == DeviceType::Ethernet)
|
.filter(|device| device.device_type == DeviceType::Ethernet)
|
||||||
.map(|device| {
|
.map(|device| {
|
||||||
crate::widget::page_list_item(
|
crate::widget::page_list_item(
|
||||||
fl!("wired", "adapter", id = device.interface.as_str()),
|
if multiple_wired_adapters {
|
||||||
|
fl!("wired", "adapter", id = device.interface.as_str())
|
||||||
|
} else {
|
||||||
|
fl!("wired")
|
||||||
|
},
|
||||||
|
if multiple_wired_adapters {
|
||||||
|
""
|
||||||
|
} else {
|
||||||
|
&descs[wired_desc]
|
||||||
|
},
|
||||||
match device.state {
|
match device.state {
|
||||||
DeviceState::Activated => fl!("network-device-state", "activated"),
|
DeviceState::Activated => fl!("network-device-state", "activated"),
|
||||||
DeviceState::Config => fl!("network-device-state", "config"),
|
DeviceState::Config => fl!("network-device-state", "config"),
|
||||||
|
|
@ -169,7 +202,8 @@ impl page::Page<crate::pages::Message> for Page {
|
||||||
.fold(widget::column(), |column, device| column.push(device))
|
.fold(widget::column(), |column, device| column.push(device))
|
||||||
.push(crate::widget::page_list_item(
|
.push(crate::widget::page_list_item(
|
||||||
fl!("vpn"),
|
fl!("vpn"),
|
||||||
&descs[vpn_txt],
|
&descs[vpn_desc],
|
||||||
|
"",
|
||||||
"preferences-vpn-symbolic",
|
"preferences-vpn-symbolic",
|
||||||
Message::OpenPage {
|
Message::OpenPage {
|
||||||
page: page.vpn,
|
page: page.vpn,
|
||||||
|
|
|
||||||
|
|
@ -121,6 +121,7 @@ pub fn display_container<'a, Message: 'a>(widget: Element<'a, Message>) -> Eleme
|
||||||
pub fn page_list_item<'a, Message: 'static + Clone>(
|
pub fn page_list_item<'a, Message: 'static + Clone>(
|
||||||
title: impl Into<Cow<'a, str>>,
|
title: impl Into<Cow<'a, str>>,
|
||||||
description: impl Into<Cow<'a, str>>,
|
description: impl Into<Cow<'a, str>>,
|
||||||
|
info: impl Into<Cow<'a, str>>,
|
||||||
icon: &'a str,
|
icon: &'a str,
|
||||||
message: Message,
|
message: Message,
|
||||||
) -> Element<'a, Message> {
|
) -> Element<'a, Message> {
|
||||||
|
|
@ -135,13 +136,21 @@ pub fn page_list_item<'a, Message: 'static + Clone>(
|
||||||
|
|
||||||
let description = description.into();
|
let description = description.into();
|
||||||
|
|
||||||
|
let info = info.into();
|
||||||
|
|
||||||
if !description.is_empty() {
|
if !description.is_empty() {
|
||||||
builder = builder.description(description);
|
builder = builder.description(description);
|
||||||
}
|
}
|
||||||
|
|
||||||
builder
|
builder
|
||||||
.icon(icon::from_name(icon).size(20))
|
.icon(icon::from_name(icon).size(20))
|
||||||
.control(icon::from_name("go-next-symbolic").size(20))
|
.control(
|
||||||
|
row::with_capacity(2)
|
||||||
|
.padding([8, 0]) // fixed value to set minimum height to 36
|
||||||
|
.spacing(space_xxs)
|
||||||
|
.push(text::body(info))
|
||||||
|
.push(icon::from_name("go-next-symbolic").size(20)),
|
||||||
|
)
|
||||||
.padding([0, space_xxs])
|
.padding([0, space_xxs])
|
||||||
.spacing(space_s)
|
.spacing(space_s)
|
||||||
.apply(container)
|
.apply(container)
|
||||||
|
|
|
||||||
1
debian/install
vendored
1
debian/install
vendored
|
|
@ -11,6 +11,7 @@
|
||||||
/usr/share/applications/com.system76.CosmicSettings.Input.desktop
|
/usr/share/applications/com.system76.CosmicSettings.Input.desktop
|
||||||
/usr/share/applications/com.system76.CosmicSettings.Keyboard.desktop
|
/usr/share/applications/com.system76.CosmicSettings.Keyboard.desktop
|
||||||
/usr/share/applications/com.system76.CosmicSettings.Mouse.desktop
|
/usr/share/applications/com.system76.CosmicSettings.Mouse.desktop
|
||||||
|
/usr/share/applications/com.system76.CosmicSettings.Network.desktop
|
||||||
/usr/share/applications/com.system76.CosmicSettings.Notifications.desktop
|
/usr/share/applications/com.system76.CosmicSettings.Notifications.desktop
|
||||||
/usr/share/applications/com.system76.CosmicSettings.Panel.desktop
|
/usr/share/applications/com.system76.CosmicSettings.Panel.desktop
|
||||||
/usr/share/applications/com.system76.CosmicSettings.Power.desktop
|
/usr/share/applications/com.system76.CosmicSettings.Power.desktop
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,28 @@ wifi = Wi-Fi
|
||||||
online-accounts = Online Accounts
|
online-accounts = Online Accounts
|
||||||
.desc = Add accounts, IMAP and SMTP, enterprise logins
|
.desc = Add accounts, IMAP and SMTP, enterprise logins
|
||||||
|
|
||||||
|
# Bluetooth
|
||||||
|
|
||||||
|
bluetooth = Bluetooth
|
||||||
|
.desc = Manage Bluetooth devices
|
||||||
|
.status = This system is visible as { $aliases } while Bluetooth settings are open.
|
||||||
|
.connected = Connected
|
||||||
|
.connecting = Connecting
|
||||||
|
.disconnecting = Disconnecting
|
||||||
|
.connect = Connect
|
||||||
|
.disconnect = Disconnect
|
||||||
|
.forget = Forget
|
||||||
|
.dbus-error = An error has occurred while interacting with DBus: { $why }
|
||||||
|
.show-device-without-name = Show devices without name
|
||||||
|
|
||||||
|
bluetooth-paired = Previously Connected Devices
|
||||||
|
.connect = Connect
|
||||||
|
.battery = { $percentage }% battery
|
||||||
|
|
||||||
|
bluetooth-available = Nearby Devices
|
||||||
|
|
||||||
|
bluetooth-adapters = Bluetooth Adapters
|
||||||
|
|
||||||
## Desktop
|
## Desktop
|
||||||
|
|
||||||
desktop = Desktop
|
desktop = Desktop
|
||||||
|
|
@ -689,25 +711,3 @@ firmware = Firmware
|
||||||
|
|
||||||
users = Users
|
users = Users
|
||||||
.desc = Authentication and user accounts.
|
.desc = Authentication and user accounts.
|
||||||
|
|
||||||
# Bluetooth
|
|
||||||
|
|
||||||
bluetooth = Bluetooth
|
|
||||||
.desc = Manage Bluetooth devices
|
|
||||||
.status = This system is visible as { $aliases } while the Bluetooth settings is open.
|
|
||||||
.connected = Connected
|
|
||||||
.connecting = Connecting
|
|
||||||
.disconnecting = Disconnecting
|
|
||||||
.connect = Connect
|
|
||||||
.disconnect = Disconnect
|
|
||||||
.forget = Forget
|
|
||||||
.dbus-error = An error has occurred while interacting with DBus: { $why }
|
|
||||||
.show-device-without-name = Show device without name
|
|
||||||
|
|
||||||
bluetooth-paired = Previously Connected Devices
|
|
||||||
.connect = Connect
|
|
||||||
.battery = { $percentage }% battery
|
|
||||||
|
|
||||||
bluetooth-available = Nearby Devices
|
|
||||||
|
|
||||||
bluetooth-adapters = Bluetooth Adapters
|
|
||||||
|
|
|
||||||
3
justfile
3
justfile
|
|
@ -36,6 +36,7 @@ entry-firmware := appid + '.Firmware.desktop'
|
||||||
entry-input := appid + '.Input.desktop'
|
entry-input := appid + '.Input.desktop'
|
||||||
entry-keyboard := appid + '.Keyboard.desktop'
|
entry-keyboard := appid + '.Keyboard.desktop'
|
||||||
entry-mouse := appid + '.Mouse.desktop'
|
entry-mouse := appid + '.Mouse.desktop'
|
||||||
|
entry-network := appid + '.Network.desktop'
|
||||||
entry-notifications := appid + '.Notifications.desktop'
|
entry-notifications := appid + '.Notifications.desktop'
|
||||||
entry-panel := appid + '.Panel.desktop'
|
entry-panel := appid + '.Panel.desktop'
|
||||||
entry-power := appid + '.Power.desktop'
|
entry-power := appid + '.Power.desktop'
|
||||||
|
|
@ -70,6 +71,7 @@ install-desktop-entries:
|
||||||
install -Dm0644 'resources/{{entry-input}}' '{{appdir}}/{{entry-input}}'
|
install -Dm0644 'resources/{{entry-input}}' '{{appdir}}/{{entry-input}}'
|
||||||
install -Dm0644 'resources/{{entry-keyboard}}' '{{appdir}}/{{entry-keyboard}}'
|
install -Dm0644 'resources/{{entry-keyboard}}' '{{appdir}}/{{entry-keyboard}}'
|
||||||
install -Dm0644 'resources/{{entry-mouse}}' '{{appdir}}/{{entry-mouse}}'
|
install -Dm0644 'resources/{{entry-mouse}}' '{{appdir}}/{{entry-mouse}}'
|
||||||
|
install -Dm0644 'resources/{{entry-network}}' '{{appdir}}/{{entry-network}}'
|
||||||
install -Dm0644 'resources/{{entry-notifications}}' '{{appdir}}/{{entry-notifications}}'
|
install -Dm0644 'resources/{{entry-notifications}}' '{{appdir}}/{{entry-notifications}}'
|
||||||
install -Dm0644 'resources/{{entry-panel}}' '{{appdir}}/{{entry-panel}}'
|
install -Dm0644 'resources/{{entry-panel}}' '{{appdir}}/{{entry-panel}}'
|
||||||
install -Dm0644 'resources/{{entry-power}}' '{{appdir}}/{{entry-power}}'
|
install -Dm0644 'resources/{{entry-power}}' '{{appdir}}/{{entry-power}}'
|
||||||
|
|
@ -116,6 +118,7 @@ uninstall:
|
||||||
'{{appdir}}/{{entry-input}}' \
|
'{{appdir}}/{{entry-input}}' \
|
||||||
'{{appdir}}/{{entry-keyboard}}' \
|
'{{appdir}}/{{entry-keyboard}}' \
|
||||||
'{{appdir}}/{{entry-mouse}}' \
|
'{{appdir}}/{{entry-mouse}}' \
|
||||||
|
'{{appdir}}/{{entry-network}}' \
|
||||||
'{{appdir}}/{{entry-notifications}}' \
|
'{{appdir}}/{{entry-notifications}}' \
|
||||||
'{{appdir}}/{{entry-panel}}' \
|
'{{appdir}}/{{entry-panel}}' \
|
||||||
'{{appdir}}/{{entry-power}}' \
|
'{{appdir}}/{{entry-power}}' \
|
||||||
|
|
|
||||||
|
|
@ -8,5 +8,5 @@ Categories=COSMIC
|
||||||
Keywords=COSMIC
|
Keywords=COSMIC
|
||||||
NoDisplay=true
|
NoDisplay=true
|
||||||
OnlyShowIn=COSMIC
|
OnlyShowIn=COSMIC
|
||||||
Icon=bluetooth
|
Icon=preferences-bluetooth
|
||||||
StartupNotify=true
|
StartupNotify=true
|
||||||
|
|
|
||||||
12
resources/com.system76.CosmicSettings.Network.desktop
Normal file
12
resources/com.system76.CosmicSettings.Network.desktop
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
[Desktop Entry]
|
||||||
|
Name=Network & Wireless
|
||||||
|
Comment=Manage network connections
|
||||||
|
Type=Settings
|
||||||
|
Exec=cosmic-settings network
|
||||||
|
Terminal=false
|
||||||
|
Categories=COSMIC
|
||||||
|
Keywords=COSMIC
|
||||||
|
NoDisplay=true
|
||||||
|
OnlyShowIn=COSMIC
|
||||||
|
Icon=preferences-network-and-wireless
|
||||||
|
StartupNotify=true
|
||||||
Loading…
Add table
Add a link
Reference in a new issue