mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 10:22:05 -05:00
Browser: Move the "About" action to WindowActions
This commit is contained in:
parent
45a932a600
commit
3fcfab4404
4 changed files with 16 additions and 4 deletions
|
@ -29,7 +29,6 @@
|
|||
#include "WindowActions.h"
|
||||
#include "History.h"
|
||||
#include "InspectorWidget.h"
|
||||
#include <LibGUI/AboutDialog.h>
|
||||
#include <LibGUI/Action.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/BoxLayout.h>
|
||||
|
@ -257,9 +256,7 @@ Tab::Tab()
|
|||
bookmarks_menu.add_action(show_bookmarksbar_action);
|
||||
|
||||
auto& help_menu = m_menubar->add_menu("Help");
|
||||
help_menu.add_action(GUI::Action::create("About", [this](const GUI::Action&) {
|
||||
GUI::AboutDialog::show("Browser", Gfx::Bitmap::load_from_file("/res/icons/32x32/filetype-html.png"), window());
|
||||
}));
|
||||
help_menu.add_action(WindowActions::the().about_action());
|
||||
}
|
||||
|
||||
Tab::~Tab()
|
||||
|
|
|
@ -36,6 +36,13 @@ WindowActions::WindowActions(GUI::Window& window)
|
|||
on_previous_tab();
|
||||
},
|
||||
&window);
|
||||
|
||||
m_about_action = GUI::Action::create(
|
||||
"About", [this](const GUI::Action&) {
|
||||
if (on_about)
|
||||
on_about();
|
||||
},
|
||||
&window);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,15 +13,18 @@ public:
|
|||
Function<void()> on_create_new_tab;
|
||||
Function<void()> on_next_tab;
|
||||
Function<void()> on_previous_tab;
|
||||
Function<void()> on_about;
|
||||
|
||||
GUI::Action& create_new_tab_action() { return *m_create_new_tab_action; }
|
||||
GUI::Action& next_tab_action() { return *m_next_tab_action; }
|
||||
GUI::Action& previous_tab_action() { return *m_previous_tab_action; }
|
||||
GUI::Action& about_action() { return *m_about_action; }
|
||||
|
||||
private:
|
||||
RefPtr<GUI::Action> m_create_new_tab_action;
|
||||
RefPtr<GUI::Action> m_next_tab_action;
|
||||
RefPtr<GUI::Action> m_previous_tab_action;
|
||||
RefPtr<GUI::Action> m_about_action;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "Tab.h"
|
||||
#include "WindowActions.h"
|
||||
#include <LibCore/File.h>
|
||||
#include <LibGUI/AboutDialog.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/BoxLayout.h>
|
||||
#include <LibGUI/TabWidget.h>
|
||||
|
@ -140,6 +141,10 @@ int main(int argc, char** argv)
|
|||
tab_widget.activate_previous_tab();
|
||||
};
|
||||
|
||||
window_actions.on_about = [&] {
|
||||
GUI::AboutDialog::show("Browser", Gfx::Bitmap::load_from_file("/res/icons/32x32/filetype-html.png"), window);
|
||||
};
|
||||
|
||||
create_new_tab(default_url, true);
|
||||
window->show();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue