|
|
|
@ -2,158 +2,144 @@
@@ -2,158 +2,144 @@
|
|
|
|
|
|
|
|
|
|
using namespace app::browser::header; |
|
|
|
|
|
|
|
|
|
Menu::Menu() |
|
|
|
|
{ |
|
|
|
|
Menu::Menu( |
|
|
|
|
const Glib::RefPtr<Gio::SimpleAction> & ACTION__DEBUG, |
|
|
|
|
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_APPEND, |
|
|
|
|
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_CLOSE, |
|
|
|
|
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_PAGE_NAVIGATION_HISTORY_BACK, |
|
|
|
|
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_PAGE_NAVIGATION_HISTORY_FORWARD, |
|
|
|
|
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_PAGE_NAVIGATION_UPDATE |
|
|
|
|
) { |
|
|
|
|
// Init widget
|
|
|
|
|
set_tooltip_text( |
|
|
|
|
_("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( |
|
|
|
|
const Glib::RefPtr<Gio::Menu> & MAIN_TAB, |
|
|
|
|
const Glib::RefPtr<Gio::Menu> & MAIN_TOOLS |
|
|
|
|
) { |
|
|
|
|
auto menu = Gio::Menu::create(); |
|
|
|
|
|
|
|
|
|
menu->append_submenu( |
|
|
|
|
_("Tab"), |
|
|
|
|
MAIN_TAB |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
menu->append_submenu( |
|
|
|
|
_("Tools"), |
|
|
|
|
MAIN_TOOLS |
|
|
|
|
); |
|
|
|
|
// Init components @TODO make builder
|
|
|
|
|
const auto MENU__MAIN = Gio::Menu::create(); |
|
|
|
|
|
|
|
|
|
menu->append( |
|
|
|
|
_("Quit"), |
|
|
|
|
"app.quit" |
|
|
|
|
); |
|
|
|
|
const auto MENU__MAIN_TAB = Gio::Menu::create(); |
|
|
|
|
|
|
|
|
|
return menu; |
|
|
|
|
} |
|
|
|
|
MENU__MAIN_TAB->append( |
|
|
|
|
_("New.."), |
|
|
|
|
get_action_detailed_name( |
|
|
|
|
ACTION__MAIN_TAB_APPEND |
|
|
|
|
) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
Glib::RefPtr<Gio::Menu> Menu::main_tab( |
|
|
|
|
const Glib::RefPtr<Gio::Menu> & MAIN_TAB_PAGE, |
|
|
|
|
const Glib::RefPtr<Gio::Menu> & MAIN_TAB_CLOSE |
|
|
|
|
) { |
|
|
|
|
auto menu = Gio::Menu::create(); |
|
|
|
|
const auto MENU__MAIN_TAB_PAGE = Gio::Menu::create(); |
|
|
|
|
|
|
|
|
|
menu->append( |
|
|
|
|
_("New.."), |
|
|
|
|
"win.main_tab_append" |
|
|
|
|
); |
|
|
|
|
const auto MENU__MAIN_TAB_PAGE_NAVIGATION = Gio::Menu::create(); |
|
|
|
|
|
|
|
|
|
menu->append_submenu( |
|
|
|
|
_("Page"), |
|
|
|
|
MAIN_TAB_PAGE |
|
|
|
|
); |
|
|
|
|
const auto MENU__MAIN_TAB_PAGE_NAVIGATION_HISTORY = Gio::Menu::create(); |
|
|
|
|
|
|
|
|
|
menu->append_submenu( |
|
|
|
|
_("Close"), |
|
|
|
|
MAIN_TAB_CLOSE |
|
|
|
|
); |
|
|
|
|
MENU__MAIN_TAB_PAGE_NAVIGATION_HISTORY->append( |
|
|
|
|
_("Back"), |
|
|
|
|
get_action_detailed_name( |
|
|
|
|
ACTION__MAIN_TAB_PAGE_NAVIGATION_HISTORY_BACK |
|
|
|
|
) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
return menu; |
|
|
|
|
} |
|
|
|
|
MENU__MAIN_TAB_PAGE_NAVIGATION_HISTORY->append( |
|
|
|
|
_("Forward"), |
|
|
|
|
get_action_detailed_name( |
|
|
|
|
ACTION__MAIN_TAB_PAGE_NAVIGATION_HISTORY_FORWARD |
|
|
|
|
) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
Glib::RefPtr<Gio::Menu> Menu::main_tab_page( |
|
|
|
|
const Glib::RefPtr<Gio::Menu> & MAIN_TAB_PAGE_NAVIGATION |
|
|
|
|
) { |
|
|
|
|
auto menu = Gio::Menu::create(); |
|
|
|
|
MENU__MAIN_TAB_PAGE_NAVIGATION->append_submenu( |
|
|
|
|
_("History"), |
|
|
|
|
MENU__MAIN_TAB_PAGE_NAVIGATION_HISTORY |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
menu->append_submenu( |
|
|
|
|
_("Navigation"), |
|
|
|
|
MAIN_TAB_PAGE_NAVIGATION |
|
|
|
|
); |
|
|
|
|
MENU__MAIN_TAB_PAGE_NAVIGATION->append( |
|
|
|
|
_("Update"), |
|
|
|
|
get_action_detailed_name( |
|
|
|
|
ACTION__MAIN_TAB_PAGE_NAVIGATION_UPDATE |
|
|
|
|
) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
return menu; |
|
|
|
|
} |
|
|
|
|
MENU__MAIN_TAB_PAGE->append_submenu( |
|
|
|
|
_("Navigation"), |
|
|
|
|
MENU__MAIN_TAB_PAGE_NAVIGATION |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
Glib::RefPtr<Gio::Menu> Menu::main_tab_page_navigation( |
|
|
|
|
const Glib::RefPtr<Gio::Menu> & MAIN_TAB_PAGE_NAVIGATION_HISTORY |
|
|
|
|
) { |
|
|
|
|
auto menu = Gio::Menu::create(); |
|
|
|
|
MENU__MAIN_TAB->append_submenu( |
|
|
|
|
_("Page"), |
|
|
|
|
MENU__MAIN_TAB_PAGE |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
menu->append_submenu( |
|
|
|
|
_("History"), |
|
|
|
|
MAIN_TAB_PAGE_NAVIGATION_HISTORY |
|
|
|
|
); |
|
|
|
|
const auto MENU__MAIN_TAB_CLOSE = Gio::Menu::create(); |
|
|
|
|
|
|
|
|
|
menu->append( |
|
|
|
|
_("Update"), |
|
|
|
|
"win.main_tab_page_navigation_update" |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
return menu; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Glib::RefPtr<Gio::Menu> Menu::main_tab_page_navigation_history() |
|
|
|
|
{ |
|
|
|
|
auto menu = Gio::Menu::create(); |
|
|
|
|
|
|
|
|
|
menu->append( |
|
|
|
|
_("Back"), |
|
|
|
|
"win.main_tab_page_navigation_history_back" |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
menu->append( |
|
|
|
|
_("Forward"), |
|
|
|
|
"win.main_tab_page_navigation_history_forward" |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
return menu; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Glib::RefPtr<Gio::Menu> Menu::main_tab_close() |
|
|
|
|
{ |
|
|
|
|
auto menu = Gio::Menu::create(); |
|
|
|
|
|
|
|
|
|
menu->append( |
|
|
|
|
_("Active tab"), |
|
|
|
|
"win.main_tab_close" |
|
|
|
|
); |
|
|
|
|
MENU__MAIN_TAB_CLOSE->append( |
|
|
|
|
_("Active tab"), |
|
|
|
|
get_action_detailed_name( |
|
|
|
|
ACTION__MAIN_TAB_CLOSE |
|
|
|
|
) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
// @TODO
|
|
|
|
|
/*
|
|
|
|
|
MENU__MAIN_TAB_CLOSE->append( |
|
|
|
|
_("All tabs to left"), |
|
|
|
|
get_action_detailed_name( |
|
|
|
|
ACTION__MAIN_TAB_CLOSE |
|
|
|
|
) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
menu->append( |
|
|
|
|
_("All tabs to left"), |
|
|
|
|
"win.main_tab_close_left" |
|
|
|
|
); |
|
|
|
|
MENU__MAIN_TAB_CLOSE->append( |
|
|
|
|
_("All tabs to right"), |
|
|
|
|
get_action_detailed_name( |
|
|
|
|
ACTION__MAIN_TAB_CLOSE |
|
|
|
|
) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
menu->append( |
|
|
|
|
_("All tabs to right"), |
|
|
|
|
"win.main_tab_close_right" |
|
|
|
|
); |
|
|
|
|
MENU__MAIN_TAB_CLOSE->append( |
|
|
|
|
_("All tabs"), |
|
|
|
|
get_action_detailed_name( |
|
|
|
|
ACTION__MAIN_TAB_CLOSE |
|
|
|
|
) |
|
|
|
|
); |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
MENU__MAIN_TAB->append_submenu( |
|
|
|
|
_("Close"), |
|
|
|
|
MENU__MAIN_TAB_CLOSE |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
MENU__MAIN->append_submenu( |
|
|
|
|
_("Tab"), |
|
|
|
|
MENU__MAIN_TAB |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
const auto MENU__MAIN_TOOLS = Gio::Menu::create(); |
|
|
|
|
|
|
|
|
|
MENU__MAIN_TOOLS->append( |
|
|
|
|
_("Debug"), |
|
|
|
|
get_action_detailed_name( |
|
|
|
|
ACTION__DEBUG |
|
|
|
|
) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
MENU__MAIN->append_submenu( |
|
|
|
|
_("Tools"), |
|
|
|
|
MENU__MAIN_TOOLS |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
MENU__MAIN->append( |
|
|
|
|
_("Quit"), |
|
|
|
|
"app.quit" // @TODO
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
menu->append( |
|
|
|
|
_("All tabs"), |
|
|
|
|
"win.main_tab_close_all" |
|
|
|
|
set_menu_model( |
|
|
|
|
MENU__MAIN |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
return menu; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Glib::RefPtr<Gio::Menu> Menu::main_tools() |
|
|
|
|
{ |
|
|
|
|
auto menu = Gio::Menu::create(); |
|
|
|
|
|
|
|
|
|
menu->append( |
|
|
|
|
_("Debug"), |
|
|
|
|
"win.debug" |
|
|
|
|
Glib::ustring Menu::get_action_detailed_name( |
|
|
|
|
const Glib::RefPtr<Gio::SimpleAction> & ACTION |
|
|
|
|
) { |
|
|
|
|
return Glib::ustring::sprintf( |
|
|
|
|
"win.%s", ACTION->get_name() |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
return menu; |
|
|
|
|
} |