From 2b1b2d8b1afc0543b3132afcb3c4efea0b68416a Mon Sep 17 00:00:00 2001 From: yggverse Date: Sun, 14 Apr 2024 08:18:59 +0300 Subject: [PATCH] add gemtext links support --- src/Entity/Tab/Page.php | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/Entity/Tab/Page.php b/src/Entity/Tab/Page.php index c5d80f2e..886b07ad 100644 --- a/src/Entity/Tab/Page.php +++ b/src/Entity/Tab/Page.php @@ -259,6 +259,42 @@ class Page 0 ); + $this->content->connect( + 'activate-link', + function ($label, $href) + { + $address = new \Yggverse\Net\Address( + $href + ); + + if ($address->isRelative()) + { + $base = new \Yggverse\Net\Address( + $this->address->get_text() + ); + + if ($absolute = $address->getAbsolute($base)) + { + $this->open( + $absolute + ); + } + + else + { + throw new Exception(); // @TODO + } + } + + else + { + $this->open( + $address->get() + ); + } + } + ); + // Compose footer $this->footer = new \GtkBox( \GtkOrientation::HORIZONTAL