From ab0c28badf724a143296a01a1f30adaec71ec02e Mon Sep 17 00:00:00 2001 From: yggverse Date: Thu, 5 Sep 2024 23:04:53 +0300 Subject: [PATCH] remove default values, add follow argument --- src/app/browser/main/tab/page.cpp | 7 ++++--- src/app/browser/main/tab/page/navigation.cpp | 17 +++++++++++------ src/app/browser/main/tab/page/navigation.hpp | 10 +++++++--- .../main/tab/page/navigation/history.hpp | 6 +++--- 4 files changed, 25 insertions(+), 15 deletions(-) diff --git a/src/app/browser/main/tab/page.cpp b/src/app/browser/main/tab/page.cpp index 23c007c0..3b29faf2 100644 --- a/src/app/browser/main/tab/page.cpp +++ b/src/app/browser/main/tab/page.cpp @@ -78,7 +78,8 @@ void Page::navigation_update( if (ADD_HISTORY) { pageNavigation->history_add( - pageNavigation->get_request_text() + pageNavigation->get_request_text(), + true ); } @@ -246,7 +247,7 @@ void Page::navigation_history_back() { Glib::ustring request; - if (pageNavigation->try_history_back(request)) + if (pageNavigation->try_history_back(request, true)) { pageNavigation->set_request_text( request @@ -262,7 +263,7 @@ void Page::navigation_history_forward() { Glib::ustring request; - if (pageNavigation->try_history_forward(request)) + if (pageNavigation->try_history_forward(request, true)) { pageNavigation->set_request_text( request diff --git a/src/app/browser/main/tab/page/navigation.cpp b/src/app/browser/main/tab/page/navigation.cpp index 69c61565..7b1dd886 100644 --- a/src/app/browser/main/tab/page/navigation.cpp +++ b/src/app/browser/main/tab/page/navigation.cpp @@ -88,10 +88,12 @@ Navigation::Navigation( // Actions void Navigation::history_add( - const Glib::ustring & REQUEST + const Glib::ustring & REQUEST, + const bool & FOLLOW ) { navigationHistory->add( - REQUEST + REQUEST, + FOLLOW ); } @@ -153,12 +155,14 @@ Glib::ustring Navigation::get_request_port() return navigationRequest->get_port(); } +// Actionable getters bool Navigation::try_history_back( - Glib::ustring & request + Glib::ustring & request, + const bool & FOLLOW ) { navigation::History::Memory match; - if (navigationHistory->try_back(match)) + if (navigationHistory->try_back(match, FOLLOW)) { request = match.request; @@ -169,11 +173,12 @@ bool Navigation::try_history_back( } bool Navigation::try_history_forward( - Glib::ustring & request + Glib::ustring & request, + const bool & FOLLOW ) { navigation::History::Memory match; - if (navigationHistory->try_forward(match)) + if (navigationHistory->try_forward(match, FOLLOW)) { request = match.request; diff --git a/src/app/browser/main/tab/page/navigation.hpp b/src/app/browser/main/tab/page/navigation.hpp index 2370d67d..3a12dc7d 100644 --- a/src/app/browser/main/tab/page/navigation.hpp +++ b/src/app/browser/main/tab/page/navigation.hpp @@ -38,7 +38,8 @@ namespace app::browser::main::tab::page // Actions void history_add( - const Glib::ustring & REQUEST + const Glib::ustring & REQUEST, + const bool & FOLLOW ); void refresh(); @@ -57,12 +58,15 @@ namespace app::browser::main::tab::page Glib::ustring get_request_path(); Glib::ustring get_request_query(); + // Actionable getters bool try_history_back( - Glib::ustring & request + Glib::ustring & request, + const bool & FOLLOW ); bool try_history_forward( - Glib::ustring & request + Glib::ustring & request, + const bool & FOLLOW ); }; } diff --git a/src/app/browser/main/tab/page/navigation/history.hpp b/src/app/browser/main/tab/page/navigation/history.hpp index 53912578..2f7db2a6 100644 --- a/src/app/browser/main/tab/page/navigation/history.hpp +++ b/src/app/browser/main/tab/page/navigation/history.hpp @@ -42,7 +42,7 @@ namespace app::browser::main::tab::page::navigation // Actions void add( const Glib::ustring & REQUEST, - const bool & FOLLOW = true + const bool & FOLLOW ); void refresh(); @@ -51,12 +51,12 @@ namespace app::browser::main::tab::page::navigation bool try_back( Memory & match, - const bool & FOLLOW = true + const bool & FOLLOW ); bool try_forward( Memory & match, - const bool & FOLLOW = true + const bool & FOLLOW ); }; }