diff --git a/src/Box/Tab.php b/src/Box/Tab.php index 37f2a2d..75965cb 100644 --- a/src/Box/Tab.php +++ b/src/Box/Tab.php @@ -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', diff --git a/src/Yoda.php b/src/Yoda.php index 0975621..8b92dc3 100644 --- a/src/Yoda.php +++ b/src/Yoda.php @@ -61,7 +61,9 @@ $window->connect( } ); -$tab = new \Yggverse\Yoda\Box\Tab(); +$tab = new \Yggverse\Yoda\Box\Tab( + $window +); $window->add( $tab->box