2024-09-04 23:16:43 +03:00
|
|
|
#ifndef APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_HPP
|
|
|
|
#define APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_HPP
|
2024-08-13 08:28:33 +03:00
|
|
|
|
2024-09-08 03:49:08 +03:00
|
|
|
#include <giomm/simpleaction.h>
|
|
|
|
#include <glibmm/refptr.h>
|
2024-08-14 09:16:45 +03:00
|
|
|
#include <glibmm/ustring.h>
|
2024-08-13 08:28:33 +03:00
|
|
|
#include <gtkmm/box.h>
|
2024-09-02 16:25:31 +03:00
|
|
|
#include <gtkmm/object.h>
|
2024-09-10 21:21:05 +03:00
|
|
|
#include <sqlite3.h>
|
2024-08-13 08:28:33 +03:00
|
|
|
|
2024-08-15 18:52:11 +03:00
|
|
|
namespace app::browser::main::tab::page
|
2024-08-13 08:28:33 +03:00
|
|
|
{
|
2024-09-04 23:16:43 +03:00
|
|
|
namespace navigation
|
2024-08-13 08:40:17 +03:00
|
|
|
{
|
|
|
|
class Base;
|
2024-08-13 09:54:11 +03:00
|
|
|
class Bookmark;
|
2024-08-13 09:47:59 +03:00
|
|
|
class History;
|
2024-08-13 09:05:59 +03:00
|
|
|
class Update;
|
2024-08-13 09:59:58 +03:00
|
|
|
class Request;
|
2024-08-13 08:40:17 +03:00
|
|
|
}
|
|
|
|
|
2024-09-04 23:16:43 +03:00
|
|
|
class Navigation : public Gtk::Box
|
2024-08-13 08:28:33 +03:00
|
|
|
{
|
2024-09-11 01:39:39 +03:00
|
|
|
public:
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class database
|
|
|
|
*
|
|
|
|
* Allowed parental access to enums and relationship methods
|
|
|
|
*/
|
|
|
|
struct DB
|
|
|
|
{
|
|
|
|
struct APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION
|
|
|
|
{
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
ID,
|
|
|
|
TIME
|
|
|
|
}; // table fields index
|
|
|
|
|
|
|
|
static int init(
|
|
|
|
sqlite3 * db
|
|
|
|
); // return sqlite3_exec status code
|
|
|
|
|
|
|
|
static int clean(
|
|
|
|
sqlite3 * db,
|
|
|
|
const int & DB__APP_BROWSER_MAIN_TAB_PAGE__SESSION_ID
|
|
|
|
); // return sqlite3_finalize status code
|
|
|
|
|
|
|
|
static sqlite3_int64 add(
|
|
|
|
sqlite3 * db,
|
|
|
|
const sqlite3_int64 & DB__APP_BROWSER_MAIN_TAB_PAGE__SESSION_ID
|
|
|
|
); // return sqlite3_last_insert_rowid
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Internal members
|
|
|
|
*/
|
|
|
|
private:
|
|
|
|
|
|
|
|
// Database
|
|
|
|
sqlite3 * db;
|
|
|
|
|
|
|
|
// Components
|
|
|
|
navigation::Base * navigationBase;
|
|
|
|
navigation::Bookmark * navigationBookmark;
|
|
|
|
navigation::History * navigationHistory;
|
|
|
|
navigation::Request * navigationRequest;
|
|
|
|
navigation::Update * navigationUpdate;
|
2024-08-17 00:50:24 +03:00
|
|
|
|
2024-09-11 01:39:39 +03:00
|
|
|
// Defaults
|
|
|
|
const int SPACING = 8;
|
|
|
|
const int MARGIN = 8;
|
2024-08-14 09:16:45 +03:00
|
|
|
|
2024-09-11 01:39:39 +03:00
|
|
|
/*
|
|
|
|
* Class API
|
|
|
|
*/
|
2024-08-13 08:28:33 +03:00
|
|
|
public:
|
|
|
|
|
2024-09-04 23:16:43 +03:00
|
|
|
Navigation(
|
2024-09-11 01:39:39 +03:00
|
|
|
sqlite3 * db,
|
2024-09-08 07:24:59 +03:00
|
|
|
const Glib::RefPtr<Gio::SimpleAction> & ACTION__REFRESH,
|
2024-09-08 03:49:08 +03:00
|
|
|
const Glib::RefPtr<Gio::SimpleAction> & ACTION__NAVIGATION_HISTORY_BACK,
|
2024-09-08 04:20:25 +03:00
|
|
|
const Glib::RefPtr<Gio::SimpleAction> & ACTION__NAVIGATION_HISTORY_FORWARD,
|
|
|
|
const Glib::RefPtr<Gio::SimpleAction> & ACTION__NAVIGATION_UPDATE
|
2024-08-26 22:29:09 +03:00
|
|
|
);
|
|
|
|
|
2024-08-14 09:16:45 +03:00
|
|
|
// Actions
|
2024-09-06 05:17:33 +03:00
|
|
|
void refresh(
|
|
|
|
const double & PROGRESS_FRACTION
|
|
|
|
);
|
2024-09-05 23:13:30 +03:00
|
|
|
|
2024-09-10 21:21:05 +03:00
|
|
|
int save(
|
|
|
|
const sqlite3_int64 & DB__APP_BROWSER_MAIN_TAB__SESSION_ID
|
|
|
|
);
|
2024-09-10 20:50:31 +03:00
|
|
|
|
2024-09-04 20:51:14 +03:00
|
|
|
void history_add(
|
2024-09-05 23:04:53 +03:00
|
|
|
const Glib::ustring & REQUEST,
|
2024-09-05 23:10:15 +03:00
|
|
|
const bool & UPDATE_MEMORY_INDEX
|
2024-08-29 04:02:38 +03:00
|
|
|
);
|
|
|
|
|
2024-09-05 23:13:30 +03:00
|
|
|
// Actionable getters
|
|
|
|
bool try_history_back(
|
|
|
|
Glib::ustring & request,
|
|
|
|
const bool & UPDATE_MEMORY_INDEX
|
|
|
|
);
|
2024-08-14 09:16:45 +03:00
|
|
|
|
2024-09-05 23:13:30 +03:00
|
|
|
bool try_history_forward(
|
|
|
|
Glib::ustring & request,
|
|
|
|
const bool & UPDATE_MEMORY_INDEX
|
2024-08-17 10:27:17 +03:00
|
|
|
);
|
|
|
|
|
2024-08-14 09:16:45 +03:00
|
|
|
// Getters
|
2024-08-26 22:29:09 +03:00
|
|
|
Glib::ustring get_request_text();
|
2024-08-16 09:02:50 +03:00
|
|
|
|
2024-08-17 12:45:43 +03:00
|
|
|
Glib::ustring get_request_scheme();
|
|
|
|
Glib::ustring get_request_host();
|
|
|
|
Glib::ustring get_request_port();
|
|
|
|
Glib::ustring get_request_path();
|
|
|
|
Glib::ustring get_request_query();
|
2024-09-05 22:04:01 +03:00
|
|
|
|
2024-09-05 23:13:30 +03:00
|
|
|
// Setters
|
|
|
|
void set_request_text(
|
|
|
|
const Glib::ustring & VALUE
|
2024-09-05 22:04:01 +03:00
|
|
|
);
|
2024-08-13 08:28:33 +03:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2024-09-04 23:16:43 +03:00
|
|
|
#endif // APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_HPP
|