From 1a548977a2f9e17b1b3aab9c65a3bfd31638bee9 Mon Sep 17 00:00:00 2001 From: yggverse Date: Sun, 8 Sep 2024 04:08:18 +0300 Subject: [PATCH] update widget construction, implement refresh method --- .../main/tab/page/navigation/history/back.cpp | 25 ++++++++++++++++--- .../main/tab/page/navigation/history/back.hpp | 2 ++ .../tab/page/navigation/history/forward.cpp | 25 ++++++++++++++++--- .../tab/page/navigation/history/forward.hpp | 2 ++ 4 files changed, 46 insertions(+), 8 deletions(-) diff --git a/src/app/browser/main/tab/page/navigation/history/back.cpp b/src/app/browser/main/tab/page/navigation/history/back.cpp index 640f46da..adaf49da 100644 --- a/src/app/browser/main/tab/page/navigation/history/back.cpp +++ b/src/app/browser/main/tab/page/navigation/history/back.cpp @@ -5,10 +5,10 @@ using namespace app::browser::main::tab::page::navigation::history; Back::Back( const Glib::RefPtr & ACTION__BACK ) { - set_action_name( - "win.main_tab_page_navigation_history_back" // @TODO - ); + // Init actions + action__back = ACTION__BACK; + // Init widget set_icon_name( "go-previous-symbolic" ); @@ -16,10 +16,27 @@ Back::Back( set_tooltip_text( _("Back") ); + + set_sensitive( + false + ); + + signal_clicked().connect( + [this] + { + action__back->activate(); + } + ); } void Back::refresh( const bool & ENABLED ) { - // @TODO update action status + set_sensitive( + ENABLED + ); + + action__back->set_enabled( + ENABLED + ); } \ No newline at end of file diff --git a/src/app/browser/main/tab/page/navigation/history/back.hpp b/src/app/browser/main/tab/page/navigation/history/back.hpp index ba8a0023..37b903ca 100644 --- a/src/app/browser/main/tab/page/navigation/history/back.hpp +++ b/src/app/browser/main/tab/page/navigation/history/back.hpp @@ -10,6 +10,8 @@ namespace app::browser::main::tab::page::navigation::history { class Back : public Gtk::Button { + Glib::RefPtr action__back; + public: Back( diff --git a/src/app/browser/main/tab/page/navigation/history/forward.cpp b/src/app/browser/main/tab/page/navigation/history/forward.cpp index 15ace1d8..8dc5bd04 100644 --- a/src/app/browser/main/tab/page/navigation/history/forward.cpp +++ b/src/app/browser/main/tab/page/navigation/history/forward.cpp @@ -5,10 +5,10 @@ using namespace app::browser::main::tab::page::navigation::history; Forward::Forward( const Glib::RefPtr & ACTION__FORWARD ) { - set_action_name( - "win.main_tab_page_navigation_history_forward" // @TODO - ); + // Init actions + action__forward = ACTION__FORWARD; + // Init widget set_icon_name( "go-next-symbolic" ); @@ -16,10 +16,27 @@ Forward::Forward( set_tooltip_text( _("Forward") ); + + set_sensitive( + false + ); + + signal_clicked().connect( + [this] + { + action__forward->activate(); + } + ); } void Forward::refresh( const bool & ENABLED ) { - // @TODO update action status + set_sensitive( + ENABLED + ); + + action__forward->set_enabled( + ENABLED + ); } \ No newline at end of file diff --git a/src/app/browser/main/tab/page/navigation/history/forward.hpp b/src/app/browser/main/tab/page/navigation/history/forward.hpp index 8defdb4e..60e260c7 100644 --- a/src/app/browser/main/tab/page/navigation/history/forward.hpp +++ b/src/app/browser/main/tab/page/navigation/history/forward.hpp @@ -10,6 +10,8 @@ namespace app::browser::main::tab::page::navigation::history { class Forward : public Gtk::Button { + Glib::RefPtr action__forward; + public: Forward(