Browse Source

refresh header by new title if current page is active

PHP-GTK3
yggverse 4 months ago
parent
commit
aa3de2980c
  1. 26
      src/Entity/Browser/Container/Page.php
  2. 13
      src/Entity/Browser/Container/Page/Content.php

26
src/Entity/Browser/Container/Page.php

@ -184,6 +184,15 @@ class Page
$connection->getTooltip() $connection->getTooltip()
); );
// Refresh header by new title if current page is active
if ($this == $this->container->tab->getPage())
{
$this->container->browser->header->setTitle(
$this->title->getValue(),
$this->title->getSubtitle()
);
}
// Show response form // Show response form
$this->response->show( $this->response->show(
$request['placeholder'], $request['placeholder'],
@ -209,6 +218,15 @@ class Page
$connection->getTooltip() $connection->getTooltip()
); );
// Refresh header by new title if current page is active
if ($this == $this->container->tab->getPage())
{
$this->container->browser->header->setTitle(
$this->title->getValue(),
$this->title->getSubtitle()
);
}
// Update content // Update content
$this->content->set( $this->content->set(
$connection->getMime(), $connection->getMime(),
@ -233,6 +251,14 @@ class Page
_('Timeout') _('Timeout')
); );
// Refresh header by new title if current page is active
if ($this == $this->container->tab->getPage())
{
$this->container->browser->header->setTitle(
$this->title->getValue()
);
}
// Update content // Update content
$this->content->set( $this->content->set(
Filesystem::MIME_TEXT_PLAIN, Filesystem::MIME_TEXT_PLAIN,

13
src/Entity/Browser/Container/Page/Content.php

@ -81,11 +81,22 @@ class Content
$title $title
); );
if ($title) // use gemtext title on available // Update title by gemtext H1 tag (on available)
if ($title)
{ {
// Set new title
$this->page->title->setValue( $this->page->title->setValue(
$title $title
); );
// Refresh header by new title if current page is active
if ($this->page == $this->page->container->tab->getPage())
{
$this->page->container->browser->header->setTitle(
$this->page->title->getValue(),
$this->page->title->getSubtitle()
);
}
} }
break; break;

Loading…
Cancel
Save