mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 17:15:28 +00:00
implement history navigation
This commit is contained in:
parent
19dab748ae
commit
0db319a519
4 changed files with 55 additions and 23 deletions
|
|
@ -15,12 +15,12 @@ class History
|
|||
public \Yggverse\Yoda\Entity\Window\Tab\Address\Navbar\History\Back $back;
|
||||
public \Yggverse\Yoda\Entity\Window\Tab\Address\Navbar\History\Forward $forward;
|
||||
|
||||
private \Yggverse\Yoda\Model\History $_history;
|
||||
public \Yggverse\Yoda\Model\History $memory;
|
||||
|
||||
public function __construct(
|
||||
\Yggverse\Yoda\Entity\Window\Tab\Address\Navbar $navbar
|
||||
) {
|
||||
$this->_history = new \Yggverse\Yoda\Model\History();
|
||||
$this->memory = new \Yggverse\Yoda\Model\History();
|
||||
|
||||
$this->navbar = $navbar;
|
||||
|
||||
|
|
@ -50,27 +50,32 @@ class History
|
|||
}
|
||||
|
||||
public function add(
|
||||
string $url
|
||||
string $value
|
||||
): void
|
||||
{
|
||||
if (empty($url))
|
||||
if (empty($value))
|
||||
{
|
||||
throw new \Exception;
|
||||
}
|
||||
|
||||
if ($url != $this->_history->getCurrent())
|
||||
if ($value != $this->memory->getCurrent())
|
||||
{
|
||||
$this->_history->add(
|
||||
$url
|
||||
$this->memory->add(
|
||||
$value
|
||||
);
|
||||
}
|
||||
|
||||
$this->refresh();
|
||||
}
|
||||
|
||||
public function refresh(): void
|
||||
{
|
||||
$this->back->gtk->set_sensitive(
|
||||
(bool) $this->_history->getBack()
|
||||
(bool) $this->memory->getBack()
|
||||
);
|
||||
|
||||
$this->forward->gtk->set_sensitive(
|
||||
(bool) $this->_history->getForward()
|
||||
(bool) $this->memory->getForward()
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue