159 lines
2.8 KiB
C++
Raw Normal View History

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