mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 17:45:28 +00:00
simplify history navigation api
This commit is contained in:
parent
769ef576f6
commit
43e89716ae
3 changed files with 80 additions and 115 deletions
|
|
@ -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();
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue