Browse Source

listen events for visible/enabled elements only

main
yggverse 3 months ago
parent
commit
313c6b6db5
  1. 80
      src/Entity/Tab/Page.php

80
src/Entity/Tab/Page.php

@ -51,14 +51,6 @@ class Page
// Init history // Init history
$this->history = new \Yggverse\Yoda\Model\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 // Compose header
$this->header = new \GtkBox( $this->header = new \GtkBox(
\GtkOrientation::HORIZONTAL \GtkOrientation::HORIZONTAL
@ -84,11 +76,13 @@ class Page
$this->config->header->margin $this->config->header->margin
); );
// Home button // Init home button
$this->home = \GtkButton::new_with_label( $this->home = \GtkButton::new_with_label(
$this->config->header->button->home->label $this->config->header->button->home->label
); );
if ($this->config->header->button->home->visible)
{
$this->home->connect( $this->home->connect(
'clicked', 'clicked',
function ($entry) function ($entry)
@ -101,18 +95,34 @@ class Page
} }
); );
if ($this->config->header->button->home->visible)
{
$this->header->add( $this->header->add(
$this->home $this->home
); );
} }
// Back button // Init back button
$this->back = \GtkButton::new_with_label( $this->back = \GtkButton::new_with_label(
$this->config->header->button->back->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( $this->back->set_sensitive(
false false
); );
@ -128,11 +138,13 @@ class Page
} }
); );
// Forward button $buttonGroup->add(
$this->forward = \GtkButton::new_with_label( $this->back
$this->config->header->button->forward->label
); );
}
if ($this->config->header->button->forward->visible)
{
$this->forward->set_sensitive( $this->forward->set_sensitive(
false 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( $buttonGroup->add(
$this->forward $this->forward
); );
@ -189,6 +181,13 @@ class Page
$this->config->header->entry->request->length->max $this->config->header->entry->request->length->max
); );
$this->header->pack_start(
$this->request,
true,
true,
0
);
$this->request->connect( $this->request->connect(
'activate', 'activate',
function ($entry) function ($entry)
@ -199,13 +198,6 @@ class Page
} }
); );
$this->header->pack_start(
$this->request,
true,
true,
0
);
// Init autocomplete // Init autocomplete
if ($this->config->header->entry->request->autocomplete->enabled) if ($this->config->header->entry->request->autocomplete->enabled)
{ {
@ -275,6 +267,8 @@ class Page
$this->config->header->button->go->label $this->config->header->button->go->label
); );
if ($this->config->header->button->go->visible)
{
$this->go->connect( $this->go->connect(
'clicked', 'clicked',
function ($entry) function ($entry)
@ -285,8 +279,6 @@ class Page
} }
); );
if ($this->config->header->button->go->visible)
{
$this->header->add( $this->header->add(
$this->go $this->go
); );

Loading…
Cancel
Save