implement navigation request session save

This commit is contained in:
yggverse 2024-09-11 01:39:39 +03:00
parent aabbf6e2eb
commit 309bf1b587
6 changed files with 392 additions and 44 deletions

View file

@ -8,35 +8,83 @@
#include <glibmm/regex.h>
#include <glibmm/ustring.h>
#include <gtkmm/entry.h>
#include <sqlite3.h>
namespace app::browser::main::tab::page::navigation
{
class Request : public Gtk::Entry
{
// Actions
Glib::RefPtr<Gio::SimpleAction> action__refresh,
action__update;
public:
// Extras
double progress_fraction;
/*
* Class database
*
* Allowed parental access to enums and relationship methods
*/
struct DB
{
struct APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_REQUEST__SESSION
{
enum
{
ID,
TIME,
TEXT
}; // table fields index
Glib::ustring scheme,
host,
port,
path,
query;
static int init(
sqlite3 * db
); // return sqlite3_exec status code
// Defaults
const bool HEXPAND = true;
const double PROGRESS_PULSE_STEP = .1;
const int PROGRESS_ANIMATION_TIME = 10;
static int clean(
sqlite3 * db,
const int & DB__APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION_ID
); // return sqlite3_finalize status code
// Private helpers
void parse();
static sqlite3_int64 add(
sqlite3 * db,
const sqlite3_int64 & DB__APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION_ID,
const Glib::ustring & TEXT
); // return sqlite3_last_insert_rowid
};
};
/*
* Internal members
*/
private:
// Database
sqlite3 * db;
// Actions
Glib::RefPtr<Gio::SimpleAction> action__refresh,
action__update;
// Extras
double progress_fraction;
Glib::ustring scheme,
host,
port,
path,
query;
// Defaults
const bool HEXPAND = true;
const double PROGRESS_PULSE_STEP = .1;
const int PROGRESS_ANIMATION_TIME = 10;
// Private helpers
void parse();
/*
* Class API
*/
public:
Request(
sqlite3 * db,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__REFRESH,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__UPDATE
);
@ -46,7 +94,9 @@ namespace app::browser::main::tab::page::navigation
const double & PROGRESS_FRACTION
);
int save();
int save(
const sqlite3_int64 & DB__APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION_ID
);
// Getters
Glib::ustring get_scheme();