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(
)->set_label( )->set_label(
tabPage->get_title() tabPage->get_title()
); );
tabPage->refresh(
tabPage->get_title(),
tabPage->get_subtitle(),
0 // @TODO
);
} }
void Tab::append( void Tab::append(
const bool & FOCUS const bool & FOCUS
) { ) {
auto tabPage = new tab::Page( auto tabPage = new tab::Page(
action__refresh,
action__tab_page_navigation_history_back, action__tab_page_navigation_history_back,
action__tab_page_navigation_history_forward, action__tab_page_navigation_history_forward,
action__tab_page_navigation_update action__tab_page_navigation_update

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

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

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

@ -42,6 +42,7 @@ namespace app::browser::main::tab
public: public:
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_BACK,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__PAGE_NAVIGATION_HISTORY_FORWARD, const Glib::RefPtr<Gio::SimpleAction> & ACTION__PAGE_NAVIGATION_HISTORY_FORWARD,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__PAGE_NAVIGATION_UPDATE const Glib::RefPtr<Gio::SimpleAction> & ACTION__PAGE_NAVIGATION_UPDATE

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

@ -8,6 +8,7 @@
using namespace app::browser::main::tab::page; using namespace app::browser::main::tab::page;
Navigation::Navigation( 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_BACK,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__NAVIGATION_HISTORY_FORWARD, const Glib::RefPtr<Gio::SimpleAction> & ACTION__NAVIGATION_HISTORY_FORWARD,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__NAVIGATION_UPDATE const Glib::RefPtr<Gio::SimpleAction> & ACTION__NAVIGATION_UPDATE
@ -62,6 +63,7 @@ Navigation::Navigation(
); );
navigationRequest = Gtk::make_managed<navigation::Request>( navigationRequest = Gtk::make_managed<navigation::Request>(
ACTION__REFRESH,
ACTION__NAVIGATION_UPDATE ACTION__NAVIGATION_UPDATE
); );
@ -74,23 +76,6 @@ Navigation::Navigation(
append( append(
* navigationBookmark * 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 // Actions

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

@ -2,7 +2,6 @@
#define APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_HPP #define APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_HPP
#include <giomm/simpleaction.h> #include <giomm/simpleaction.h>
#include <giomm/simpleactiongroup.h>
#include <glibmm/refptr.h> #include <glibmm/refptr.h>
#include <glibmm/ustring.h> #include <glibmm/ustring.h>
#include <gtkmm/box.h> #include <gtkmm/box.h>
@ -35,6 +34,7 @@ namespace app::browser::main::tab::page
public: public:
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_BACK,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__NAVIGATION_HISTORY_FORWARD, const Glib::RefPtr<Gio::SimpleAction> & ACTION__NAVIGATION_HISTORY_FORWARD,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__NAVIGATION_UPDATE 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;
// Construct // Construct
Request::Request( Request::Request(
const Glib::RefPtr<Gio::SimpleAction> & ACTION__REFRESH,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__UPDATE const Glib::RefPtr<Gio::SimpleAction> & ACTION__UPDATE
) { ) {
// Init actions // Init actions
action__refresh = ACTION__REFRESH;
action__update = ACTION__UPDATE; action__update = ACTION__UPDATE;
// Init widget // Init widget
@ -28,9 +30,7 @@ Request::Request(
{ {
parse(); parse();
activate_action( action__refresh->activate();
"navigation.refresh" // @TODO
);
} }
); );

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

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

Loading…
Cancel
Save