Browse Source

render page on connection completed only

PHP-GTK3
yggverse 2 months ago
parent
commit
f05db4b291
  1. 66
      src/Entity/Browser/Container/Page.php

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

@ -181,52 +181,52 @@ class Page
return false; // stop return false; // stop
} }
// Update title // Stop event loop on request completed
$this->title->set( if ($connection->isCompleted())
$connection->getTitle(),
$connection->getSubtitle(),
$connection->getTooltip()
);
// Update content
switch ($connection->getMime())
{ {
case 'text/gemini': // Update title
$this->title->set(
$connection->getTitle(),
$connection->getSubtitle(),
$connection->getTooltip()
);
$title = null; // Update content
switch ($connection->getMime())
{
case 'text/gemini':
$this->content->setGemtext( $title = null;
(string) $connection->getData(),
$title
);
if ($title) $this->content->setGemtext(
{ (string) $connection->getData(),
$this->title->setValue(
$title $title
); );
}
break; if ($title)
{
$this->title->setValue(
$title
);
}
case 'text/plain': break;
$this->content->setPlain( case 'text/plain':
(string) $connection->getData()
);
break; $this->content->setPlain(
(string) $connection->getData()
);
default: break;
throw new \Exception( default:
_('MIME type not supported')
); throw new \Exception(
} _('MIME type not supported')
);
}
// Stop event loop on request completed
if ($connection->isCompleted())
{
// Hide progressbar // Hide progressbar
$this->progressbar->hide(); $this->progressbar->hide();

Loading…
Cancel
Save