|
|
@ -7,6 +7,7 @@ namespace Yggverse\Yoda\Entity\Browser\Container\Page\Content; |
|
|
|
use \Exception; |
|
|
|
use \Exception; |
|
|
|
use \Gdk; |
|
|
|
use \Gdk; |
|
|
|
use \GdkEvent; |
|
|
|
use \GdkEvent; |
|
|
|
|
|
|
|
use \Gtk; |
|
|
|
use \GtkLabel; |
|
|
|
use \GtkLabel; |
|
|
|
use \Pango; |
|
|
|
use \Pango; |
|
|
|
|
|
|
|
|
|
|
@ -17,17 +18,49 @@ use \Yggverse\Yoda\Model\Gtk\Pango\Markup\Gemtext as Markup; |
|
|
|
class Gemtext extends \Yggverse\Yoda\Abstract\Entity\Browser\Container\Page\Content\Markup |
|
|
|
class Gemtext extends \Yggverse\Yoda\Abstract\Entity\Browser\Container\Page\Content\Markup |
|
|
|
{ |
|
|
|
{ |
|
|
|
public function set( |
|
|
|
public function set( |
|
|
|
string $source, |
|
|
|
string $value |
|
|
|
string | null &$title = null |
|
|
|
|
|
|
|
): void |
|
|
|
): void |
|
|
|
{ |
|
|
|
{ |
|
|
|
$this->gtk->set_markup( |
|
|
|
Gtk::timeout_add( // await for renderer dimensions init |
|
|
|
Markup::format( |
|
|
|
1, function(?string $title = null) use ($value) |
|
|
|
$this->_source = $source, |
|
|
|
{ |
|
|
|
$this->content->page->navbar->request->getValue(), |
|
|
|
if ($this->content->page->content->gtk->get_allocated_width() > Markup::WRAP_WIDTH) |
|
|
|
$this->content->page->content->gtk->get_allocated_width(), |
|
|
|
{ |
|
|
|
$title |
|
|
|
$this->gtk->set_markup( |
|
|
|
) |
|
|
|
Markup::format( |
|
|
|
|
|
|
|
$this->_source = $value, |
|
|
|
|
|
|
|
$this->content->page->navbar->request->getValue(), |
|
|
|
|
|
|
|
$this->content->page->content->gtk->get_allocated_width(), |
|
|
|
|
|
|
|
$title |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Update title by gemtext H1 tag (on available) |
|
|
|
|
|
|
|
if ($title) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// Set new title |
|
|
|
|
|
|
|
$this->content->page->title->setValue( |
|
|
|
|
|
|
|
$title |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Update tooltip |
|
|
|
|
|
|
|
$this->content->page->title->setTooltip( |
|
|
|
|
|
|
|
$title |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Refresh header by new title if current page is active |
|
|
|
|
|
|
|
if ($this->content->page === $this->content->page->container->tab->get()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
$this->content->page->container->browser->header->setTitle( |
|
|
|
|
|
|
|
$this->content->page->title->getValue(), |
|
|
|
|
|
|
|
$this->content->page->title->getSubtitle() |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return false; // stop |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|