improv(startup_apps): match designs
Adds an empty list item with text when there aren't any startup apps and replaces the heading with a modified description (removing the description).
This commit is contained in:
parent
d2a041f2ca
commit
842e6f4bac
3 changed files with 38 additions and 38 deletions
|
|
@ -381,61 +381,61 @@ fn apps() -> Section<crate::pages::Message> {
|
||||||
Section::default()
|
Section::default()
|
||||||
.title(fl!("startup-apps"))
|
.title(fl!("startup-apps"))
|
||||||
.view::<Page>(move |_binder, page, _section| {
|
.view::<Page>(move |_binder, page, _section| {
|
||||||
let mut view = widget::column::with_capacity(4).spacing(space_xxs);
|
let mut view = widget::column::with_capacity(3).spacing(space_xxs);
|
||||||
|
|
||||||
if let Some(startup_apps) = &page.cached_startup_apps {
|
if let Some(startup_apps) = &page.cached_startup_apps {
|
||||||
let order = vec![DirectoryType::User];
|
let order = vec![DirectoryType::User];
|
||||||
for directory_type in order {
|
for directory_type in order {
|
||||||
let mut section = settings::section();
|
let mut section = settings::section();
|
||||||
|
|
||||||
view = view
|
view = view.push(text::heading(directory_type.to_string()));
|
||||||
.push(text::heading(directory_type.to_string()))
|
|
||||||
.push(text(match directory_type {
|
|
||||||
DirectoryType::User => fl!("startup-apps", "user-description"),
|
|
||||||
}));
|
|
||||||
|
|
||||||
if let Some(apps) = startup_apps.apps.get(&directory_type) {
|
if let Some(apps) = startup_apps.apps.get(&directory_type) {
|
||||||
for app in apps {
|
if apps.is_empty() {
|
||||||
let mut row = widget::row::with_capacity(3)
|
section = section.add(text::body(fl!("startup-apps", "none")))
|
||||||
.spacing(space_xs)
|
} else {
|
||||||
.align_y(Alignment::Center);
|
for app in apps {
|
||||||
|
let mut row = widget::row::with_capacity(3)
|
||||||
|
.spacing(space_xs)
|
||||||
|
.align_y(Alignment::Center);
|
||||||
|
|
||||||
row = row.push(
|
row = row.push(
|
||||||
icon::from_name(app.icon().unwrap_or("application-default"))
|
icon::from_name(app.icon().unwrap_or("application-default"))
|
||||||
.size(32),
|
.size(32),
|
||||||
);
|
);
|
||||||
|
|
||||||
if let Some(name) = app.name(&startup_apps.locales) {
|
if let Some(name) = app.name(&startup_apps.locales) {
|
||||||
row = row.push(text(name).width(Length::Fill));
|
row = row.push(text::body(name).width(Length::Fill));
|
||||||
} else {
|
} else {
|
||||||
row = row.push(text(&app.appid).width(Length::Fill));
|
row = row.push(text::body(&app.appid).width(Length::Fill));
|
||||||
|
}
|
||||||
|
|
||||||
|
row = row.push(
|
||||||
|
button::icon(icon::from_name("edit-delete-symbolic"))
|
||||||
|
.extra_small()
|
||||||
|
.on_press(
|
||||||
|
Message::RemoveStartupApplication(
|
||||||
|
directory_type.clone(),
|
||||||
|
app.clone(),
|
||||||
|
false,
|
||||||
|
)
|
||||||
|
.into(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
section = section.add(row)
|
||||||
}
|
}
|
||||||
|
|
||||||
row = row.push(
|
|
||||||
button::icon(icon::from_name("edit-delete-symbolic"))
|
|
||||||
.extra_small()
|
|
||||||
.on_press(
|
|
||||||
Message::RemoveStartupApplication(
|
|
||||||
directory_type.clone(),
|
|
||||||
app.clone(),
|
|
||||||
false,
|
|
||||||
)
|
|
||||||
.into(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
section = section.add(row)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let add_startup_app = widget::button::standard(fl!("startup-apps", "add"))
|
let add_startup_app = widget::button::standard(fl!("startup-apps", "add"))
|
||||||
.on_press(Message::ShowApplicationSidebar(directory_type.clone()).into());
|
.on_press(Message::ShowApplicationSidebar(directory_type.clone()).into());
|
||||||
|
|
||||||
view = view.push(section).push(widget::container(
|
view = view.push(section).push(
|
||||||
widget::container(add_startup_app)
|
widget::container(add_startup_app)
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
.align_x(Alignment::End),
|
.align_x(Alignment::End),
|
||||||
));
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -826,8 +826,8 @@ default-apps = Default Applications
|
||||||
startup-apps = Startup Applications
|
startup-apps = Startup Applications
|
||||||
.desc = Configure applications which run on login.
|
.desc = Configure applications which run on login.
|
||||||
.add = Add app
|
.add = Add app
|
||||||
.user = User specific applications
|
.user = Applications launched when you log in
|
||||||
.user-description = These applications are launched when you log into your current user.
|
.none = No startup applications added
|
||||||
.remove-dialog-title = Remove { $name }?
|
.remove-dialog-title = Remove { $name }?
|
||||||
.remove-dialog-description = Are you sure you want to remove this as a startup application?
|
.remove-dialog-description = Are you sure you want to remove this as a startup application?
|
||||||
.search-for-application = Search for application
|
.search-for-application = Search for application
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
pub use cosmic_bg_config::{Color, Config, Entry, Gradient, ScalingMode, Source};
|
pub use cosmic_bg_config::{Color, Config, Entry, Gradient, ScalingMode, Source};
|
||||||
use eyre::{OptionExt, eyre};
|
use eyre::eyre;
|
||||||
use fast_image_resize::SrcCropping;
|
use fast_image_resize::SrcCropping;
|
||||||
use futures_lite::Stream;
|
use futures_lite::Stream;
|
||||||
use futures_util::StreamExt;
|
use futures_util::StreamExt;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue