draft back/forward actions

This commit is contained in:
yggverse 2024-09-01 15:21:12 +03:00
parent b3c00d29be
commit 75aaa6e717
11 changed files with 69 additions and 31 deletions

View File

@ -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()
);
};

View File

@ -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(

View File

@ -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
);

View File

@ -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()
);

View File

@ -62,7 +62,8 @@ namespace app::browser::main::tab
Glib::ustring get_subtitle();
// Actions
void refresh();
void back();
void forward();
void update();
};
}

View File

@ -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(

View File

@ -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
);

View File

@ -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
);
}

View File

@ -38,6 +38,9 @@ namespace app::browser::main::tab::page::navbar
~History();
void back();
void forward();
void push(
const Glib::ustring & REQUEST
);

View File

@ -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;

View File

@ -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;