mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 17:45:28 +00:00
listen events for visible/enabled elements only
This commit is contained in:
parent
0824d0d73b
commit
313c6b6db5
1 changed files with 63 additions and 71 deletions
|
|
@ -51,14 +51,6 @@ class Page
|
|||
// Init history
|
||||
$this->history = new \Yggverse\Yoda\Model\History;
|
||||
|
||||
// Run database cleaner
|
||||
if ($this->config->history->database->timeout)
|
||||
{
|
||||
$this->app->database->cleanHistory(
|
||||
$this->config->history->database->timeout
|
||||
);
|
||||
}
|
||||
|
||||
// Compose header
|
||||
$this->header = new \GtkBox(
|
||||
\GtkOrientation::HORIZONTAL
|
||||
|
|
@ -84,11 +76,13 @@ class Page
|
|||
$this->config->header->margin
|
||||
);
|
||||
|
||||
// Home button
|
||||
// Init home button
|
||||
$this->home = \GtkButton::new_with_label(
|
||||
$this->config->header->button->home->label
|
||||
);
|
||||
|
||||
if ($this->config->header->button->home->visible)
|
||||
{
|
||||
$this->home->connect(
|
||||
'clicked',
|
||||
function ($entry)
|
||||
|
|
@ -101,18 +95,34 @@ class Page
|
|||
}
|
||||
);
|
||||
|
||||
if ($this->config->header->button->home->visible)
|
||||
{
|
||||
$this->header->add(
|
||||
$this->home
|
||||
);
|
||||
}
|
||||
|
||||
// Back button
|
||||
// Init back button
|
||||
$this->back = \GtkButton::new_with_label(
|
||||
$this->config->header->button->back->label
|
||||
);
|
||||
|
||||
// Init forward button
|
||||
$this->forward = \GtkButton::new_with_label(
|
||||
$this->config->header->button->forward->label
|
||||
);
|
||||
|
||||
// Group back/forward buttons
|
||||
if ($this->config->header->button->back->visible || $this->config->header->button->forward->visible)
|
||||
{
|
||||
$buttonGroup = new \GtkButtonBox(
|
||||
\GtkOrientation::HORIZONTAL
|
||||
);
|
||||
|
||||
$buttonGroup->set_layout(
|
||||
\GtkButtonBoxStyle::EXPAND
|
||||
);
|
||||
|
||||
if ($this->config->header->button->back->visible)
|
||||
{
|
||||
$this->back->set_sensitive(
|
||||
false
|
||||
);
|
||||
|
|
@ -128,11 +138,13 @@ class Page
|
|||
}
|
||||
);
|
||||
|
||||
// Forward button
|
||||
$this->forward = \GtkButton::new_with_label(
|
||||
$this->config->header->button->forward->label
|
||||
$buttonGroup->add(
|
||||
$this->back
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->config->header->button->forward->visible)
|
||||
{
|
||||
$this->forward->set_sensitive(
|
||||
false
|
||||
);
|
||||
|
|
@ -148,26 +160,6 @@ class Page
|
|||
}
|
||||
);
|
||||
|
||||
/// Group buttons
|
||||
if ($this->config->header->button->back->visible || $this->config->header->button->forward->visible)
|
||||
{
|
||||
$buttonGroup = new \GtkButtonBox(
|
||||
\GtkOrientation::HORIZONTAL
|
||||
);
|
||||
|
||||
$buttonGroup->set_layout(
|
||||
\GtkButtonBoxStyle::EXPAND
|
||||
);
|
||||
|
||||
if ($this->config->header->button->back->visible)
|
||||
{
|
||||
$buttonGroup->add(
|
||||
$this->back
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->config->header->button->forward->visible)
|
||||
{
|
||||
$buttonGroup->add(
|
||||
$this->forward
|
||||
);
|
||||
|
|
@ -189,6 +181,13 @@ class Page
|
|||
$this->config->header->entry->request->length->max
|
||||
);
|
||||
|
||||
$this->header->pack_start(
|
||||
$this->request,
|
||||
true,
|
||||
true,
|
||||
0
|
||||
);
|
||||
|
||||
$this->request->connect(
|
||||
'activate',
|
||||
function ($entry)
|
||||
|
|
@ -199,13 +198,6 @@ class Page
|
|||
}
|
||||
);
|
||||
|
||||
$this->header->pack_start(
|
||||
$this->request,
|
||||
true,
|
||||
true,
|
||||
0
|
||||
);
|
||||
|
||||
// Init autocomplete
|
||||
if ($this->config->header->entry->request->autocomplete->enabled)
|
||||
{
|
||||
|
|
@ -275,6 +267,8 @@ class Page
|
|||
$this->config->header->button->go->label
|
||||
);
|
||||
|
||||
if ($this->config->header->button->go->visible)
|
||||
{
|
||||
$this->go->connect(
|
||||
'clicked',
|
||||
function ($entry)
|
||||
|
|
@ -285,8 +279,6 @@ class Page
|
|||
}
|
||||
);
|
||||
|
||||
if ($this->config->header->button->go->visible)
|
||||
{
|
||||
$this->header->add(
|
||||
$this->go
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue