Browse Source

update page refresh action

CPP-GTK4
yggverse 3 months ago
parent
commit
33ae9796d8
  1. 7
      src/app/browser/main/tab.cpp
  2. 2
      src/app/browser/main/tab/page.cpp
  3. 1
      src/app/browser/main/tab/page.hpp
  4. 19
      src/app/browser/main/tab/page/navigation.cpp
  5. 2
      src/app/browser/main/tab/page/navigation.hpp
  6. 6
      src/app/browser/main/tab/page/navigation/request.cpp
  7. 4
      src/app/browser/main/tab/page/navigation/request.hpp

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

@ -46,12 +46,19 @@ void Tab::refresh( @@ -46,12 +46,19 @@ void Tab::refresh(
)->set_label(
tabPage->get_title()
);
tabPage->refresh(
tabPage->get_title(),
tabPage->get_subtitle(),
0 // @TODO
);
}
void Tab::append(
const bool & FOCUS
) {
auto tabPage = new tab::Page(
action__refresh,
action__tab_page_navigation_history_back,
action__tab_page_navigation_history_forward,
action__tab_page_navigation_update

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

@ -5,12 +5,14 @@ @@ -5,12 +5,14 @@
using namespace app::browser::main::tab;
Page::Page(
const Glib::RefPtr<Gio::SimpleAction> & ACTION__REFRESH,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__PAGE_NAVIGATION_HISTORY_BACK,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__PAGE_NAVIGATION_HISTORY_FORWARD,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__PAGE_NAVIGATION_UPDATE
) {
// Init components
pageNavigation = Gtk::make_managed<page::Navigation>(
ACTION__REFRESH,
ACTION__PAGE_NAVIGATION_HISTORY_BACK,
ACTION__PAGE_NAVIGATION_HISTORY_FORWARD,
ACTION__PAGE_NAVIGATION_UPDATE

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

@ -42,6 +42,7 @@ namespace app::browser::main::tab @@ -42,6 +42,7 @@ namespace app::browser::main::tab
public:
Page(
const Glib::RefPtr<Gio::SimpleAction> & ACTION__REFRESH,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__PAGE_NAVIGATION_HISTORY_BACK,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__PAGE_NAVIGATION_HISTORY_FORWARD,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__PAGE_NAVIGATION_UPDATE

19
src/app/browser/main/tab/page/navigation.cpp

@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
using namespace app::browser::main::tab::page;
Navigation::Navigation(
const Glib::RefPtr<Gio::SimpleAction> & ACTION__REFRESH,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__NAVIGATION_HISTORY_BACK,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__NAVIGATION_HISTORY_FORWARD,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__NAVIGATION_UPDATE
@ -62,6 +63,7 @@ Navigation::Navigation( @@ -62,6 +63,7 @@ Navigation::Navigation(
);
navigationRequest = Gtk::make_managed<navigation::Request>(
ACTION__REFRESH,
ACTION__NAVIGATION_UPDATE
);
@ -74,23 +76,6 @@ Navigation::Navigation( @@ -74,23 +76,6 @@ Navigation::Navigation(
append(
* navigationBookmark
);
// Init actions group
auto GioSimpleActionGroup = Gio::SimpleActionGroup::create();
// Define group actions
GioSimpleActionGroup->add_action(
"refresh",
[this]
{
refresh(0);
}
);
insert_action_group(
"navigation",
GioSimpleActionGroup
);
}
// Actions

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

@ -2,7 +2,6 @@ @@ -2,7 +2,6 @@
#define APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_HPP
#include <giomm/simpleaction.h>
#include <giomm/simpleactiongroup.h>
#include <glibmm/refptr.h>
#include <glibmm/ustring.h>
#include <gtkmm/box.h>
@ -35,6 +34,7 @@ namespace app::browser::main::tab::page @@ -35,6 +34,7 @@ namespace app::browser::main::tab::page
public:
Navigation(
const Glib::RefPtr<Gio::SimpleAction> & ACTION__REFRESH,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__NAVIGATION_HISTORY_BACK,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__NAVIGATION_HISTORY_FORWARD,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__NAVIGATION_UPDATE

6
src/app/browser/main/tab/page/navigation/request.cpp

@ -4,9 +4,11 @@ using namespace app::browser::main::tab::page::navigation; @@ -4,9 +4,11 @@ using namespace app::browser::main::tab::page::navigation;
// Construct
Request::Request(
const Glib::RefPtr<Gio::SimpleAction> & ACTION__REFRESH,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__UPDATE
) {
// Init actions
action__refresh = ACTION__REFRESH;
action__update = ACTION__UPDATE;
// Init widget
@ -28,9 +30,7 @@ Request::Request( @@ -28,9 +30,7 @@ Request::Request(
{
parse();
activate_action(
"navigation.refresh" // @TODO
);
action__refresh->activate();
}
);

4
src/app/browser/main/tab/page/navigation/request.hpp

@ -14,7 +14,8 @@ namespace app::browser::main::tab::page::navigation @@ -14,7 +14,8 @@ namespace app::browser::main::tab::page::navigation
class Request : public Gtk::Entry
{
// Actions
Glib::RefPtr<Gio::SimpleAction> action__update;
Glib::RefPtr<Gio::SimpleAction> action__refresh,
action__update;
// Extras
double progress_fraction;
@ -36,6 +37,7 @@ namespace app::browser::main::tab::page::navigation @@ -36,6 +37,7 @@ namespace app::browser::main::tab::page::navigation
public:
Request(
const Glib::RefPtr<Gio::SimpleAction> & ACTION__REFRESH,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__UPDATE
);

Loading…
Cancel
Save