mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-19 00:27:21 +00:00
sculpt_manager: select correct launcher in + menu
The sculpt manager views only launchers in the + menu that are not present in the runtime already. However, this check was missing when finding the right launcher on a click event inside that menu. This could cause the manager to try deploying an already deployed launcher a again (without any effect) instead of deploying the launcher that was actually clicked. Ref #5064
This commit is contained in:
parent
801c4aa72f
commit
49dd55313a
repos/gems/src/app/sculpt_manager/view
@ -132,12 +132,7 @@ void Popup_dialog::_view_menu_elements(Scope<Frame, Vbox> &s, Xml_node const &de
|
||||
*/
|
||||
if (_state == TOP_LEVEL || _state < DEPOT_SHOWN) {
|
||||
unsigned count = 0;
|
||||
_launchers.for_each([&] (Launchers::Info const &info) {
|
||||
|
||||
/* allow each launcher to be used only once */
|
||||
if (_runtime_info.present_in_runtime(info.path))
|
||||
return;
|
||||
|
||||
for_each_viewed_launcher([&] (Launchers::Info const &info) {
|
||||
Hosted<Frame, Vbox, Menu_entry> menu_entry { launcher_id(count++) };
|
||||
s.widget(menu_entry, false, String<100>(Pretty(info.path)));
|
||||
});
|
||||
@ -380,7 +375,8 @@ void Popup_dialog::click(Clicked_at const &at)
|
||||
} else {
|
||||
|
||||
unsigned count = 0;
|
||||
_launchers.for_each([&] (Launchers::Info const &info) {
|
||||
|
||||
for_each_viewed_launcher([&] (Launchers::Info const &info) {
|
||||
if (id == launcher_id(count++))
|
||||
_action.launch_global(info.path); });
|
||||
}
|
||||
|
@ -312,6 +312,17 @@ struct Sculpt::Popup_dialog : Dialog::Top_level_dialog
|
||||
xml.attribute("pkg", component.path); }); });
|
||||
}
|
||||
|
||||
template <typename FN>
|
||||
void for_each_viewed_launcher(FN const &fn) const
|
||||
{
|
||||
_launchers.for_each([&] (Launchers::Info const &info) {
|
||||
if (_runtime_info.present_in_runtime(info.path))
|
||||
return;
|
||||
|
||||
fn(info);
|
||||
});
|
||||
}
|
||||
|
||||
void apply_blueprint(Component &construction, Xml_node blueprint)
|
||||
{
|
||||
if (_state < PKG_REQUESTED)
|
||||
|
Loading…
x
Reference in New Issue
Block a user