From 5236f004eb282b14456391e447d9416ebb189dd7 Mon Sep 17 00:00:00 2001 From: yggverse Date: Sat, 13 Apr 2024 14:38:56 +0300 Subject: [PATCH] make new tab focused --- src/Entity/App.php | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/Entity/App.php b/src/Entity/App.php index ed73cc6b..fc36e800 100644 --- a/src/Entity/App.php +++ b/src/Entity/App.php @@ -50,20 +50,13 @@ class App ); // + button - $blank = new \GtkLabel; - $this->tabs->append_page( - $blank, + new \GtkLabel, new \GtkLabel( '+' ) ); - $this->tabs->set_tab_reorderable( - $blank, - true - ); - // Append blank page $page = $this->blankPage(); @@ -83,13 +76,23 @@ class App 'switch-page', function ($tabs, $child, $position) { + // Update window title on tab change $this->setTitle( $tabs->get_tab_label_text($child) ); + // Add new tab event if ('+' == $tabs->get_tab_label_text($child)) { - $this->blankPage(); + \Gtk::timeout_add( + 0, + function() + { + $this->blankPage(); + + return false; + } + ); } } );