mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
update session database on tab operations
This commit is contained in:
parent
0618233d64
commit
ecbe600fe4
1 changed files with 34 additions and 2 deletions
|
|
@ -63,6 +63,19 @@ class Tab
|
|||
}
|
||||
);
|
||||
|
||||
$this->gtk->connect(
|
||||
'page-added',
|
||||
function (
|
||||
?\GtkNotebook $self,
|
||||
?\GtkWidget $child,
|
||||
int $page_num
|
||||
) {
|
||||
$this->reorderPage(
|
||||
null // all
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
$this->gtk->connect(
|
||||
'page-removed',
|
||||
function (
|
||||
|
|
@ -173,7 +186,8 @@ class Tab
|
|||
}
|
||||
|
||||
public function reorderPage(
|
||||
?int $page_num = null
|
||||
?int $page_num = null,
|
||||
bool $session = true
|
||||
): void
|
||||
{
|
||||
// Reorder all pages
|
||||
|
|
@ -192,6 +206,9 @@ class Tab
|
|||
// Skip deleted
|
||||
if ($page_num === -1)
|
||||
{
|
||||
// Prevent session update
|
||||
$session = false;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -199,8 +216,23 @@ class Tab
|
|||
$_page[$page_num] = $page;
|
||||
}
|
||||
|
||||
// Reorder
|
||||
// Reorder entities
|
||||
$this->_page = $_page;
|
||||
|
||||
// Update session
|
||||
if ($session)
|
||||
{
|
||||
$this->container->browser->database->cleanSession();
|
||||
|
||||
ksort($_page);
|
||||
|
||||
foreach ($_page as $page)
|
||||
{
|
||||
$this->container->browser->database->addSession(
|
||||
$page->navbar->request->getValue()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Reorder by $page_num
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue