mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:48:10 +00:00
LibGUI: Add GUI::CommonActions::make_properties_action()
Many apps want a "Properties" action with the same icon and shortcut.
This commit is contained in:
parent
578f749791
commit
eff7ea5b84
4 changed files with 45 additions and 40 deletions
|
@ -296,21 +296,22 @@ int main(int argc, char** argv)
|
|||
|
||||
HashMap<pid_t, NonnullRefPtr<GUI::Window>> process_windows;
|
||||
|
||||
auto process_properties_action = GUI::Action::create("Properties", { Mod_Alt, Key_Return }, [&](auto&) {
|
||||
auto pid = selected_id(ProcessModel::Column::PID);
|
||||
auto process_properties_action = GUI::CommonActions::make_properties_action(
|
||||
[&](auto&) {
|
||||
auto pid = selected_id(ProcessModel::Column::PID);
|
||||
|
||||
RefPtr<GUI::Window> process_window;
|
||||
if (!process_windows.contains(pid)) {
|
||||
process_window = build_process_window(pid);
|
||||
process_window->on_close_request = [pid, &process_windows] {
|
||||
process_windows.remove(pid);
|
||||
return GUI::Window::CloseRequestDecision::Close;
|
||||
};
|
||||
process_windows.set(pid, *process_window);
|
||||
}
|
||||
process_window->show();
|
||||
process_window->move_to_front();
|
||||
});
|
||||
RefPtr<GUI::Window> process_window;
|
||||
if (!process_windows.contains(pid)) {
|
||||
process_window = build_process_window(pid);
|
||||
process_window->on_close_request = [pid, &process_windows] {
|
||||
process_windows.remove(pid);
|
||||
return GUI::Window::CloseRequestDecision::Close;
|
||||
};
|
||||
process_windows.set(pid, *process_window);
|
||||
}
|
||||
process_window->show();
|
||||
process_window->move_to_front();
|
||||
});
|
||||
|
||||
auto menubar = GUI::MenuBar::construct();
|
||||
auto& app_menu = menubar->add_menu("File");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue