From f1515f8e99ea7d061e01b9c3884031d8a652dfc5 Mon Sep 17 00:00:00 2001 From: yggverse Date: Sun, 15 Sep 2024 16:10:01 +0300 Subject: [PATCH] update page constructor api --- src/app/browser/main.cpp | 1 - src/app/browser/main/tab.cpp | 6 ------ src/app/browser/main/tab.hpp | 1 - src/app/browser/main/tab/label.cpp | 12 +++++++++--- src/app/browser/main/tab/page.cpp | 14 +++++--------- src/app/browser/main/tab/page.hpp | 11 ++++------- 6 files changed, 18 insertions(+), 27 deletions(-) diff --git a/src/app/browser/main.cpp b/src/app/browser/main.cpp index 58bc4ac0..be06c9c8 100644 --- a/src/app/browser/main.cpp +++ b/src/app/browser/main.cpp @@ -110,7 +110,6 @@ void Main::save( void Main::tab_append() { mainTab->append( - _("New tab"), true ); }; diff --git a/src/app/browser/main/tab.cpp b/src/app/browser/main/tab.cpp index 5dda5c12..f2c2f1a1 100644 --- a/src/app/browser/main/tab.cpp +++ b/src/app/browser/main/tab.cpp @@ -67,7 +67,6 @@ int Tab::restore( while (sqlite3_step(statement) == SQLITE_ROW) { const int PAGE_NUMBER = append( - _("Restore"), sqlite3_column_int( statement, DB::SESSION::IS_CURRENT @@ -167,15 +166,10 @@ void Tab::update( } int Tab::append( - const Glib::ustring & LABEL_TEXT, const bool & IS_CURRENT ) { const auto TAB_PAGE = new tab::Page( // @TODO manage db, - tab::Page::MIME::UNDEFINED, - LABEL_TEXT, - "", // @TODO restore feature - action__update, action__tab_page_navigation_history_back, action__tab_page_navigation_history_forward, diff --git a/src/app/browser/main/tab.hpp b/src/app/browser/main/tab.hpp index 29a7edf2..b872aad0 100644 --- a/src/app/browser/main/tab.hpp +++ b/src/app/browser/main/tab.hpp @@ -95,7 +95,6 @@ namespace app::browser::main // Actions int append( - const Glib::ustring & LABEL_TEXT, const bool & IS_CURRENT ); diff --git a/src/app/browser/main/tab/label.cpp b/src/app/browser/main/tab/label.cpp index 3e404097..b86d0342 100644 --- a/src/app/browser/main/tab/label.cpp +++ b/src/app/browser/main/tab/label.cpp @@ -15,14 +15,14 @@ Label::Label( action__tab_close = ACTION__TAB_CLOSE; // Setup label controller - auto GtkGestureClick = Gtk::GestureClick::create(); + auto const EVENT__GESTURE_CLICK = Gtk::GestureClick::create(); /* @TODO remove as default controller->set_button( GDK_BUTTON_PRIMARY );*/ - GtkGestureClick->signal_pressed().connect( + EVENT__GESTURE_CLICK->signal_pressed().connect( [this](int n, double x, double y) { if (n == 2) // double click @@ -33,8 +33,14 @@ Label::Label( ); add_controller( - GtkGestureClick + EVENT__GESTURE_CLICK ); + + // Init widget + /* not in use, overwritten by page init @TODO + set_text( + _("New page") + );*/ } // Actions diff --git a/src/app/browser/main/tab/page.cpp b/src/app/browser/main/tab/page.cpp index 32b08c13..dadf0a48 100644 --- a/src/app/browser/main/tab/page.cpp +++ b/src/app/browser/main/tab/page.cpp @@ -6,28 +6,24 @@ using namespace app::browser::main::tab; Page::Page( sqlite3 * db, - const MIME & MIME, - const Glib::ustring & TITLE, - const Glib::ustring & DESCRIPTION, const Glib::RefPtr & ACTION__UPDATE, const Glib::RefPtr & ACTION__TAB_PAGE_NAVIGATION_HISTORY_BACK, const Glib::RefPtr & ACTION__TAB_PAGE_NAVIGATION_HISTORY_FORWARD, const Glib::RefPtr & ACTION__TAB_PAGE_NAVIGATION_RELOAD ) { // Init meta - mime = MIME; - title = TITLE; - description = DESCRIPTION; + mime = MIME::UNDEFINED; + title = _("New page"); progress_fraction = 0; - // Init actions - action__update = ACTION__UPDATE; - // Init database DB::SESSION::init( this->db = db ); + // Init actions + action__update = ACTION__UPDATE; + // Init widget set_orientation( Gtk::Orientation::VERTICAL diff --git a/src/app/browser/main/tab/page.hpp b/src/app/browser/main/tab/page.hpp index 31b25199..4a6df615 100644 --- a/src/app/browser/main/tab/page.hpp +++ b/src/app/browser/main/tab/page.hpp @@ -83,14 +83,14 @@ namespace app::browser::main::tab // Meta MIME mime; - Glib::ustring title; - Glib::ustring description; - // Tools - double progress_fraction; // async load indication (progress bar) + double progress_fraction; GUri * uri; + Glib::ustring title; + Glib::ustring description; + // Actions Glib::RefPtr action__update; @@ -114,9 +114,6 @@ namespace app::browser::main::tab Page( sqlite3 * db, - const MIME & MIME, - const Glib::ustring & TITLE, - const Glib::ustring & DESCRIPTION, const Glib::RefPtr & ACTION__UPDATE, const Glib::RefPtr & ACTION__TAB_PAGE_NAVIGATION_HISTORY_BACK, const Glib::RefPtr & ACTION__TAB_PAGE_NAVIGATION_HISTORY_FORWARD,