Browse Source

draft back/forward actions

CPP-GTK4
yggverse 2 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() @@ -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()
);
};

25
src/app/browser/main/tab.cpp

@ -98,30 +98,20 @@ void Tab::close_all() @@ -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( @@ -134,9 +124,6 @@ void Tab::refresh(
get_tabLabel(PAGE_NUMBER)->set_label(
tabPage->get_title()
);
// Refresh children widgets
tabPage->refresh();
}
void Tab::update(

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

@ -54,11 +54,11 @@ namespace app::browser::main @@ -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
);

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

@ -80,15 +80,20 @@ Glib::ustring Page::get_subtitle() @@ -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()
);

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

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

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

@ -96,7 +96,17 @@ Navbar::~Navbar() @@ -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(

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

@ -38,7 +38,11 @@ namespace app::browser::main::tab::page @@ -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
);

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

@ -30,6 +30,16 @@ History::~History() @@ -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( @@ -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
);
}

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

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

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

@ -19,6 +19,15 @@ Back::Back() @@ -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;

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

@ -19,6 +19,15 @@ Forward::Forward() @@ -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;

Loading…
Cancel
Save