|
|
@ -14,9 +14,11 @@ class App |
|
|
|
|
|
|
|
|
|
|
|
public function __construct() |
|
|
|
public function __construct() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
// Init config |
|
|
|
$this->config = \Yggverse\Yoda\Model\File::getConfig()->app; // @TODO |
|
|
|
$this->config = \Yggverse\Yoda\Model\File::getConfig()->app; // @TODO |
|
|
|
|
|
|
|
|
|
|
|
$this->window = new \GtkWindow(); |
|
|
|
// Init window |
|
|
|
|
|
|
|
$this->window = new \GtkWindow; |
|
|
|
|
|
|
|
|
|
|
|
$this->window->set_size_request( |
|
|
|
$this->window->set_size_request( |
|
|
|
$this->config->width, |
|
|
|
$this->config->width, |
|
|
@ -25,7 +27,7 @@ class App |
|
|
|
|
|
|
|
|
|
|
|
if ($this->config->header->enabled) |
|
|
|
if ($this->config->header->enabled) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$this->header = new \GtkHeaderBar(); |
|
|
|
$this->header = new \GtkHeaderBar; |
|
|
|
|
|
|
|
|
|
|
|
$this->header->set_title( |
|
|
|
$this->header->set_title( |
|
|
|
$this->config->header->title->default |
|
|
|
$this->config->header->title->default |
|
|
@ -40,34 +42,72 @@ class App |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$this->window->connect( |
|
|
|
// Init tabs |
|
|
|
'destroy', |
|
|
|
$this->tabs = new \GtkNotebook; |
|
|
|
function() |
|
|
|
|
|
|
|
{ |
|
|
|
$this->tabs->set_scrollable( |
|
|
|
\Gtk::main_quit(); |
|
|
|
true |
|
|
|
} |
|
|
|
|
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$this->tabs = new \GtkNotebook(); |
|
|
|
// + button |
|
|
|
|
|
|
|
$blank = new \GtkLabel; |
|
|
|
|
|
|
|
|
|
|
|
$this->tabs->set_scrollable( |
|
|
|
$this->tabs->append_page( |
|
|
|
|
|
|
|
$blank, |
|
|
|
|
|
|
|
new \GtkLabel( |
|
|
|
|
|
|
|
'+' |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->tabs->set_tab_reorderable( |
|
|
|
|
|
|
|
$blank, |
|
|
|
true |
|
|
|
true |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Append blank page |
|
|
|
|
|
|
|
$page = $this->blankPage(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$page->open( |
|
|
|
|
|
|
|
$this->config->tab->page->header->button->home->url // @TODO |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Render |
|
|
|
$this->window->add( |
|
|
|
$this->window->add( |
|
|
|
$this->tabs |
|
|
|
$this->tabs |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$this->openPage( |
|
|
|
$this->window->show_all(); |
|
|
|
$this->config->tab->page->header->button->home->url // @TODO |
|
|
|
|
|
|
|
|
|
|
|
// Init event listener |
|
|
|
|
|
|
|
$this->tabs->connect( |
|
|
|
|
|
|
|
'switch-page', |
|
|
|
|
|
|
|
function ($tabs, $child, $position) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if ('+' == $tabs->get_tab_label_text($child)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
$page = $this->blankPage(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->tabs->show_all(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->tabs->set_current_page( |
|
|
|
|
|
|
|
$this->tabs->page_num( |
|
|
|
|
|
|
|
$page->box |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$this->window->show_all(); |
|
|
|
$this->window->connect( |
|
|
|
|
|
|
|
'destroy', |
|
|
|
|
|
|
|
function() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
\Gtk::main_quit(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function openPage( |
|
|
|
public function blankPage(): \Yggverse\Yoda\Entity\Tab\Page |
|
|
|
string $url |
|
|
|
|
|
|
|
): void |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
$page = new \Yggverse\Yoda\Entity\Tab\Page( |
|
|
|
$page = new \Yggverse\Yoda\Entity\Tab\Page( |
|
|
|
$this |
|
|
|
$this |
|
|
@ -85,9 +125,15 @@ class App |
|
|
|
true |
|
|
|
true |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$page->open( |
|
|
|
$this->tabs->show_all(); |
|
|
|
$url |
|
|
|
|
|
|
|
|
|
|
|
$this->tabs->set_current_page( |
|
|
|
|
|
|
|
$this->tabs->page_num( |
|
|
|
|
|
|
|
$page->box |
|
|
|
|
|
|
|
) |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $page; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function setTitle( |
|
|
|
public function setTitle( |
|
|
|