diff --git a/src/app/browser/main.cpp b/src/app/browser/main.cpp index 1f7ecad6..17fcf42b 100644 --- a/src/app/browser/main.cpp +++ b/src/app/browser/main.cpp @@ -81,14 +81,14 @@ void Main::tab_close_all() void Main::tab_history_back() { - mainTab->history_back( + mainTab->back( mainTab->get_current_page() ); }; void Main::tab_history_forward() { - mainTab->history_forward( + mainTab->forward( mainTab->get_current_page() ); }; diff --git a/src/app/browser/main/tab.cpp b/src/app/browser/main/tab.cpp index f8d35c28..50f4ef3a 100644 --- a/src/app/browser/main/tab.cpp +++ b/src/app/browser/main/tab.cpp @@ -98,30 +98,20 @@ void Tab::close_all() } } -void Tab::history_back( +void Tab::back( const int & PAGE_NUMBER ) { - auto tabPage = get_tabPage( + get_tabPage( PAGE_NUMBER - ); - - // @TODO tabPage->back() - - // Refresh children widgets - tabPage->refresh(); + )->back(); } -void Tab::history_forward( +void Tab::forward( const int & PAGE_NUMBER ) { - auto tabPage = get_tabPage( + get_tabPage( PAGE_NUMBER - ); - - // @TODO tabPage->forward() - - // Refresh children widgets - tabPage->refresh(); + )->forward(); } void Tab::refresh( @@ -134,9 +124,6 @@ void Tab::refresh( get_tabLabel(PAGE_NUMBER)->set_label( tabPage->get_title() ); - - // Refresh children widgets - tabPage->refresh(); } void Tab::update( diff --git a/src/app/browser/main/tab.hpp b/src/app/browser/main/tab.hpp index 552245b8..87272be5 100644 --- a/src/app/browser/main/tab.hpp +++ b/src/app/browser/main/tab.hpp @@ -54,11 +54,11 @@ namespace app::browser::main void close_right(); void close_all(); - void history_back( + void back( const int & PAGE_NUMBER ); - void history_forward( + void forward( const int & PAGE_NUMBER ); diff --git a/src/app/browser/main/tab/page.cpp b/src/app/browser/main/tab/page.cpp index bf18b472..09c7901d 100644 --- a/src/app/browser/main/tab/page.cpp +++ b/src/app/browser/main/tab/page.cpp @@ -80,15 +80,20 @@ Glib::ustring Page::get_subtitle() } // Actions -void Page::refresh() +void Page::back() { - pageNavbar->refresh(); + pageNavbar->back(); +} + +void Page::forward() +{ + pageNavbar->forward(); } void Page::update() { // Update navigation history - pageNavbar->history_push( + pageNavbar->push( pageNavbar->get_request_text() ); diff --git a/src/app/browser/main/tab/page.hpp b/src/app/browser/main/tab/page.hpp index 704ab5e9..58ab837f 100644 --- a/src/app/browser/main/tab/page.hpp +++ b/src/app/browser/main/tab/page.hpp @@ -62,7 +62,8 @@ namespace app::browser::main::tab Glib::ustring get_subtitle(); // Actions - void refresh(); + void back(); + void forward(); void update(); }; } diff --git a/src/app/browser/main/tab/page/navbar.cpp b/src/app/browser/main/tab/page/navbar.cpp index f3f8a5cc..e3385645 100644 --- a/src/app/browser/main/tab/page/navbar.cpp +++ b/src/app/browser/main/tab/page/navbar.cpp @@ -96,7 +96,17 @@ Navbar::~Navbar() }; // Actions -void Navbar::history_push( +void Navbar::back() +{ + navbarHistory->back(); +} + +void Navbar::forward() +{ + navbarHistory->forward(); +} + +void Navbar::push( const Glib::ustring & VALUE ) { navbarHistory->push( diff --git a/src/app/browser/main/tab/page/navbar.hpp b/src/app/browser/main/tab/page/navbar.hpp index 5af83a1e..6f09e955 100644 --- a/src/app/browser/main/tab/page/navbar.hpp +++ b/src/app/browser/main/tab/page/navbar.hpp @@ -38,7 +38,11 @@ namespace app::browser::main::tab::page ~Navbar(); // Actions - void history_push( + void back(); + + void forward(); + + void push( const Glib::ustring & VALUE ); diff --git a/src/app/browser/main/tab/page/navbar/history.cpp b/src/app/browser/main/tab/page/navbar/history.cpp index a6db4abd..da5505b9 100644 --- a/src/app/browser/main/tab/page/navbar/history.cpp +++ b/src/app/browser/main/tab/page/navbar/history.cpp @@ -30,6 +30,16 @@ History::~History() }; // Actions +void History::back() +{ + historyBack->activate(); +} + +void History::forward() +{ + historyForward->activate(); +} + void History::push( const Glib::ustring & REQUEST ) { @@ -50,10 +60,10 @@ void History::push( void History::refresh() { historyBack->set_sensitive( - false // @TODO + false // @TODO memory.size() > 0 ); historyForward->set_sensitive( - false // @TODO + false // @TODO memory.size() > 0 ); } \ No newline at end of file diff --git a/src/app/browser/main/tab/page/navbar/history.hpp b/src/app/browser/main/tab/page/navbar/history.hpp index ded9791f..93fd707e 100644 --- a/src/app/browser/main/tab/page/navbar/history.hpp +++ b/src/app/browser/main/tab/page/navbar/history.hpp @@ -38,6 +38,9 @@ namespace app::browser::main::tab::page::navbar ~History(); + void back(); + void forward(); + void push( const Glib::ustring & REQUEST ); diff --git a/src/app/browser/main/tab/page/navbar/history/back.cpp b/src/app/browser/main/tab/page/navbar/history/back.cpp index 87dea563..b2b2923d 100644 --- a/src/app/browser/main/tab/page/navbar/history/back.cpp +++ b/src/app/browser/main/tab/page/navbar/history/back.cpp @@ -19,6 +19,15 @@ Back::Back() set_sensitive( false // @TODO no effect by set_action_name ); + + signal_clicked().connect( + [this] + { + activate_action( + "win.tab_history_back" + ); + } + ); } Back::~Back() = default; diff --git a/src/app/browser/main/tab/page/navbar/history/forward.cpp b/src/app/browser/main/tab/page/navbar/history/forward.cpp index 93f8fb63..9cb930df 100644 --- a/src/app/browser/main/tab/page/navbar/history/forward.cpp +++ b/src/app/browser/main/tab/page/navbar/history/forward.cpp @@ -19,6 +19,15 @@ Forward::Forward() set_sensitive( false // @TODO no effect by set_action_name ); + + signal_clicked().connect( + [this] + { + activate_action( + "win.tab_history_forward" + ); + } + ); } Forward::~Forward() = default;