|
|
@ -29,6 +29,8 @@ class Page |
|
|
|
public Page\Content $content; |
|
|
|
public Page\Content $content; |
|
|
|
public Page\Response $response; |
|
|
|
public Page\Response $response; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ?Connection $connection = null; |
|
|
|
|
|
|
|
|
|
|
|
public function __construct( |
|
|
|
public function __construct( |
|
|
|
Container $container |
|
|
|
Container $container |
|
|
|
) { |
|
|
|
) { |
|
|
@ -165,13 +167,20 @@ class Page |
|
|
|
// Hide response form |
|
|
|
// Hide response form |
|
|
|
$this->response->hide(); |
|
|
|
$this->response->hide(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Drop previous connection |
|
|
|
|
|
|
|
if ($this->connection) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// Free memory |
|
|
|
|
|
|
|
$this->connection->close(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Update content using multi-protocol driver |
|
|
|
// Update content using multi-protocol driver |
|
|
|
$connection = new Connection( |
|
|
|
$this->connection = new Connection( |
|
|
|
$this->container->browser->database |
|
|
|
$this->container->browser->database |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
// Async request |
|
|
|
// Async request |
|
|
|
$connection->request( |
|
|
|
$this->connection->request( |
|
|
|
$this->navbar->request->getValue(), |
|
|
|
$this->navbar->request->getValue(), |
|
|
|
$timeout |
|
|
|
$timeout |
|
|
|
); |
|
|
|
); |
|
|
@ -182,10 +191,10 @@ class Page |
|
|
|
// Listen response |
|
|
|
// Listen response |
|
|
|
Gtk::timeout_add( |
|
|
|
Gtk::timeout_add( |
|
|
|
$refresh, |
|
|
|
$refresh, |
|
|
|
function() use ($connection, $expire, $history) |
|
|
|
function() use ($expire, $history) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Redirect requested |
|
|
|
// Redirect requested |
|
|
|
if ($location = $connection->getRedirect()) |
|
|
|
if ($location = $this->connection->getRedirect()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Follow |
|
|
|
// Follow |
|
|
|
$this->open( |
|
|
|
$this->open( |
|
|
@ -195,20 +204,17 @@ class Page |
|
|
|
// Hide progressbar |
|
|
|
// Hide progressbar |
|
|
|
$this->progressbar->hide(); |
|
|
|
$this->progressbar->hide(); |
|
|
|
|
|
|
|
|
|
|
|
// Free shared memory pool |
|
|
|
|
|
|
|
$connection->close(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return false; // stop |
|
|
|
return false; // stop |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Response form requested |
|
|
|
// Response form requested |
|
|
|
if ($request = $connection->getRequest()) |
|
|
|
if ($request = $this->connection->getRequest()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Update title |
|
|
|
// Update title |
|
|
|
$this->title->set( |
|
|
|
$this->title->set( |
|
|
|
$connection->getTitle(), |
|
|
|
$this->connection->getTitle(), |
|
|
|
$connection->getSubtitle(), |
|
|
|
$this->connection->getSubtitle(), |
|
|
|
$connection->getTooltip() |
|
|
|
$this->connection->getTooltip() |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
// Refresh header by new title if current page is active |
|
|
|
// Refresh header by new title if current page is active |
|
|
@ -229,20 +235,17 @@ class Page |
|
|
|
// Hide progressbar |
|
|
|
// Hide progressbar |
|
|
|
$this->progressbar->hide(); |
|
|
|
$this->progressbar->hide(); |
|
|
|
|
|
|
|
|
|
|
|
// Free shared memory pool |
|
|
|
|
|
|
|
$connection->close(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return false; // stop |
|
|
|
return false; // stop |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Stop event loop on request completed |
|
|
|
// Stop event loop on request completed |
|
|
|
if ($connection->isCompleted()) |
|
|
|
if ($this->connection->isCompleted()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Update title |
|
|
|
// Update title |
|
|
|
$this->title->set( |
|
|
|
$this->title->set( |
|
|
|
$connection->getTitle(), |
|
|
|
$this->connection->getTitle(), |
|
|
|
$connection->getSubtitle(), |
|
|
|
$this->connection->getSubtitle(), |
|
|
|
$connection->getTooltip() |
|
|
|
$this->connection->getTooltip() |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
// Refresh header by new title if current page is active |
|
|
|
// Refresh header by new title if current page is active |
|
|
@ -256,16 +259,13 @@ class Page |
|
|
|
|
|
|
|
|
|
|
|
// Update content |
|
|
|
// Update content |
|
|
|
$this->content->set( |
|
|
|
$this->content->set( |
|
|
|
$connection->getMime(), |
|
|
|
$this->connection->getMime(), |
|
|
|
$connection->getData() |
|
|
|
$this->connection->getData() |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
// Hide progressbar |
|
|
|
// Hide progressbar |
|
|
|
$this->progressbar->hide(); |
|
|
|
$this->progressbar->hide(); |
|
|
|
|
|
|
|
|
|
|
|
// Free shared memory pool |
|
|
|
|
|
|
|
$connection->close(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Update history |
|
|
|
// Update history |
|
|
|
if ($history) |
|
|
|
if ($history) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -317,9 +317,6 @@ class Page |
|
|
|
// Hide progressbar |
|
|
|
// Hide progressbar |
|
|
|
$this->progressbar->hide(); |
|
|
|
$this->progressbar->hide(); |
|
|
|
|
|
|
|
|
|
|
|
// Free shared memory pool |
|
|
|
|
|
|
|
$connection->close(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Stop |
|
|
|
// Stop |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|