Browse Source

update widget construction, implement refresh method

CPP-GTK4
yggverse 3 months ago
parent
commit
1a548977a2
  1. 25
      src/app/browser/main/tab/page/navigation/history/back.cpp
  2. 2
      src/app/browser/main/tab/page/navigation/history/back.hpp
  3. 25
      src/app/browser/main/tab/page/navigation/history/forward.cpp
  4. 2
      src/app/browser/main/tab/page/navigation/history/forward.hpp

25
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( Back::Back(
const Glib::RefPtr<Gio::SimpleAction> & ACTION__BACK const Glib::RefPtr<Gio::SimpleAction> & ACTION__BACK
) { ) {
set_action_name( // Init actions
"win.main_tab_page_navigation_history_back" // @TODO action__back = ACTION__BACK;
);
// Init widget
set_icon_name( set_icon_name(
"go-previous-symbolic" "go-previous-symbolic"
); );
@ -16,10 +16,27 @@ Back::Back(
set_tooltip_text( set_tooltip_text(
_("Back") _("Back")
); );
set_sensitive(
false
);
signal_clicked().connect(
[this]
{
action__back->activate();
}
);
} }
void Back::refresh( void Back::refresh(
const bool & ENABLED const bool & ENABLED
) { ) {
// @TODO update action status set_sensitive(
ENABLED
);
action__back->set_enabled(
ENABLED
);
} }

2
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 class Back : public Gtk::Button
{ {
Glib::RefPtr<Gio::SimpleAction> action__back;
public: public:
Back( Back(

25
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( Forward::Forward(
const Glib::RefPtr<Gio::SimpleAction> & ACTION__FORWARD const Glib::RefPtr<Gio::SimpleAction> & ACTION__FORWARD
) { ) {
set_action_name( // Init actions
"win.main_tab_page_navigation_history_forward" // @TODO action__forward = ACTION__FORWARD;
);
// Init widget
set_icon_name( set_icon_name(
"go-next-symbolic" "go-next-symbolic"
); );
@ -16,10 +16,27 @@ Forward::Forward(
set_tooltip_text( set_tooltip_text(
_("Forward") _("Forward")
); );
set_sensitive(
false
);
signal_clicked().connect(
[this]
{
action__forward->activate();
}
);
} }
void Forward::refresh( void Forward::refresh(
const bool & ENABLED const bool & ENABLED
) { ) {
// @TODO update action status set_sensitive(
ENABLED
);
action__forward->set_enabled(
ENABLED
);
} }

2
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 class Forward : public Gtk::Button
{ {
Glib::RefPtr<Gio::SimpleAction> action__forward;
public: public:
Forward( Forward(

Loading…
Cancel
Save