simplify history navigation api

This commit is contained in:
yggverse 2024-09-04 02:23:31 +03:00
parent 769ef576f6
commit 43e89716ae
3 changed files with 80 additions and 115 deletions

View file

@ -18,47 +18,43 @@ namespace app::browser::main::tab::page::navbar
class History : public Gtk::Box
{
// Extras
struct Memory
{
Glib::ustring request;
std::time_t time; // event unix time
bool permanent; // save in database (on application close) @TODO
};
// Define navigation history storage
std::vector<Memory> memory;
int index = 0;
// Private helpers
Memory & get_memory_back();
Memory & get_memory_forward();
// Components
history::Back * historyBack;
history::Forward * historyForward;
int index = 0;
public:
// Extras
struct Memory
{
Glib::ustring request;
std::time_t time; // event unix time
bool permanent; // save in database (on application close) @TODO
};
// Define navigation history storage
std::vector<Memory> memory;
History();
// Actions
void back();
void forward();
bool back(
Memory & match,
bool follow = true
);
bool forward(
Memory & match,
bool follow = true
);
void push(
const Glib::ustring & REQUEST
);
void refresh();
// Getters
bool has_memory_back();
bool has_memory_forward();
// Copying getters (to keep private members encapsulation)
Glib::ustring make_memory_back_request();
Glib::ustring make_memory_forward_request();
};
}