mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
update page constructor api
This commit is contained in:
parent
b522e6b2a0
commit
f1515f8e99
6 changed files with 18 additions and 27 deletions
|
|
@ -110,7 +110,6 @@ void Main::save(
|
||||||
void Main::tab_append()
|
void Main::tab_append()
|
||||||
{
|
{
|
||||||
mainTab->append(
|
mainTab->append(
|
||||||
_("New tab"),
|
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,6 @@ int Tab::restore(
|
||||||
while (sqlite3_step(statement) == SQLITE_ROW)
|
while (sqlite3_step(statement) == SQLITE_ROW)
|
||||||
{
|
{
|
||||||
const int PAGE_NUMBER = append(
|
const int PAGE_NUMBER = append(
|
||||||
_("Restore"),
|
|
||||||
sqlite3_column_int(
|
sqlite3_column_int(
|
||||||
statement,
|
statement,
|
||||||
DB::SESSION::IS_CURRENT
|
DB::SESSION::IS_CURRENT
|
||||||
|
|
@ -167,15 +166,10 @@ void Tab::update(
|
||||||
}
|
}
|
||||||
|
|
||||||
int Tab::append(
|
int Tab::append(
|
||||||
const Glib::ustring & LABEL_TEXT,
|
|
||||||
const bool & IS_CURRENT
|
const bool & IS_CURRENT
|
||||||
) {
|
) {
|
||||||
const auto TAB_PAGE = new tab::Page( // @TODO manage
|
const auto TAB_PAGE = new tab::Page( // @TODO manage
|
||||||
db,
|
db,
|
||||||
tab::Page::MIME::UNDEFINED,
|
|
||||||
LABEL_TEXT,
|
|
||||||
"", // @TODO restore feature
|
|
||||||
|
|
||||||
action__update,
|
action__update,
|
||||||
action__tab_page_navigation_history_back,
|
action__tab_page_navigation_history_back,
|
||||||
action__tab_page_navigation_history_forward,
|
action__tab_page_navigation_history_forward,
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,6 @@ namespace app::browser::main
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
int append(
|
int append(
|
||||||
const Glib::ustring & LABEL_TEXT,
|
|
||||||
const bool & IS_CURRENT
|
const bool & IS_CURRENT
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,14 +15,14 @@ Label::Label(
|
||||||
action__tab_close = ACTION__TAB_CLOSE;
|
action__tab_close = ACTION__TAB_CLOSE;
|
||||||
|
|
||||||
// Setup label controller
|
// Setup label controller
|
||||||
auto GtkGestureClick = Gtk::GestureClick::create();
|
auto const EVENT__GESTURE_CLICK = Gtk::GestureClick::create();
|
||||||
|
|
||||||
/* @TODO remove as default
|
/* @TODO remove as default
|
||||||
controller->set_button(
|
controller->set_button(
|
||||||
GDK_BUTTON_PRIMARY
|
GDK_BUTTON_PRIMARY
|
||||||
);*/
|
);*/
|
||||||
|
|
||||||
GtkGestureClick->signal_pressed().connect(
|
EVENT__GESTURE_CLICK->signal_pressed().connect(
|
||||||
[this](int n, double x, double y)
|
[this](int n, double x, double y)
|
||||||
{
|
{
|
||||||
if (n == 2) // double click
|
if (n == 2) // double click
|
||||||
|
|
@ -33,8 +33,14 @@ Label::Label(
|
||||||
);
|
);
|
||||||
|
|
||||||
add_controller(
|
add_controller(
|
||||||
GtkGestureClick
|
EVENT__GESTURE_CLICK
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Init widget
|
||||||
|
/* not in use, overwritten by page init @TODO
|
||||||
|
set_text(
|
||||||
|
_("New page")
|
||||||
|
);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
|
|
|
||||||
|
|
@ -6,28 +6,24 @@ using namespace app::browser::main::tab;
|
||||||
|
|
||||||
Page::Page(
|
Page::Page(
|
||||||
sqlite3 * db,
|
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__UPDATE,
|
||||||
const Glib::RefPtr<Gio::SimpleAction> & ACTION__TAB_PAGE_NAVIGATION_HISTORY_BACK,
|
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_HISTORY_FORWARD,
|
||||||
const Glib::RefPtr<Gio::SimpleAction> & ACTION__TAB_PAGE_NAVIGATION_RELOAD
|
const Glib::RefPtr<Gio::SimpleAction> & ACTION__TAB_PAGE_NAVIGATION_RELOAD
|
||||||
) {
|
) {
|
||||||
// Init meta
|
// Init meta
|
||||||
mime = MIME;
|
mime = MIME::UNDEFINED;
|
||||||
title = TITLE;
|
title = _("New page");
|
||||||
description = DESCRIPTION;
|
|
||||||
progress_fraction = 0;
|
progress_fraction = 0;
|
||||||
|
|
||||||
// Init actions
|
|
||||||
action__update = ACTION__UPDATE;
|
|
||||||
|
|
||||||
// Init database
|
// Init database
|
||||||
DB::SESSION::init(
|
DB::SESSION::init(
|
||||||
this->db = db
|
this->db = db
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Init actions
|
||||||
|
action__update = ACTION__UPDATE;
|
||||||
|
|
||||||
// Init widget
|
// Init widget
|
||||||
set_orientation(
|
set_orientation(
|
||||||
Gtk::Orientation::VERTICAL
|
Gtk::Orientation::VERTICAL
|
||||||
|
|
|
||||||
|
|
@ -83,14 +83,14 @@ namespace app::browser::main::tab
|
||||||
|
|
||||||
// Meta
|
// Meta
|
||||||
MIME mime;
|
MIME mime;
|
||||||
Glib::ustring title;
|
|
||||||
Glib::ustring description;
|
|
||||||
|
|
||||||
// Tools
|
double progress_fraction;
|
||||||
double progress_fraction; // async load indication (progress bar)
|
|
||||||
|
|
||||||
GUri * uri;
|
GUri * uri;
|
||||||
|
|
||||||
|
Glib::ustring title;
|
||||||
|
Glib::ustring description;
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
Glib::RefPtr<Gio::SimpleAction> action__update;
|
Glib::RefPtr<Gio::SimpleAction> action__update;
|
||||||
|
|
||||||
|
|
@ -114,9 +114,6 @@ namespace app::browser::main::tab
|
||||||
|
|
||||||
Page(
|
Page(
|
||||||
sqlite3 * db,
|
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__UPDATE,
|
||||||
const Glib::RefPtr<Gio::SimpleAction> & ACTION__TAB_PAGE_NAVIGATION_HISTORY_BACK,
|
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_HISTORY_FORWARD,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue