add go button released event

This commit is contained in:
yggverse 2024-04-10 06:17:19 +03:00
parent 4b50edd3d0
commit c7e4c00176
2 changed files with 94 additions and 82 deletions

View file

@ -72,13 +72,29 @@ class Tab
true, true,
0 0
); );
}
public function activate()
{
$this->navigation->address->entry->connect( $this->navigation->address->entry->connect(
'activate', 'activate',
function ($entry) function ($entry)
{
$this->navigate(
$entry->get_text()
);
}
);
$this->navigation->go->button->connect(
'released',
function ($entry)
{
$this->navigate(
$this->navigation->address->entry->get_text()
);
}
);
}
public function navigate(string $url)
{ {
global $config; global $config;
@ -86,7 +102,7 @@ class Tab
sprintf( sprintf(
'Open %s...', 'Open %s...',
urldecode( urldecode(
$entry->get_text() $url
) )
) )
); );
@ -98,7 +114,7 @@ class Tab
if ($config->resolver->enabled) if ($config->resolver->enabled)
{ {
$address = new \Yggverse\Net\Address( $address = new \Yggverse\Net\Address(
$entry->get_text() $url
); );
$name = $address->getHost(); $name = $address->getHost();
@ -129,7 +145,7 @@ class Tab
} }
$request = new \Yggverse\Gemini\Client\Request( $request = new \Yggverse\Gemini\Client\Request(
$entry->get_text(), $url,
$host $host
); );
@ -161,6 +177,4 @@ class Tab
) )
); );
} }
);
}
} }

View file

@ -63,8 +63,6 @@ $window->connect(
$tab = new \Yggverse\Yoda\Box\Tab(); $tab = new \Yggverse\Yoda\Box\Tab();
$tab->activate();
$window->add( $window->add(
$tab->box $tab->box
); );