Browse Source

draft back/forward actions

CPP-GTK4
yggverse 3 months ago
parent
commit
75aaa6e717
  1. 4
      src/app/browser/main.cpp
  2. 25
      src/app/browser/main/tab.cpp
  3. 4
      src/app/browser/main/tab.hpp
  4. 11
      src/app/browser/main/tab/page.cpp
  5. 3
      src/app/browser/main/tab/page.hpp
  6. 12
      src/app/browser/main/tab/page/navbar.cpp
  7. 6
      src/app/browser/main/tab/page/navbar.hpp
  8. 14
      src/app/browser/main/tab/page/navbar/history.cpp
  9. 3
      src/app/browser/main/tab/page/navbar/history.hpp
  10. 9
      src/app/browser/main/tab/page/navbar/history/back.cpp
  11. 9
      src/app/browser/main/tab/page/navbar/history/forward.cpp

4
src/app/browser/main.cpp

@ -81,14 +81,14 @@ void Main::tab_close_all()
void Main::tab_history_back() void Main::tab_history_back()
{ {
mainTab->history_back( mainTab->back(
mainTab->get_current_page() mainTab->get_current_page()
); );
}; };
void Main::tab_history_forward() void Main::tab_history_forward()
{ {
mainTab->history_forward( mainTab->forward(
mainTab->get_current_page() mainTab->get_current_page()
); );
}; };

25
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 const int & PAGE_NUMBER
) { ) {
auto tabPage = get_tabPage( get_tabPage(
PAGE_NUMBER PAGE_NUMBER
); )->back();
// @TODO tabPage->back()
// Refresh children widgets
tabPage->refresh();
} }
void Tab::history_forward( void Tab::forward(
const int & PAGE_NUMBER const int & PAGE_NUMBER
) { ) {
auto tabPage = get_tabPage( get_tabPage(
PAGE_NUMBER PAGE_NUMBER
); )->forward();
// @TODO tabPage->forward()
// Refresh children widgets
tabPage->refresh();
} }
void Tab::refresh( void Tab::refresh(
@ -134,9 +124,6 @@ void Tab::refresh(
get_tabLabel(PAGE_NUMBER)->set_label( get_tabLabel(PAGE_NUMBER)->set_label(
tabPage->get_title() tabPage->get_title()
); );
// Refresh children widgets
tabPage->refresh();
} }
void Tab::update( void Tab::update(

4
src/app/browser/main/tab.hpp

@ -54,11 +54,11 @@ namespace app::browser::main
void close_right(); void close_right();
void close_all(); void close_all();
void history_back( void back(
const int & PAGE_NUMBER const int & PAGE_NUMBER
); );
void history_forward( void forward(
const int & PAGE_NUMBER const int & PAGE_NUMBER
); );

11
src/app/browser/main/tab/page.cpp

@ -80,15 +80,20 @@ Glib::ustring Page::get_subtitle()
} }
// Actions // Actions
void Page::refresh() void Page::back()
{ {
pageNavbar->refresh(); pageNavbar->back();
}
void Page::forward()
{
pageNavbar->forward();
} }
void Page::update() void Page::update()
{ {
// Update navigation history // Update navigation history
pageNavbar->history_push( pageNavbar->push(
pageNavbar->get_request_text() pageNavbar->get_request_text()
); );

3
src/app/browser/main/tab/page.hpp

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

12
src/app/browser/main/tab/page/navbar.cpp

@ -96,7 +96,17 @@ Navbar::~Navbar()
}; };
// Actions // Actions
void Navbar::history_push( void Navbar::back()
{
navbarHistory->back();
}
void Navbar::forward()
{
navbarHistory->forward();
}
void Navbar::push(
const Glib::ustring & VALUE const Glib::ustring & VALUE
) { ) {
navbarHistory->push( navbarHistory->push(

6
src/app/browser/main/tab/page/navbar.hpp

@ -38,7 +38,11 @@ namespace app::browser::main::tab::page
~Navbar(); ~Navbar();
// Actions // Actions
void history_push( void back();
void forward();
void push(
const Glib::ustring & VALUE const Glib::ustring & VALUE
); );

14
src/app/browser/main/tab/page/navbar/history.cpp

@ -30,6 +30,16 @@ History::~History()
}; };
// Actions // Actions
void History::back()
{
historyBack->activate();
}
void History::forward()
{
historyForward->activate();
}
void History::push( void History::push(
const Glib::ustring & REQUEST const Glib::ustring & REQUEST
) { ) {
@ -50,10 +60,10 @@ void History::push(
void History::refresh() void History::refresh()
{ {
historyBack->set_sensitive( historyBack->set_sensitive(
false // @TODO false // @TODO memory.size() > 0
); );
historyForward->set_sensitive( historyForward->set_sensitive(
false // @TODO false // @TODO memory.size() > 0
); );
} }

3
src/app/browser/main/tab/page/navbar/history.hpp

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

9
src/app/browser/main/tab/page/navbar/history/back.cpp

@ -19,6 +19,15 @@ Back::Back()
set_sensitive( set_sensitive(
false // @TODO no effect by set_action_name false // @TODO no effect by set_action_name
); );
signal_clicked().connect(
[this]
{
activate_action(
"win.tab_history_back"
);
}
);
} }
Back::~Back() = default; Back::~Back() = default;

9
src/app/browser/main/tab/page/navbar/history/forward.cpp

@ -19,6 +19,15 @@ Forward::Forward()
set_sensitive( set_sensitive(
false // @TODO no effect by set_action_name false // @TODO no effect by set_action_name
); );
signal_clicked().connect(
[this]
{
activate_action(
"win.tab_history_forward"
);
}
);
} }
Forward::~Forward() = default; Forward::~Forward() = default;

Loading…
Cancel
Save