mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-03-12 13:41:34 +00:00
update history actions api
This commit is contained in:
parent
9ef5b169d3
commit
0a09de1fdd
@ -104,27 +104,25 @@ Browser::Browser(
|
|||||||
// Tab page navigation actions
|
// Tab page navigation actions
|
||||||
add_action(
|
add_action(
|
||||||
"main_tab_page_navigation_update",
|
"main_tab_page_navigation_update",
|
||||||
[this](const bool & ADD_HISTORY = false)
|
|
||||||
{
|
|
||||||
browserMain->tab_page_navigation_update(
|
|
||||||
ADD_HISTORY
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
add_action(
|
|
||||||
"main_tab_page_navigation_history_try_back",
|
|
||||||
[this]()
|
[this]()
|
||||||
{
|
{
|
||||||
browserMain->tab_page_navigation_history_try_back();
|
browserMain->tab_page_navigation_update();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
add_action(
|
add_action(
|
||||||
"main_tab_page_navigation_history_try_forward",
|
"main_tab_page_navigation_history_back",
|
||||||
|
[this]()
|
||||||
|
{
|
||||||
|
browserMain->tab_page_navigation_history_back();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
add_action(
|
||||||
|
"main_tab_page_navigation_history_forward",
|
||||||
[this]
|
[this]
|
||||||
{
|
{
|
||||||
browserMain->tab_page_navigation_history_try_forward();
|
browserMain->tab_page_navigation_history_forward();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
@ -108,12 +108,12 @@ Glib::RefPtr<Gio::Menu> Menu::main_tab_page_navigation_history()
|
|||||||
|
|
||||||
menu->append(
|
menu->append(
|
||||||
_("Back"),
|
_("Back"),
|
||||||
"win.main_tab_page_navigation_history_try_back"
|
"win.main_tab_page_navigation_history_back"
|
||||||
);
|
);
|
||||||
|
|
||||||
menu->append(
|
menu->append(
|
||||||
_("Forward"),
|
_("Forward"),
|
||||||
"win.main_tab_page_navigation_history_try_forward"
|
"win.main_tab_page_navigation_history_forward"
|
||||||
);
|
);
|
||||||
|
|
||||||
return menu;
|
return menu;
|
||||||
|
@ -74,39 +74,22 @@ void Main::tab_close_all()
|
|||||||
mainTab->close_all();
|
mainTab->close_all();
|
||||||
};
|
};
|
||||||
|
|
||||||
void Main::tab_page_navigation_update(
|
void Main::tab_page_navigation_update() {
|
||||||
const bool & ADD_HISTORY
|
|
||||||
) {
|
|
||||||
mainTab->page_navigation_update(
|
mainTab->page_navigation_update(
|
||||||
mainTab->get_current_page(), // @TODO
|
mainTab->get_current_page() // @TODO
|
||||||
ADD_HISTORY
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
bool Main::tab_page_navigation_history_try_back()
|
void Main::tab_page_navigation_history_back()
|
||||||
{
|
{
|
||||||
const int & PAGE_NUMBER = mainTab->get_current_page();
|
mainTab->page_navigation_history_back(
|
||||||
|
mainTab->get_current_page() // @TODO
|
||||||
if (PAGE_NUMBER >= 0)
|
);
|
||||||
{
|
|
||||||
return mainTab->page_navigation_history_try_back(
|
|
||||||
PAGE_NUMBER
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
bool Main::tab_page_navigation_history_try_forward()
|
void Main::tab_page_navigation_history_forward()
|
||||||
{
|
{
|
||||||
const int & PAGE_NUMBER = mainTab->get_current_page();
|
mainTab->page_navigation_history_forward(
|
||||||
|
mainTab->get_current_page() // @TODO
|
||||||
if (PAGE_NUMBER >= 0)
|
);
|
||||||
{
|
|
||||||
return mainTab->page_navigation_history_try_forward(
|
|
||||||
PAGE_NUMBER
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
};
|
};
|
@ -38,14 +38,9 @@ namespace app::browser
|
|||||||
void tab_close_right();
|
void tab_close_right();
|
||||||
void tab_close();
|
void tab_close();
|
||||||
|
|
||||||
void tab_page_navigation_update(
|
void tab_page_navigation_update();
|
||||||
const bool & ADD_HISTORY
|
void tab_page_navigation_history_back();
|
||||||
);
|
void tab_page_navigation_history_forward();
|
||||||
|
|
||||||
bool tab_page_navigation_history_try_back();
|
|
||||||
bool tab_page_navigation_history_try_forward();
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,20 +118,20 @@ void Tab::page_navigation_update(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Tab::page_navigation_history_try_back(
|
void Tab::page_navigation_history_back(
|
||||||
const int & PAGE_NUMBER
|
const int & PAGE_NUMBER
|
||||||
) {
|
) {
|
||||||
return get_tabPage(
|
get_tabPage(
|
||||||
PAGE_NUMBER
|
PAGE_NUMBER
|
||||||
)->navigation_history_try_back();
|
)->navigation_history_back();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Tab::page_navigation_history_try_forward(
|
void Tab::page_navigation_history_forward(
|
||||||
const int & PAGE_NUMBER
|
const int & PAGE_NUMBER
|
||||||
) {
|
) {
|
||||||
return get_tabPage(
|
get_tabPage(
|
||||||
PAGE_NUMBER
|
PAGE_NUMBER
|
||||||
)->navigation_history_try_forward();
|
)->navigation_history_forward();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Private helpers
|
// Private helpers
|
||||||
|
@ -60,14 +60,14 @@ namespace app::browser::main
|
|||||||
|
|
||||||
void page_navigation_update(
|
void page_navigation_update(
|
||||||
const int & PAGE_NUMBER,
|
const int & PAGE_NUMBER,
|
||||||
const bool & ADD_HISTORY
|
const bool & ADD_HISTORY = true
|
||||||
);
|
);
|
||||||
|
|
||||||
bool page_navigation_history_try_back(
|
void page_navigation_history_back(
|
||||||
const int & PAGE_NUMBER
|
const int & PAGE_NUMBER
|
||||||
);
|
);
|
||||||
|
|
||||||
bool page_navigation_history_try_forward(
|
void page_navigation_history_forward(
|
||||||
const int & PAGE_NUMBER
|
const int & PAGE_NUMBER
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -242,12 +242,34 @@ void Page::navigation_update(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Page::navigation_history_try_back()
|
void Page::navigation_history_back()
|
||||||
{
|
{
|
||||||
return pageNavigation->history_try_back();
|
Glib::ustring request;
|
||||||
|
|
||||||
|
if (pageNavigation->try_history_back(request))
|
||||||
|
{
|
||||||
|
pageNavigation->set_request_text(
|
||||||
|
request
|
||||||
|
);
|
||||||
|
|
||||||
|
navigation_update(
|
||||||
|
false
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Page::navigation_history_try_forward()
|
void Page::navigation_history_forward()
|
||||||
{
|
{
|
||||||
return pageNavigation->history_try_forward();
|
Glib::ustring request;
|
||||||
|
|
||||||
|
if (pageNavigation->try_history_forward(request))
|
||||||
|
{
|
||||||
|
pageNavigation->set_request_text(
|
||||||
|
request
|
||||||
|
);
|
||||||
|
|
||||||
|
navigation_update(
|
||||||
|
false
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
@ -63,8 +63,8 @@ namespace app::browser::main::tab
|
|||||||
const bool & ADD_HISTORY
|
const bool & ADD_HISTORY
|
||||||
);
|
);
|
||||||
|
|
||||||
bool navigation_history_try_back();
|
void navigation_history_back();
|
||||||
bool navigation_history_try_forward();
|
void navigation_history_forward();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,47 +87,11 @@ Navigation::Navigation(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
bool Navigation::history_try_back()
|
|
||||||
{
|
|
||||||
navigation::History::Memory match;
|
|
||||||
|
|
||||||
if (navigationHistory->try_back(match))
|
|
||||||
{
|
|
||||||
navigationRequest->set_text(
|
|
||||||
match.request
|
|
||||||
);
|
|
||||||
|
|
||||||
return activate_action(
|
|
||||||
"win.main_tab_page_navigation_update"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Navigation::history_try_forward()
|
|
||||||
{
|
|
||||||
navigation::History::Memory match;
|
|
||||||
|
|
||||||
if (navigationHistory->try_forward(match))
|
|
||||||
{
|
|
||||||
navigationRequest->set_text(
|
|
||||||
match.request
|
|
||||||
);
|
|
||||||
|
|
||||||
return activate_action(
|
|
||||||
"win.main_tab_page_navigation_update"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Navigation::history_add(
|
void Navigation::history_add(
|
||||||
const Glib::ustring & VALUE
|
const Glib::ustring & REQUEST
|
||||||
) {
|
) {
|
||||||
navigationHistory->add(
|
navigationHistory->add(
|
||||||
VALUE
|
REQUEST
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,4 +151,34 @@ Glib::ustring Navigation::get_request_query()
|
|||||||
Glib::ustring Navigation::get_request_port()
|
Glib::ustring Navigation::get_request_port()
|
||||||
{
|
{
|
||||||
return navigationRequest->get_port();
|
return navigationRequest->get_port();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Navigation::try_history_back(
|
||||||
|
Glib::ustring & request
|
||||||
|
) {
|
||||||
|
navigation::History::Memory match;
|
||||||
|
|
||||||
|
if (navigationHistory->try_back(match))
|
||||||
|
{
|
||||||
|
request = match.request;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Navigation::try_history_forward(
|
||||||
|
Glib::ustring & request
|
||||||
|
) {
|
||||||
|
navigation::History::Memory match;
|
||||||
|
|
||||||
|
if (navigationHistory->try_forward(match))
|
||||||
|
{
|
||||||
|
request = match.request;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
@ -38,12 +38,9 @@ namespace app::browser::main::tab::page
|
|||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
void history_add(
|
void history_add(
|
||||||
const Glib::ustring & VALUE
|
const Glib::ustring & REQUEST
|
||||||
);
|
);
|
||||||
|
|
||||||
bool history_try_back();
|
|
||||||
bool history_try_forward();
|
|
||||||
|
|
||||||
void refresh();
|
void refresh();
|
||||||
|
|
||||||
// Setters
|
// Setters
|
||||||
@ -59,6 +56,14 @@ namespace app::browser::main::tab::page
|
|||||||
Glib::ustring get_request_port();
|
Glib::ustring get_request_port();
|
||||||
Glib::ustring get_request_path();
|
Glib::ustring get_request_path();
|
||||||
Glib::ustring get_request_query();
|
Glib::ustring get_request_query();
|
||||||
|
|
||||||
|
bool try_history_back(
|
||||||
|
Glib::ustring & request
|
||||||
|
);
|
||||||
|
|
||||||
|
bool try_history_forward(
|
||||||
|
Glib::ustring & request
|
||||||
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ using namespace app::browser::main::tab::page::navigation::history;
|
|||||||
Back::Back()
|
Back::Back()
|
||||||
{
|
{
|
||||||
set_action_name(
|
set_action_name(
|
||||||
"win.main_tab_page_navigation_history_try_back"
|
"win.main_tab_page_navigation_history_back"
|
||||||
);
|
);
|
||||||
|
|
||||||
set_icon_name(
|
set_icon_name(
|
||||||
|
@ -5,7 +5,7 @@ using namespace app::browser::main::tab::page::navigation::history;
|
|||||||
Forward::Forward()
|
Forward::Forward()
|
||||||
{
|
{
|
||||||
set_action_name(
|
set_action_name(
|
||||||
"win.main_tab_page_navigation_history_try_forward"
|
"win.main_tab_page_navigation_history_forward"
|
||||||
);
|
);
|
||||||
|
|
||||||
set_icon_name(
|
set_icon_name(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user