fix(startup_apps): improve interface
This commit is contained in:
parent
486b4b9cad
commit
8d8536da21
1 changed files with 31 additions and 26 deletions
|
|
@ -310,7 +310,7 @@ impl Page {
|
||||||
directory_type: DirectoryType,
|
directory_type: DirectoryType,
|
||||||
) -> Element<'_, crate::pages::Message> {
|
) -> Element<'_, crate::pages::Message> {
|
||||||
let cosmic::cosmic_theme::Spacing {
|
let cosmic::cosmic_theme::Spacing {
|
||||||
space_s, space_l, ..
|
space_xs, space_l, ..
|
||||||
} = cosmic::theme::spacing();
|
} = cosmic::theme::spacing();
|
||||||
|
|
||||||
let search = widget::search_input(fl!("type-to-search"), &self.application_search)
|
let search = widget::search_input(fl!("type-to-search"), &self.application_search)
|
||||||
|
|
@ -328,26 +328,25 @@ impl Page {
|
||||||
|| exec.to_lowercase().contains(search_input)
|
|| exec.to_lowercase().contains(search_input)
|
||||||
|| name.to_lowercase().contains(search_input)
|
|| name.to_lowercase().contains(search_input)
|
||||||
{
|
{
|
||||||
let mut row = widget::row::with_capacity(2).spacing(space_s);
|
let mut row = widget::row::with_capacity(3)
|
||||||
|
.spacing(space_xs)
|
||||||
|
.align_y(Alignment::Center);
|
||||||
|
|
||||||
row = row
|
row = row.push(
|
||||||
.push(icon::from_name(app.icon().unwrap_or("application-default")));
|
icon::from_name(app.icon().unwrap_or("application-default"))
|
||||||
|
.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));
|
row = row.push(text(name).width(Length::Fill));
|
||||||
} else {
|
} else {
|
||||||
row = row.push(text(&app.appid));
|
row = row.push(text(&app.appid).width(Length::Fill));
|
||||||
}
|
}
|
||||||
|
row = row.push(widget::button::text(fl!("add")).on_press(
|
||||||
|
Message::AddStartupApplication(directory_type.clone(), app.clone()),
|
||||||
|
));
|
||||||
|
|
||||||
list = list.add(settings::flex_item_row(vec![
|
list = list.add(row)
|
||||||
row.into(),
|
|
||||||
widget::button::text(fl!("add"))
|
|
||||||
.on_press(Message::AddStartupApplication(
|
|
||||||
directory_type.clone(),
|
|
||||||
app.clone(),
|
|
||||||
))
|
|
||||||
.into(),
|
|
||||||
]))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -366,7 +365,9 @@ impl Page {
|
||||||
|
|
||||||
fn apps() -> Section<crate::pages::Message> {
|
fn apps() -> Section<crate::pages::Message> {
|
||||||
let cosmic::cosmic_theme::Spacing {
|
let cosmic::cosmic_theme::Spacing {
|
||||||
space_xxs, space_s, ..
|
space_xxs,
|
||||||
|
space_xs,
|
||||||
|
..
|
||||||
} = cosmic::theme::spacing();
|
} = cosmic::theme::spacing();
|
||||||
|
|
||||||
Section::default()
|
Section::default()
|
||||||
|
|
@ -387,28 +388,32 @@ fn apps() -> Section<crate::pages::Message> {
|
||||||
|
|
||||||
if let Some(apps) = startup_apps.apps.get(&directory_type) {
|
if let Some(apps) = startup_apps.apps.get(&directory_type) {
|
||||||
for app in apps {
|
for app in apps {
|
||||||
let mut row = widget::row::with_capacity(2).spacing(space_s);
|
let mut row = widget::row::with_capacity(3)
|
||||||
|
.spacing(space_xs)
|
||||||
|
.align_y(Alignment::Center);
|
||||||
|
|
||||||
row = row
|
row = row.push(
|
||||||
.push(icon::from_name(app.icon().unwrap_or("application-default")));
|
icon::from_name(app.icon().unwrap_or("application-default"))
|
||||||
|
.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));
|
row = row.push(text(name).width(Length::Fill));
|
||||||
} else {
|
} else {
|
||||||
row = row.push(text(&app.appid));
|
row = row.push(text(&app.appid).width(Length::Fill));
|
||||||
}
|
}
|
||||||
|
|
||||||
section = section.add(settings::flex_item_row(vec![
|
row = row.push(
|
||||||
row.into(),
|
|
||||||
button::icon(icon::from_name("edit-delete-symbolic"))
|
button::icon(icon::from_name("edit-delete-symbolic"))
|
||||||
.extra_small()
|
.extra_small()
|
||||||
.on_press(Message::RemoveStartupApplication(
|
.on_press(Message::RemoveStartupApplication(
|
||||||
directory_type.clone(),
|
directory_type.clone(),
|
||||||
app.clone(),
|
app.clone(),
|
||||||
false,
|
false,
|
||||||
))
|
)),
|
||||||
.into(),
|
);
|
||||||
]))
|
|
||||||
|
section = section.add(row)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue