diff --git a/repos/gems/src/app/sculpt_manager/view/popup_dialog.cc b/repos/gems/src/app/sculpt_manager/view/popup_dialog.cc index 20d471e363..7943e2334b 100644 --- a/repos/gems/src/app/sculpt_manager/view/popup_dialog.cc +++ b/repos/gems/src/app/sculpt_manager/view/popup_dialog.cc @@ -132,12 +132,7 @@ void Popup_dialog::_view_menu_elements(Scope &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 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); }); } diff --git a/repos/gems/src/app/sculpt_manager/view/popup_dialog.h b/repos/gems/src/app/sculpt_manager/view/popup_dialog.h index 3b2e078f03..b2d76f66fd 100644 --- a/repos/gems/src/app/sculpt_manager/view/popup_dialog.h +++ b/repos/gems/src/app/sculpt_manager/view/popup_dialog.h @@ -312,6 +312,17 @@ struct Sculpt::Popup_dialog : Dialog::Top_level_dialog xml.attribute("pkg", component.path); }); }); } + template + 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)