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; @@ -5,10 +5,10 @@ using namespace app::browser::main::tab::page::navigation::history;
Back::Back(
const Glib::RefPtr<Gio::SimpleAction> & 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( @@ -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
);
}

2
src/app/browser/main/tab/page/navigation/history/back.hpp

@ -10,6 +10,8 @@ namespace app::browser::main::tab::page::navigation::history @@ -10,6 +10,8 @@ namespace app::browser::main::tab::page::navigation::history
{
class Back : public Gtk::Button
{
Glib::RefPtr<Gio::SimpleAction> action__back;
public:
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; @@ -5,10 +5,10 @@ using namespace app::browser::main::tab::page::navigation::history;
Forward::Forward(
const Glib::RefPtr<Gio::SimpleAction> & 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( @@ -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
);
}

2
src/app/browser/main/tab/page/navigation/history/forward.hpp

@ -10,6 +10,8 @@ namespace app::browser::main::tab::page::navigation::history @@ -10,6 +10,8 @@ namespace app::browser::main::tab::page::navigation::history
{
class Forward : public Gtk::Button
{
Glib::RefPtr<Gio::SimpleAction> action__forward;
public:
Forward(

Loading…
Cancel
Save