mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 08:35:28 +00:00
Display document h1 at window title, hostname if not found
This commit is contained in:
parent
4ac02affeb
commit
7398ed7af2
2 changed files with 23 additions and 1 deletions
|
|
@ -8,6 +8,8 @@ class Tab
|
|||
{
|
||||
public \GtkBox $box;
|
||||
|
||||
public \GtkWindow $window;
|
||||
|
||||
public \Yggverse\Yoda\Box\Menu $menu;
|
||||
public \Yggverse\Yoda\Box\Navigation $navigation;
|
||||
public \Yggverse\Yoda\Label\Content $content;
|
||||
|
|
@ -18,8 +20,12 @@ class Tab
|
|||
public object $config;
|
||||
|
||||
public function __construct(
|
||||
\GtkWindow $window,
|
||||
string $name = 'boxTab'
|
||||
) {
|
||||
// Init window
|
||||
$this->window = $window;
|
||||
|
||||
// Init config
|
||||
$this->config = \Yggverse\Yoda\Model\File::getConfig();
|
||||
|
||||
|
|
@ -195,6 +201,20 @@ class Tab
|
|||
$response->getBody()
|
||||
);
|
||||
|
||||
$body = new \Yggverse\Gemini\Gemtext\Body(
|
||||
$response->getBody()
|
||||
);
|
||||
|
||||
if ($h1 = $body->getH1())
|
||||
{
|
||||
$this->window->set_title(
|
||||
sprintf(
|
||||
'%s - Yoda',
|
||||
empty($h1[0]) ? $address->getHost() : $h1[0]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$this->tray->label->set_text(
|
||||
sprintf(
|
||||
'%s | %s | %d bytes | %s seconds',
|
||||
|
|
|
|||
|
|
@ -61,7 +61,9 @@ $window->connect(
|
|||
}
|
||||
);
|
||||
|
||||
$tab = new \Yggverse\Yoda\Box\Tab();
|
||||
$tab = new \Yggverse\Yoda\Box\Tab(
|
||||
$window
|
||||
);
|
||||
|
||||
$window->add(
|
||||
$tab->box
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue