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

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

@ -51,13 +51,11 @@ void Tab::refresh( @@ -51,13 +51,11 @@ void Tab::refresh(
void Tab::append(
const Glib::ustring & TITLE,
const Glib::ustring & SUBTITLE,
const Glib::ustring & REQUEST,
const bool & FOCUS
) {
auto tabPage = new tab::Page(
TITLE,
SUBTITLE,
REQUEST,
action__tab_page_navigation_history_back,
action__tab_page_navigation_history_forward,
action__tab_page_navigation_update

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

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

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

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

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

@ -44,7 +44,6 @@ namespace app::browser::main::tab @@ -44,7 +44,6 @@ namespace app::browser::main::tab
Page(
const Glib::ustring & TITLE,
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_FORWARD,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__PAGE_NAVIGATION_UPDATE

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

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

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

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

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

@ -4,9 +4,12 @@ using namespace app::browser::main::tab::page::navigation; @@ -4,9 +4,12 @@ using namespace app::browser::main::tab::page::navigation;
// Construct
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(
_("URL or search term...")
);
@ -19,15 +22,6 @@ Request::Request( @@ -19,15 +22,6 @@ Request::Request(
PROGRESS_PULSE_STEP
);
if (!TEXT.empty())
{
set_text(
TEXT
);
parse();
}
// Connect events
signal_changed().connect(
[this]
@ -35,7 +29,7 @@ Request::Request( @@ -35,7 +29,7 @@ Request::Request(
parse();
activate_action(
"navigation.refresh"
"navigation.refresh" // @TODO
);
}
);
@ -45,9 +39,7 @@ Request::Request( @@ -45,9 +39,7 @@ Request::Request(
{
parse();
activate_action(
"win.main_tab_page_navigation_update"
);
action__update->activate();
}
);
}

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

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

Loading…
Cancel
Save