mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
draft history tab features
This commit is contained in:
parent
5df6332346
commit
fa92487489
5 changed files with 46 additions and 13 deletions
|
|
@ -8,7 +8,7 @@ At this moment project under development!
|
||||||
* [x] Flexible settings in `config.json`, then UI
|
* [x] Flexible settings in `config.json`, then UI
|
||||||
* [x] Native GTK environment, no custom colors until you change it by `css`
|
* [x] Native GTK environment, no custom colors until you change it by `css`
|
||||||
* [x] Multi-tabs
|
* [x] Multi-tabs
|
||||||
* [ ] Navigation history
|
* [x] Navigation history
|
||||||
* [ ] Bookmarks
|
* [ ] Bookmarks
|
||||||
* [ ] Certificate features
|
* [ ] Certificate features
|
||||||
* [ ] Local snaps to make resources accessible even offline
|
* [ ] Local snaps to make resources accessible even offline
|
||||||
|
|
|
||||||
|
|
@ -137,6 +137,8 @@
|
||||||
},
|
},
|
||||||
"history":
|
"history":
|
||||||
{
|
{
|
||||||
|
"enabled":true,
|
||||||
|
"label":"History",
|
||||||
"time":
|
"time":
|
||||||
{
|
{
|
||||||
"format":"c"
|
"format":"c"
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@ class App
|
||||||
{
|
{
|
||||||
public \Yggverse\Yoda\Model\Database $database;
|
public \Yggverse\Yoda\Model\Database $database;
|
||||||
|
|
||||||
|
public \Yggverse\Yoda\Entity\Tab\History $history;
|
||||||
|
|
||||||
public \GtkWindow $window;
|
public \GtkWindow $window;
|
||||||
public \GtkHeaderBar $header;
|
public \GtkHeaderBar $header;
|
||||||
public \GtkNotebook $tabs;
|
public \GtkNotebook $tabs;
|
||||||
|
|
@ -82,6 +84,26 @@ class App
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// History features
|
||||||
|
if ($this->config->tab->history->enabled)
|
||||||
|
{
|
||||||
|
$this->history = new \Yggverse\Yoda\Entity\Tab\History(
|
||||||
|
$this
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->tabs->append_page(
|
||||||
|
$this->history->box,
|
||||||
|
new \GtkLabel(
|
||||||
|
$this->config->tab->history->label
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->tabs->set_tab_reorderable(
|
||||||
|
$this->history->box,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Append blank page
|
// Append blank page
|
||||||
$page = $this->blankPage();
|
$page = $this->blankPage();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,18 +56,7 @@ class History
|
||||||
);
|
);
|
||||||
|
|
||||||
// Build history list from database records
|
// Build history list from database records
|
||||||
foreach ($this->app->database->getHistory() as $record)
|
$this->refresh();
|
||||||
{
|
|
||||||
$this->list->append(
|
|
||||||
[
|
|
||||||
$record->url,
|
|
||||||
date(
|
|
||||||
$this->config->time->format,
|
|
||||||
$record->time
|
|
||||||
)
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Compose page
|
// Compose page
|
||||||
$this->box = new \GtkBox(
|
$this->box = new \GtkBox(
|
||||||
|
|
@ -87,4 +76,22 @@ class History
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function refresh(): void
|
||||||
|
{
|
||||||
|
$this->list->clear();
|
||||||
|
|
||||||
|
foreach ($this->app->database->getHistory() as $record)
|
||||||
|
{
|
||||||
|
$this->list->append(
|
||||||
|
[
|
||||||
|
$record->url,
|
||||||
|
date(
|
||||||
|
$this->config->time->format,
|
||||||
|
$record->time
|
||||||
|
)
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -399,6 +399,8 @@ class Page
|
||||||
$this->app->database->addHistory(
|
$this->app->database->addHistory(
|
||||||
$url
|
$url
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$this->app->history->refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue