Open file on double-click in "Open With"

This commit is contained in:
Jason Rodney Hansen 2025-07-11 11:13:53 -06:00 • committed by Jeremy Soller
parent 54b884e5f8
commit f98e4c1820

View file

@ -4807,35 +4807,39 @@ impl Application for App {
last_kind = *kind; last_kind = *kind;
} }
column = column.add( column = column.add(
widget::button::custom( widget::mouse_area(
widget::row::with_children(vec![ widget::button::custom(
widget::icon(app.icon.clone()).size(32).into(), widget::row::with_children(vec![
if app.is_default && !displayed_default { widget::icon(app.icon.clone()).size(32).into(),
displayed_default = true; if app.is_default && !displayed_default {
widget::text::body(fl!( displayed_default = true;
"default-app", widget::text::body(fl!(
name = Some(app.name.as_str()) "default-app",
)) name = Some(app.name.as_str())
.into() ))
} else {
widget::text::body(app.name.to_string()).into()
},
widget::horizontal_space().into(),
if *selected == i {
widget::icon::from_name("checkbox-checked-symbolic")
.size(16)
.into() .into()
} else { } else {
widget::Space::with_width(Length::Fixed(16.0)).into() widget::text::body(app.name.to_string()).into()
}, },
]) widget::horizontal_space().into(),
.spacing(space_s) if *selected == i {
.height(Length::Fixed(item_height)) widget::icon::from_name("checkbox-checked-symbolic")
.align_y(Alignment::Center), .size(16)
.into()
} else {
widget::Space::with_width(Length::Fixed(16.0)).into()
},
])
.spacing(space_s)
.height(Length::Fixed(item_height))
.align_y(Alignment::Center),
)
.width(Length::Fill)
.class(theme::Button::MenuItem)
.force_enabled(true),
) )
.width(Length::Fill) .on_press(Message::OpenWithSelection(i))
.class(theme::Button::MenuItem) .on_double_press(Message::DialogComplete),
.on_press(Message::OpenWithSelection(i)),
); );
} }