mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 09:35:28 +00:00
make new tab focused
This commit is contained in:
parent
58e4420a8b
commit
5236f004eb
1 changed files with 12 additions and 9 deletions
|
|
@ -50,20 +50,13 @@ class App
|
||||||
);
|
);
|
||||||
|
|
||||||
// + button
|
// + button
|
||||||
$blank = new \GtkLabel;
|
|
||||||
|
|
||||||
$this->tabs->append_page(
|
$this->tabs->append_page(
|
||||||
$blank,
|
new \GtkLabel,
|
||||||
new \GtkLabel(
|
new \GtkLabel(
|
||||||
'+'
|
'+'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->tabs->set_tab_reorderable(
|
|
||||||
$blank,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
// Append blank page
|
// Append blank page
|
||||||
$page = $this->blankPage();
|
$page = $this->blankPage();
|
||||||
|
|
||||||
|
|
@ -83,13 +76,23 @@ class App
|
||||||
'switch-page',
|
'switch-page',
|
||||||
function ($tabs, $child, $position)
|
function ($tabs, $child, $position)
|
||||||
{
|
{
|
||||||
|
// Update window title on tab change
|
||||||
$this->setTitle(
|
$this->setTitle(
|
||||||
$tabs->get_tab_label_text($child)
|
$tabs->get_tab_label_text($child)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Add new tab event
|
||||||
if ('+' == $tabs->get_tab_label_text($child))
|
if ('+' == $tabs->get_tab_label_text($child))
|
||||||
{
|
{
|
||||||
$this->blankPage();
|
\Gtk::timeout_add(
|
||||||
|
0,
|
||||||
|
function()
|
||||||
|
{
|
||||||
|
$this->blankPage();
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue