#ifndef APP_BROWSER_MAIN_TAB_PAGE_HPP #define APP_BROWSER_MAIN_TAB_PAGE_HPP #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace app::browser::main::tab { namespace page { class Content; class Navigation; } class Page : public Gtk::Box { public: enum class MIME { TEXT_PLAIN, TEXT_GEMINI, UNDEFINED }; /* * Class database * * Allowed parental access to enums and relationship methods */ struct DB { // APP_BROWSER_MAIN_TAB_PAGE__* struct SESSION { enum { ID, APP_BROWSER_MAIN_TAB__SESSION__ID, TIME, MIME, TITLE, DESCRIPTION }; // table fields index static int init( sqlite3 * db ); // return sqlite3_exec status code static int clean( sqlite3 * db, const sqlite3_int64 & APP_BROWSER_MAIN_TAB__SESSION__ID ); // return sqlite3_finalize status code static sqlite3_int64 add( sqlite3 * db, const sqlite3_int64 & APP_BROWSER_MAIN_TAB__SESSION__ID, const Page::MIME & MIME, const Glib::ustring & TITLE, const Glib::ustring & DESCRIPTION ); // return sqlite3_last_insert_rowid }; }; /* * Internal members */ private: // Meta MIME mime; double progress_fraction; GUri * uri; Glib::ustring title; Glib::ustring description; // Actions Glib::RefPtr action__update; // Database sqlite3 * db; // Socket char buffer[0xfffff]; // 1Mb // Shared socket connectors (for async operations) Glib::RefPtr socket__client; Glib::RefPtr socket__connection; // Components page::Content * pageContent; page::Navigation * pageNavigation; /* * Class API */ public: Page( sqlite3 * db, const Glib::RefPtr & ACTION__HISTORY_BACK, const Glib::RefPtr & ACTION__HISTORY_FORWARD, const Glib::RefPtr & ACTION__RELOAD, const Glib::RefPtr & ACTION__UPDATE ); // Actions int session_restore( const sqlite3_int64 & APP_BROWSER_MAIN_TAB__SESSION__ID ); // return sqlite3_finalize status code void session_save( const sqlite3_int64 & APP_BROWSER_MAIN_TAB__SESSION__ID ); void update(); void navigation_reload( const bool & ADD_HISTORY ); void navigation_history_back(); void navigation_history_forward(); // Getters MIME get_mime(); Glib::ustring get_title(); Glib::ustring get_description(); }; } #endif // APP_BROWSER_MAIN_TAB_PAGE_HPP