From 55f1680f8b1d274e69de05ab4d206c6563a2f420 Mon Sep 17 00:00:00 2001 From: yggverse Date: Sun, 8 Sep 2024 04:40:02 +0300 Subject: [PATCH] add update action support, remove request value from construction --- src/app/browser/main.cpp | 1 - src/app/browser/main/tab.cpp | 2 -- src/app/browser/main/tab.hpp | 1 - src/app/browser/main/tab/page.cpp | 2 -- src/app/browser/main/tab/page.hpp | 1 - src/app/browser/main/tab/page/navigation.cpp | 3 +-- src/app/browser/main/tab/page/navigation.hpp | 1 - .../main/tab/page/navigation/request.cpp | 22 ++++++------------- .../main/tab/page/navigation/request.hpp | 7 +++++- 9 files changed, 14 insertions(+), 26 deletions(-) diff --git a/src/app/browser/main.cpp b/src/app/browser/main.cpp index 6f55912c..8586a43a 100644 --- a/src/app/browser/main.cpp +++ b/src/app/browser/main.cpp @@ -46,7 +46,6 @@ void Main::tab_append() mainTab->append( _("New page"), "", // @TODO - "", true ); }; diff --git a/src/app/browser/main/tab.cpp b/src/app/browser/main/tab.cpp index 982921a0..26cca214 100644 --- a/src/app/browser/main/tab.cpp +++ b/src/app/browser/main/tab.cpp @@ -51,13 +51,11 @@ void Tab::refresh( void Tab::append( const Glib::ustring & TITLE, const Glib::ustring & SUBTITLE, - const Glib::ustring & REQUEST, const bool & FOCUS ) { auto tabPage = new tab::Page( TITLE, SUBTITLE, - REQUEST, action__tab_page_navigation_history_back, action__tab_page_navigation_history_forward, action__tab_page_navigation_update diff --git a/src/app/browser/main/tab.hpp b/src/app/browser/main/tab.hpp index fc119851..920e9e28 100644 --- a/src/app/browser/main/tab.hpp +++ b/src/app/browser/main/tab.hpp @@ -55,7 +55,6 @@ namespace app::browser::main void append( const Glib::ustring & TITLE, const Glib::ustring & SUBTITLE, - const Glib::ustring & REQUEST, const bool & FOCUS ); diff --git a/src/app/browser/main/tab/page.cpp b/src/app/browser/main/tab/page.cpp index 1690eb39..cead3933 100644 --- a/src/app/browser/main/tab/page.cpp +++ b/src/app/browser/main/tab/page.cpp @@ -7,7 +7,6 @@ using namespace app::browser::main::tab; Page::Page( const Glib::ustring & TITLE, const Glib::ustring & SUBTITLE, - const Glib::ustring & REQUEST, const Glib::RefPtr & ACTION__PAGE_NAVIGATION_HISTORY_BACK, const Glib::RefPtr & ACTION__PAGE_NAVIGATION_HISTORY_FORWARD, const Glib::RefPtr & ACTION__PAGE_NAVIGATION_UPDATE @@ -19,7 +18,6 @@ Page::Page( // Init components pageNavigation = Gtk::make_managed( - REQUEST, ACTION__PAGE_NAVIGATION_HISTORY_BACK, ACTION__PAGE_NAVIGATION_HISTORY_FORWARD, ACTION__PAGE_NAVIGATION_UPDATE diff --git a/src/app/browser/main/tab/page.hpp b/src/app/browser/main/tab/page.hpp index a95b5121..af1114ba 100644 --- a/src/app/browser/main/tab/page.hpp +++ b/src/app/browser/main/tab/page.hpp @@ -44,7 +44,6 @@ namespace app::browser::main::tab Page( const Glib::ustring & TITLE, const Glib::ustring & SUBTITLE, - const Glib::ustring & REQUEST, const Glib::RefPtr & ACTION__PAGE_NAVIGATION_HISTORY_BACK, const Glib::RefPtr & ACTION__PAGE_NAVIGATION_HISTORY_FORWARD, const Glib::RefPtr & ACTION__PAGE_NAVIGATION_UPDATE diff --git a/src/app/browser/main/tab/page/navigation.cpp b/src/app/browser/main/tab/page/navigation.cpp index f3c10839..9d4e7929 100644 --- a/src/app/browser/main/tab/page/navigation.cpp +++ b/src/app/browser/main/tab/page/navigation.cpp @@ -8,7 +8,6 @@ using namespace app::browser::main::tab::page; Navigation::Navigation( - const Glib::ustring & REQUEST, const Glib::RefPtr & ACTION__NAVIGATION_HISTORY_BACK, const Glib::RefPtr & ACTION__NAVIGATION_HISTORY_FORWARD, const Glib::RefPtr & ACTION__NAVIGATION_UPDATE @@ -63,7 +62,7 @@ Navigation::Navigation( ); navigationRequest = Gtk::make_managed( - REQUEST + ACTION__NAVIGATION_UPDATE ); append( diff --git a/src/app/browser/main/tab/page/navigation.hpp b/src/app/browser/main/tab/page/navigation.hpp index af5d31e7..12239ffb 100644 --- a/src/app/browser/main/tab/page/navigation.hpp +++ b/src/app/browser/main/tab/page/navigation.hpp @@ -35,7 +35,6 @@ namespace app::browser::main::tab::page public: Navigation( - const Glib::ustring & REQUEST, const Glib::RefPtr & ACTION__NAVIGATION_HISTORY_BACK, const Glib::RefPtr & ACTION__NAVIGATION_HISTORY_FORWARD, const Glib::RefPtr & ACTION__NAVIGATION_UPDATE diff --git a/src/app/browser/main/tab/page/navigation/request.cpp b/src/app/browser/main/tab/page/navigation/request.cpp index bc8b9817..949331b3 100644 --- a/src/app/browser/main/tab/page/navigation/request.cpp +++ b/src/app/browser/main/tab/page/navigation/request.cpp @@ -4,9 +4,12 @@ using namespace app::browser::main::tab::page::navigation; // Construct Request::Request( - const Glib::ustring & TEXT + const Glib::RefPtr & ACTION__UPDATE ) { - // Init entry + // Init actions + action__update = ACTION__UPDATE; + + // Init widget set_placeholder_text( _("URL or search term...") ); @@ -19,15 +22,6 @@ Request::Request( PROGRESS_PULSE_STEP ); - if (!TEXT.empty()) - { - set_text( - TEXT - ); - - parse(); - } - // Connect events signal_changed().connect( [this] @@ -35,7 +29,7 @@ Request::Request( parse(); activate_action( - "navigation.refresh" + "navigation.refresh" // @TODO ); } ); @@ -45,9 +39,7 @@ Request::Request( { parse(); - activate_action( - "win.main_tab_page_navigation_update" - ); + action__update->activate(); } ); } diff --git a/src/app/browser/main/tab/page/navigation/request.hpp b/src/app/browser/main/tab/page/navigation/request.hpp index a0846341..c6aad43a 100644 --- a/src/app/browser/main/tab/page/navigation/request.hpp +++ b/src/app/browser/main/tab/page/navigation/request.hpp @@ -1,8 +1,10 @@ #ifndef APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_REQUEST_HPP #define APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_REQUEST_HPP +#include #include #include +#include #include #include #include @@ -11,6 +13,9 @@ namespace app::browser::main::tab::page::navigation { class Request : public Gtk::Entry { + // Actions + Glib::RefPtr action__update; + // Extras double progress_fraction; @@ -31,7 +36,7 @@ namespace app::browser::main::tab::page::navigation public: Request( - const Glib::ustring & VALUE = "" // @TODO remove default value + const Glib::RefPtr & ACTION__UPDATE ); // Actions