2024-08-10 17:57:15 +03:00
|
|
|
#include "menu.hpp"
|
|
|
|
|
|
|
|
using namespace app::browser::header;
|
|
|
|
|
|
|
|
Menu::Menu()
|
|
|
|
{
|
|
|
|
set_tooltip_text(
|
2024-08-12 21:30:30 +03:00
|
|
|
_("Menu")
|
2024-08-10 17:57:15 +03:00
|
|
|
);
|
|
|
|
|
|
|
|
set_menu_model(
|
2024-09-05 04:24:43 +03:00
|
|
|
main(
|
|
|
|
main_tab(
|
|
|
|
main_tab_page(
|
|
|
|
main_tab_page_navigation(
|
|
|
|
main_tab_page_navigation_history()
|
|
|
|
)
|
|
|
|
),
|
|
|
|
main_tab_close()
|
|
|
|
),
|
|
|
|
main_tools()
|
|
|
|
)
|
2024-08-10 17:57:15 +03:00
|
|
|
);
|
2024-09-05 04:24:43 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
Glib::RefPtr<Gio::Menu> Menu::main(
|
2024-09-05 04:57:42 +03:00
|
|
|
const Glib::RefPtr<Gio::Menu> & MAIN_TAB,
|
|
|
|
const Glib::RefPtr<Gio::Menu> & MAIN_TOOLS
|
2024-09-05 04:24:43 +03:00
|
|
|
) {
|
2024-09-05 04:28:22 +03:00
|
|
|
auto menu = Gio::Menu::create();
|
2024-09-05 04:24:43 +03:00
|
|
|
|
2024-09-05 04:28:22 +03:00
|
|
|
menu->append_submenu(
|
2024-09-05 04:24:43 +03:00
|
|
|
_("Tab"),
|
2024-09-05 04:47:34 +03:00
|
|
|
MAIN_TAB
|
2024-09-05 04:24:43 +03:00
|
|
|
);
|
|
|
|
|
2024-09-05 04:28:22 +03:00
|
|
|
menu->append_submenu(
|
2024-09-05 04:24:43 +03:00
|
|
|
_("Tools"),
|
2024-09-05 04:47:34 +03:00
|
|
|
MAIN_TOOLS
|
2024-09-05 04:24:43 +03:00
|
|
|
);
|
|
|
|
|
2024-09-05 04:28:22 +03:00
|
|
|
menu->append(
|
2024-09-05 04:24:43 +03:00
|
|
|
_("Quit"),
|
|
|
|
"app.quit"
|
|
|
|
);
|
|
|
|
|
2024-09-05 04:28:22 +03:00
|
|
|
return menu;
|
2024-09-05 04:24:43 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
Glib::RefPtr<Gio::Menu> Menu::main_tab(
|
2024-09-05 04:57:42 +03:00
|
|
|
const Glib::RefPtr<Gio::Menu> & MAIN_TAB_PAGE,
|
|
|
|
const Glib::RefPtr<Gio::Menu> & MAIN_TAB_CLOSE
|
2024-09-05 04:24:43 +03:00
|
|
|
) {
|
2024-09-05 04:28:22 +03:00
|
|
|
auto menu = Gio::Menu::create();
|
2024-09-05 04:24:43 +03:00
|
|
|
|
2024-09-05 04:28:22 +03:00
|
|
|
menu->append(
|
2024-09-05 04:24:43 +03:00
|
|
|
_("New.."),
|
|
|
|
"win.main_tab_append"
|
|
|
|
);
|
|
|
|
|
2024-09-05 04:28:22 +03:00
|
|
|
menu->append_submenu(
|
2024-09-05 04:24:43 +03:00
|
|
|
_("Page"),
|
2024-09-05 04:47:34 +03:00
|
|
|
MAIN_TAB_PAGE
|
2024-09-05 04:24:43 +03:00
|
|
|
);
|
|
|
|
|
2024-09-05 04:28:22 +03:00
|
|
|
menu->append_submenu(
|
2024-09-05 04:24:43 +03:00
|
|
|
_("Close"),
|
2024-09-05 04:47:34 +03:00
|
|
|
MAIN_TAB_CLOSE
|
2024-09-05 04:24:43 +03:00
|
|
|
);
|
|
|
|
|
2024-09-05 04:28:22 +03:00
|
|
|
return menu;
|
2024-09-05 04:24:43 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
Glib::RefPtr<Gio::Menu> Menu::main_tab_page(
|
2024-09-05 04:57:42 +03:00
|
|
|
const Glib::RefPtr<Gio::Menu> & MAIN_TAB_PAGE_NAVIGATION
|
2024-09-05 04:24:43 +03:00
|
|
|
) {
|
2024-09-05 04:28:22 +03:00
|
|
|
auto menu = Gio::Menu::create();
|
2024-09-05 04:24:43 +03:00
|
|
|
|
2024-09-05 04:28:22 +03:00
|
|
|
menu->append_submenu(
|
2024-09-05 04:24:43 +03:00
|
|
|
_("Navigation"),
|
2024-09-05 04:47:34 +03:00
|
|
|
MAIN_TAB_PAGE_NAVIGATION
|
2024-09-05 04:24:43 +03:00
|
|
|
);
|
|
|
|
|
2024-09-05 04:28:22 +03:00
|
|
|
return menu;
|
2024-09-05 04:24:43 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
Glib::RefPtr<Gio::Menu> Menu::main_tab_page_navigation(
|
2024-09-05 04:57:42 +03:00
|
|
|
const Glib::RefPtr<Gio::Menu> & MAIN_TAB_PAGE_NAVIGATION_HISTORY
|
2024-09-05 04:24:43 +03:00
|
|
|
) {
|
2024-09-05 04:28:22 +03:00
|
|
|
auto menu = Gio::Menu::create();
|
2024-09-05 04:24:43 +03:00
|
|
|
|
2024-09-05 04:28:22 +03:00
|
|
|
menu->append_submenu(
|
2024-09-05 04:24:43 +03:00
|
|
|
_("History"),
|
2024-09-05 04:47:34 +03:00
|
|
|
MAIN_TAB_PAGE_NAVIGATION_HISTORY
|
2024-09-05 04:24:43 +03:00
|
|
|
);
|
|
|
|
|
2024-09-05 04:28:22 +03:00
|
|
|
menu->append(
|
2024-09-05 04:24:43 +03:00
|
|
|
_("Update"),
|
2024-09-05 16:40:41 +03:00
|
|
|
"win.main_tab_page_navigation_update"
|
2024-09-05 04:24:43 +03:00
|
|
|
);
|
|
|
|
|
2024-09-05 04:28:22 +03:00
|
|
|
return menu;
|
2024-09-05 04:24:43 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
Glib::RefPtr<Gio::Menu> Menu::main_tab_page_navigation_history()
|
|
|
|
{
|
2024-09-05 04:28:22 +03:00
|
|
|
auto menu = Gio::Menu::create();
|
2024-09-05 04:24:43 +03:00
|
|
|
|
2024-09-05 04:28:22 +03:00
|
|
|
menu->append(
|
2024-09-05 04:24:43 +03:00
|
|
|
_("Back"),
|
|
|
|
"win.main_tab_page_navigation_history_try_back"
|
|
|
|
);
|
|
|
|
|
2024-09-05 04:28:22 +03:00
|
|
|
menu->append(
|
2024-09-05 04:24:43 +03:00
|
|
|
_("Forward"),
|
|
|
|
"win.main_tab_page_navigation_history_try_forward"
|
|
|
|
);
|
|
|
|
|
2024-09-05 04:28:22 +03:00
|
|
|
return menu;
|
2024-09-05 04:24:43 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
Glib::RefPtr<Gio::Menu> Menu::main_tab_close()
|
|
|
|
{
|
2024-09-05 04:28:22 +03:00
|
|
|
auto menu = Gio::Menu::create();
|
2024-09-05 04:24:43 +03:00
|
|
|
|
2024-09-05 04:28:22 +03:00
|
|
|
menu->append(
|
2024-09-05 04:24:43 +03:00
|
|
|
_("Active tab"),
|
|
|
|
"win.main_tab_close"
|
|
|
|
);
|
|
|
|
|
2024-09-05 04:28:22 +03:00
|
|
|
menu->append(
|
2024-09-05 04:24:43 +03:00
|
|
|
_("All tabs to left"),
|
|
|
|
"win.main_tab_close_left"
|
|
|
|
);
|
|
|
|
|
2024-09-05 04:28:22 +03:00
|
|
|
menu->append(
|
2024-09-05 04:24:43 +03:00
|
|
|
_("All tabs to right"),
|
|
|
|
"win.main_tab_close_right"
|
|
|
|
);
|
|
|
|
|
2024-09-05 04:28:22 +03:00
|
|
|
menu->append(
|
2024-09-05 04:24:43 +03:00
|
|
|
_("All tabs"),
|
|
|
|
"win.main_tab_close_all"
|
|
|
|
);
|
|
|
|
|
2024-09-05 04:28:22 +03:00
|
|
|
return menu;
|
2024-09-05 04:24:43 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
Glib::RefPtr<Gio::Menu> Menu::main_tools()
|
|
|
|
{
|
2024-09-05 04:28:22 +03:00
|
|
|
auto menu = Gio::Menu::create();
|
2024-09-05 04:24:43 +03:00
|
|
|
|
2024-09-05 04:28:22 +03:00
|
|
|
menu->append(
|
2024-09-05 04:24:43 +03:00
|
|
|
_("Debug"),
|
|
|
|
"win.debug"
|
|
|
|
);
|
|
|
|
|
2024-09-05 04:28:22 +03:00
|
|
|
return menu;
|
2024-09-04 23:29:01 +03:00
|
|
|
}
|