From 50df17a119e512a5f6bf0cb7713f8a92259cc08e Mon Sep 17 00:00:00 2001 From: yggverse Date: Thu, 5 Sep 2024 23:13:30 +0300 Subject: [PATCH] reorder methods --- src/app/browser/main/tab/page/navigation.cpp | 90 ++++++++++---------- src/app/browser/main/tab/page/navigation.hpp | 26 +++--- 2 files changed, 57 insertions(+), 59 deletions(-) diff --git a/src/app/browser/main/tab/page/navigation.cpp b/src/app/browser/main/tab/page/navigation.cpp index dd87ef01..f8a43f98 100644 --- a/src/app/browser/main/tab/page/navigation.cpp +++ b/src/app/browser/main/tab/page/navigation.cpp @@ -87,16 +87,6 @@ Navigation::Navigation( } // Actions -void Navigation::history_add( - const Glib::ustring & REQUEST, - const bool & UPDATE_MEMORY_INDEX -) { - navigationHistory->add( - REQUEST, - UPDATE_MEMORY_INDEX - ); -} - void Navigation::refresh() { // Toggle base button sensibility @@ -113,15 +103,47 @@ void Navigation::refresh() navigationHistory->refresh(); } -// Setters @TODO is really wanted? -void Navigation::set_request_text( - const Glib::ustring & VALUE +void Navigation::history_add( + const Glib::ustring & REQUEST, + const bool & UPDATE_MEMORY_INDEX ) { - navigationRequest->set_text( - VALUE + navigationHistory->add( + REQUEST, + UPDATE_MEMORY_INDEX ); +} + +// Actionable getters +bool Navigation::try_history_back( + Glib::ustring & request, + const bool & UPDATE_MEMORY_INDEX +) { + navigation::History::Memory match; + + if (navigationHistory->try_back(match, UPDATE_MEMORY_INDEX)) + { + request = match.request; + + return true; + } - // refresh(); not wanted as on change listener do same @TODO + return false; +} + +bool Navigation::try_history_forward( + Glib::ustring & request, + const bool & UPDATE_MEMORY_INDEX +) { + navigation::History::Memory match; + + if (navigationHistory->try_forward(match, UPDATE_MEMORY_INDEX)) + { + request = match.request; + + return true; + } + + return false; } // Getters @TODO & @@ -155,35 +177,11 @@ Glib::ustring Navigation::get_request_port() return navigationRequest->get_port(); } -// Actionable getters -bool Navigation::try_history_back( - Glib::ustring & request, - const bool & UPDATE_MEMORY_INDEX -) { - navigation::History::Memory match; - - if (navigationHistory->try_back(match, UPDATE_MEMORY_INDEX)) - { - request = match.request; - - return true; - } - - return false; -} - -bool Navigation::try_history_forward( - Glib::ustring & request, - const bool & UPDATE_MEMORY_INDEX +// Setters +void Navigation::set_request_text( + const Glib::ustring & VALUE ) { - navigation::History::Memory match; - - if (navigationHistory->try_forward(match, UPDATE_MEMORY_INDEX)) - { - request = match.request; - - return true; - } - - return false; + navigationRequest->set_text( + VALUE + ); } \ No newline at end of file diff --git a/src/app/browser/main/tab/page/navigation.hpp b/src/app/browser/main/tab/page/navigation.hpp index b1c7dd37..339cd02e 100644 --- a/src/app/browser/main/tab/page/navigation.hpp +++ b/src/app/browser/main/tab/page/navigation.hpp @@ -37,16 +37,22 @@ namespace app::browser::main::tab::page ); // Actions + void refresh(); + void history_add( const Glib::ustring & REQUEST, const bool & UPDATE_MEMORY_INDEX ); - void refresh(); + // Actionable getters + bool try_history_back( + Glib::ustring & request, + const bool & UPDATE_MEMORY_INDEX + ); - // Setters - void set_request_text( - const Glib::ustring & VALUE + bool try_history_forward( + Glib::ustring & request, + const bool & UPDATE_MEMORY_INDEX ); // Getters @@ -58,15 +64,9 @@ 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, - const bool & UPDATE_MEMORY_INDEX - ); - - bool try_history_forward( - Glib::ustring & request, - const bool & UPDATE_MEMORY_INDEX + // Setters + void set_request_text( + const Glib::ustring & VALUE ); }; }