From f65458ca7059ac69383e60a4c96dc1a049629289 Mon Sep 17 00:00:00 2001 From: yggverse Date: Fri, 12 Jul 2024 20:16:31 +0300 Subject: [PATCH] fix page entity operations --- src/Entity/Browser/Container/Tab.php | 35 +++++++++------------------ src/Entity/Browser/Menu/Tab/Close.php | 4 +-- 2 files changed, 13 insertions(+), 26 deletions(-) diff --git a/src/Entity/Browser/Container/Tab.php b/src/Entity/Browser/Container/Tab.php index a6860dda..d1c7c47f 100644 --- a/src/Entity/Browser/Container/Tab.php +++ b/src/Entity/Browser/Container/Tab.php @@ -75,8 +75,8 @@ class Tab ?\GtkWidget $child, int $page_num ) { - $this->closePage( - $page_num + $this->reorderPage( + null // all ); } ); @@ -88,7 +88,9 @@ class Tab ?\GtkWidget $child, int $page_num ) { - $this->reorderPage(); + $this->reorderPage( + null // all + ); } ); } @@ -168,30 +170,17 @@ class Tab } public function closePage( - int $page_num + ?int $page_num = null ): void { - // Validate page index exists - if (empty($this->_page[$page_num])) + if ($page = $this->getPage($page_num)) { - throw new \Exception; + $this->gtk->remove_page( + $this->gtk->page_num( + $page->gtk + ) + ); } - - // Remove GTK node - $this->gtk->remove_page( - $page_num - ); -/* - // Free memory - $this->_page[$page_num] = null; - - // Cleanup internal record - unset( - $this->_page[$page_num] - ); -*/ - // Reorder - $this->reorderPage(); } public function reorderPage( diff --git a/src/Entity/Browser/Menu/Tab/Close.php b/src/Entity/Browser/Menu/Tab/Close.php index d2f4fce5..a3409213 100644 --- a/src/Entity/Browser/Menu/Tab/Close.php +++ b/src/Entity/Browser/Menu/Tab/Close.php @@ -34,10 +34,8 @@ class Close function() { $this->tab->menu->browser->container->tab->closePage( - $this->tab->menu->browser->container->tab->gtk->get_current_page() + null // active ); - - // @TODO unset page entity } ); }