mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 09:05:27 +00:00
save session on browser close only
This commit is contained in:
parent
196b55e072
commit
48198668fd
4 changed files with 38 additions and 79 deletions
|
|
@ -4,6 +4,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Yggverse\Yoda\Entity;
|
||||
|
||||
use \Gtk;
|
||||
use \GtkWindow;
|
||||
|
||||
use \Yggverse\Yoda\Entity\Browser\Header;
|
||||
|
|
@ -78,5 +79,31 @@ class Browser
|
|||
// @TODO render data wordwrap by $window->get_size()
|
||||
}
|
||||
);
|
||||
|
||||
$this->gtk->connect(
|
||||
'destroy',
|
||||
function()
|
||||
{
|
||||
// Save session
|
||||
$pid = pcntl_fork();
|
||||
|
||||
if ($pid === 0)
|
||||
{
|
||||
$this->database->cleanSession();
|
||||
|
||||
foreach ($this->container->tab->pages as $page)
|
||||
{
|
||||
$this->database->addSession(
|
||||
$page->navbar->request->getValue()
|
||||
);
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
// Exit application
|
||||
Gtk::main_quit();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue