mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 13:17:34 +00:00
Userland: Use GUI::Process::spawn_or_show_error() for spawn() from a GUI
This commit is contained in:
parent
2f2671f2d3
commit
7c8541b914
7 changed files with 39 additions and 26 deletions
|
@ -16,7 +16,6 @@
|
|||
#include "Tab.h"
|
||||
#include <Applications/Browser/BrowserWindowGML.h>
|
||||
#include <LibConfig/Client.h>
|
||||
#include <LibCore/Process.h>
|
||||
#include <LibCore/StandardPaths.h>
|
||||
#include <LibCore/Stream.h>
|
||||
#include <LibGUI/AboutDialog.h>
|
||||
|
@ -27,6 +26,7 @@
|
|||
#include <LibGUI/Menu.h>
|
||||
#include <LibGUI/Menubar.h>
|
||||
#include <LibGUI/MessageBox.h>
|
||||
#include <LibGUI/Process.h>
|
||||
#include <LibGUI/SeparatorWidget.h>
|
||||
#include <LibGUI/Statusbar.h>
|
||||
#include <LibGUI/TabWidget.h>
|
||||
|
@ -301,8 +301,8 @@ void BrowserWindow::build_menus()
|
|||
|
||||
settings_menu.add_separator();
|
||||
auto open_settings_action = GUI::Action::create("&Settings", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/settings.png").release_value_but_fixme_should_propagate_errors(),
|
||||
[](auto&) {
|
||||
MUST(Core::Process::spawn("/bin/BrowserSettings"));
|
||||
[this](auto&) {
|
||||
GUI::Process::spawn_or_show_error(this, "/bin/BrowserSettings");
|
||||
});
|
||||
settings_menu.add_action(move(open_settings_action));
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
*/
|
||||
|
||||
#include <AK/QuickSort.h>
|
||||
#include <LibCore/Process.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibDesktop/AppFile.h>
|
||||
#include <LibGUI/Application.h>
|
||||
|
@ -14,6 +13,7 @@
|
|||
#include <LibGUI/IconView.h>
|
||||
#include <LibGUI/Menu.h>
|
||||
#include <LibGUI/Model.h>
|
||||
#include <LibGUI/Process.h>
|
||||
#include <LibGUI/Statusbar.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <LibMain/Main.h>
|
||||
|
@ -104,7 +104,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
auto launch_origin_rect = icon_view->to_widget_rect(icon_view->content_rect(index)).translated(icon_view->screen_relative_rect().location());
|
||||
setenv("__libgui_launch_origin_rect", String::formatted("{},{},{},{}", launch_origin_rect.x(), launch_origin_rect.y(), launch_origin_rect.width(), launch_origin_rect.height()).characters(), 1);
|
||||
MUST(Core::Process::spawn(executable));
|
||||
GUI::Process::spawn_or_show_error(window, executable);
|
||||
};
|
||||
|
||||
auto statusbar = TRY(main_widget->try_add<GUI::Statusbar>());
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include <LibConfig/Listener.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
#include <LibCore/Process.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibDesktop/Launcher.h>
|
||||
#include <LibGUI/Action.h>
|
||||
|
@ -27,6 +26,7 @@
|
|||
#include <LibGUI/Menu.h>
|
||||
#include <LibGUI/Menubar.h>
|
||||
#include <LibGUI/MessageBox.h>
|
||||
#include <LibGUI/Process.h>
|
||||
#include <LibGUI/TextBox.h>
|
||||
#include <LibGUI/Widget.h>
|
||||
#include <LibGUI/Window.h>
|
||||
|
@ -328,7 +328,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
auto open_settings_action = GUI::Action::create("&Settings", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/settings.png").release_value_but_fixme_should_propagate_errors(),
|
||||
[&](auto&) {
|
||||
MUST(Core::Process::spawn("/bin/TerminalSettings"));
|
||||
GUI::Process::spawn_or_show_error(window, "/bin/TerminalSettings");
|
||||
});
|
||||
|
||||
TRY(terminal->context_menu().try_add_separator());
|
||||
|
@ -336,7 +336,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
auto file_menu = TRY(window->try_add_menu("&File"));
|
||||
TRY(file_menu->try_add_action(GUI::Action::create("Open New &Terminal", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-terminal.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) {
|
||||
MUST(Core::Process::spawn("/bin/Terminal"));
|
||||
GUI::Process::spawn_or_show_error(window, "/bin/Terminal");
|
||||
})));
|
||||
|
||||
TRY(file_menu->try_add_action(open_settings_action));
|
||||
|
|
|
@ -9,12 +9,12 @@
|
|||
#include <Applications/Welcome/WelcomeWindowGML.h>
|
||||
#include <LibConfig/Client.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/Process.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/Button.h>
|
||||
#include <LibGUI/CheckBox.h>
|
||||
#include <LibGUI/Label.h>
|
||||
#include <LibGUI/Painter.h>
|
||||
#include <LibGUI/Process.h>
|
||||
#include <LibGfx/Font/BitmapFont.h>
|
||||
#include <LibGfx/Palette.h>
|
||||
#include <LibMarkdown/Document.h>
|
||||
|
@ -53,8 +53,8 @@ WelcomeWidget::WelcomeWidget()
|
|||
|
||||
m_help_button = *find_descendant_of_type_named<GUI::Button>("help_button");
|
||||
m_help_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/book-open.png").release_value_but_fixme_should_propagate_errors());
|
||||
m_help_button->on_click = [](auto) {
|
||||
MUST(Core::Process::spawn("/bin/Help"sv));
|
||||
m_help_button->on_click = [&](auto) {
|
||||
GUI::Process::spawn_or_show_error(window(), "/bin/Help"sv);
|
||||
};
|
||||
|
||||
m_new_button = *find_descendant_of_type_named<GUI::Button>("new_button");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue