Browse Source

add update action support, remove request value from construction

CPP-GTK4
yggverse 3 months ago
parent
commit
55f1680f8b
  1. 1
      src/app/browser/main.cpp
  2. 2
      src/app/browser/main/tab.cpp
  3. 1
      src/app/browser/main/tab.hpp
  4. 2
      src/app/browser/main/tab/page.cpp
  5. 1
      src/app/browser/main/tab/page.hpp
  6. 3
      src/app/browser/main/tab/page/navigation.cpp
  7. 1
      src/app/browser/main/tab/page/navigation.hpp
  8. 22
      src/app/browser/main/tab/page/navigation/request.cpp
  9. 7
      src/app/browser/main/tab/page/navigation/request.hpp

1
src/app/browser/main.cpp

@ -46,7 +46,6 @@ void Main::tab_append()
mainTab->append( mainTab->append(
_("New page"), _("New page"),
"", // @TODO "", // @TODO
"",
true true
); );
}; };

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

@ -51,13 +51,11 @@ void Tab::refresh(
void Tab::append( void Tab::append(
const Glib::ustring & TITLE, const Glib::ustring & TITLE,
const Glib::ustring & SUBTITLE, const Glib::ustring & SUBTITLE,
const Glib::ustring & REQUEST,
const bool & FOCUS const bool & FOCUS
) { ) {
auto tabPage = new tab::Page( auto tabPage = new tab::Page(
TITLE, TITLE,
SUBTITLE, SUBTITLE,
REQUEST,
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

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

@ -55,7 +55,6 @@ namespace app::browser::main
void append( void append(
const Glib::ustring & TITLE, const Glib::ustring & TITLE,
const Glib::ustring & SUBTITLE, const Glib::ustring & SUBTITLE,
const Glib::ustring & REQUEST,
const bool & FOCUS const bool & FOCUS
); );

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

@ -7,7 +7,6 @@ using namespace app::browser::main::tab;
Page::Page( Page::Page(
const Glib::ustring & TITLE, const Glib::ustring & TITLE,
const Glib::ustring & SUBTITLE, const Glib::ustring & SUBTITLE,
const Glib::ustring & REQUEST,
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,7 +18,6 @@ Page::Page(
// Init components // Init components
pageNavigation = Gtk::make_managed<page::Navigation>( pageNavigation = Gtk::make_managed<page::Navigation>(
REQUEST,
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

@ -44,7 +44,6 @@ namespace app::browser::main::tab
Page( Page(
const Glib::ustring & TITLE, const Glib::ustring & TITLE,
const Glib::ustring & SUBTITLE, const Glib::ustring & SUBTITLE,
const Glib::ustring & REQUEST,
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

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

@ -8,7 +8,6 @@
using namespace app::browser::main::tab::page; using namespace app::browser::main::tab::page;
Navigation::Navigation( Navigation::Navigation(
const Glib::ustring & REQUEST,
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
@ -63,7 +62,7 @@ Navigation::Navigation(
); );
navigationRequest = Gtk::make_managed<navigation::Request>( navigationRequest = Gtk::make_managed<navigation::Request>(
REQUEST ACTION__NAVIGATION_UPDATE
); );
append( append(

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

@ -35,7 +35,6 @@ namespace app::browser::main::tab::page
public: public:
Navigation( Navigation(
const Glib::ustring & REQUEST,
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

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

@ -4,9 +4,12 @@ using namespace app::browser::main::tab::page::navigation;
// Construct // Construct
Request::Request( Request::Request(
const Glib::ustring & TEXT const Glib::RefPtr<Gio::SimpleAction> & ACTION__UPDATE
) { ) {
// Init entry // Init actions
action__update = ACTION__UPDATE;
// Init widget
set_placeholder_text( set_placeholder_text(
_("URL or search term...") _("URL or search term...")
); );
@ -19,15 +22,6 @@ Request::Request(
PROGRESS_PULSE_STEP PROGRESS_PULSE_STEP
); );
if (!TEXT.empty())
{
set_text(
TEXT
);
parse();
}
// Connect events // Connect events
signal_changed().connect( signal_changed().connect(
[this] [this]
@ -35,7 +29,7 @@ Request::Request(
parse(); parse();
activate_action( activate_action(
"navigation.refresh" "navigation.refresh" // @TODO
); );
} }
); );
@ -45,9 +39,7 @@ Request::Request(
{ {
parse(); parse();
activate_action( action__update->activate();
"win.main_tab_page_navigation_update"
);
} }
); );
} }

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

@ -1,8 +1,10 @@
#ifndef APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_REQUEST_HPP #ifndef APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_REQUEST_HPP
#define APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_REQUEST_HPP #define APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_REQUEST_HPP
#include <giomm/simpleaction.h>
#include <glibmm/i18n.h> #include <glibmm/i18n.h>
#include <glibmm/main.h> #include <glibmm/main.h>
#include <glibmm/refptr.h>
#include <glibmm/regex.h> #include <glibmm/regex.h>
#include <glibmm/ustring.h> #include <glibmm/ustring.h>
#include <gtkmm/entry.h> #include <gtkmm/entry.h>
@ -11,6 +13,9 @@ namespace app::browser::main::tab::page::navigation
{ {
class Request : public Gtk::Entry class Request : public Gtk::Entry
{ {
// Actions
Glib::RefPtr<Gio::SimpleAction> action__update;
// Extras // Extras
double progress_fraction; double progress_fraction;
@ -31,7 +36,7 @@ namespace app::browser::main::tab::page::navigation
public: public:
Request( Request(
const Glib::ustring & VALUE = "" // @TODO remove default value const Glib::RefPtr<Gio::SimpleAction> & ACTION__UPDATE
); );
// Actions // Actions

Loading…
Cancel
Save