mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 00:55:28 +00:00
implement push method
This commit is contained in:
parent
336ded6a76
commit
b3c00d29be
2 changed files with 25 additions and 6 deletions
|
|
@ -31,9 +31,20 @@ History::~History()
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
void History::push(
|
void History::push(
|
||||||
const Glib::ustring & VALUE
|
const Glib::ustring & REQUEST
|
||||||
) {
|
) {
|
||||||
// @TODO
|
if (memory.empty() || memory.back().request != REQUEST)
|
||||||
|
{
|
||||||
|
memory.push_back(
|
||||||
|
{
|
||||||
|
REQUEST,
|
||||||
|
std::time(
|
||||||
|
nullptr
|
||||||
|
),
|
||||||
|
true
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void History::refresh()
|
void History::refresh()
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#ifndef APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_HISTORY_HPP
|
#ifndef APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_HISTORY_HPP
|
||||||
#define APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_HISTORY_HPP
|
#define APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_HISTORY_HPP
|
||||||
|
|
||||||
|
#include <ctime>
|
||||||
#include <glibmm/i18n.h>
|
#include <glibmm/i18n.h>
|
||||||
#include <glibmm/ustring.h>
|
#include <glibmm/ustring.h>
|
||||||
#include <gtkmm/box.h>
|
#include <gtkmm/box.h>
|
||||||
|
|
@ -16,9 +17,16 @@ namespace app::browser::main::tab::page::navbar
|
||||||
|
|
||||||
class History : public Gtk::Box
|
class History : public Gtk::Box
|
||||||
{
|
{
|
||||||
// Memory
|
// Extras
|
||||||
std::vector<Glib::ustring> history;
|
struct Memory
|
||||||
std::vector<Glib::ustring>::iterator index;
|
{
|
||||||
|
Glib::ustring request;
|
||||||
|
std::time_t time; // event unix time
|
||||||
|
bool permanent; // save in database (on application close) @TODO
|
||||||
|
};
|
||||||
|
|
||||||
|
std::vector<Memory> memory;
|
||||||
|
std::vector<Memory>::iterator memory_index;
|
||||||
|
|
||||||
// Components
|
// Components
|
||||||
history::Back * historyBack;
|
history::Back * historyBack;
|
||||||
|
|
@ -31,7 +39,7 @@ namespace app::browser::main::tab::page::navbar
|
||||||
~History();
|
~History();
|
||||||
|
|
||||||
void push(
|
void push(
|
||||||
const Glib::ustring & VALUE
|
const Glib::ustring & REQUEST
|
||||||
);
|
);
|
||||||
|
|
||||||
void refresh();
|
void refresh();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue