Browse Source

update page constructor api

CPP-GTK4
yggverse 3 months ago
parent
commit
f1515f8e99
  1. 1
      src/app/browser/main.cpp
  2. 6
      src/app/browser/main/tab.cpp
  3. 1
      src/app/browser/main/tab.hpp
  4. 12
      src/app/browser/main/tab/label.cpp
  5. 14
      src/app/browser/main/tab/page.cpp
  6. 11
      src/app/browser/main/tab/page.hpp

1
src/app/browser/main.cpp

@ -110,7 +110,6 @@ void Main::save( @@ -110,7 +110,6 @@ void Main::save(
void Main::tab_append()
{
mainTab->append(
_("New tab"),
true
);
};

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

@ -67,7 +67,6 @@ int Tab::restore( @@ -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( @@ -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,

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

@ -95,7 +95,6 @@ namespace app::browser::main @@ -95,7 +95,6 @@ namespace app::browser::main
// Actions
int append(
const Glib::ustring & LABEL_TEXT,
const bool & IS_CURRENT
);

12
src/app/browser/main/tab/label.cpp

@ -15,14 +15,14 @@ Label::Label( @@ -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( @@ -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

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

@ -6,28 +6,24 @@ using namespace app::browser::main::tab; @@ -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<Gio::SimpleAction> & ACTION__UPDATE,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__TAB_PAGE_NAVIGATION_HISTORY_BACK,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__TAB_PAGE_NAVIGATION_HISTORY_FORWARD,
const Glib::RefPtr<Gio::SimpleAction> & 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

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

@ -83,14 +83,14 @@ namespace app::browser::main::tab @@ -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<Gio::SimpleAction> action__update;
@ -114,9 +114,6 @@ namespace app::browser::main::tab @@ -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<Gio::SimpleAction> & ACTION__UPDATE,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__TAB_PAGE_NAVIGATION_HISTORY_BACK,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__TAB_PAGE_NAVIGATION_HISTORY_FORWARD,

Loading…
Cancel
Save