mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 17:45:28 +00:00
implement auth navbar button
This commit is contained in:
parent
7e329b8b8a
commit
6b91591aa5
2 changed files with 55 additions and 0 deletions
|
|
@ -18,6 +18,7 @@ class Navbar
|
||||||
public Page $page;
|
public Page $page;
|
||||||
|
|
||||||
// Requirements
|
// Requirements
|
||||||
|
public Navbar\Auth $auth;
|
||||||
public Navbar\Base $base;
|
public Navbar\Base $base;
|
||||||
public Navbar\Bookmark $bookmark;
|
public Navbar\Bookmark $bookmark;
|
||||||
public Navbar\History $history;
|
public Navbar\History $history;
|
||||||
|
|
@ -106,12 +107,22 @@ class Navbar
|
||||||
$this->bookmark->gtk
|
$this->bookmark->gtk
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Append auth button
|
||||||
|
$this->auth = new Navbar\Auth(
|
||||||
|
$this
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->gtk->add(
|
||||||
|
$this->auth->gtk
|
||||||
|
);
|
||||||
|
|
||||||
// Render
|
// Render
|
||||||
$this->gtk->show();
|
$this->gtk->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function refresh()
|
public function refresh()
|
||||||
{
|
{
|
||||||
|
$this->auth->refresh();
|
||||||
$this->base->refresh();
|
$this->base->refresh();
|
||||||
$this->bookmark->refresh();
|
$this->bookmark->refresh();
|
||||||
$this->history->refresh();
|
$this->history->refresh();
|
||||||
|
|
|
||||||
44
src/Entity/Browser/Container/Page/Navbar/Auth.php
Normal file
44
src/Entity/Browser/Container/Page/Navbar/Auth.php
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Yggverse\Yoda\Entity\Browser\Container\Page\Navbar;
|
||||||
|
|
||||||
|
use \GtkButton;
|
||||||
|
|
||||||
|
use \Yggverse\Yoda\Abstract\Entity\Browser\Container\Page\Navbar\Button;
|
||||||
|
|
||||||
|
class Auth extends Button
|
||||||
|
{
|
||||||
|
// Defaults
|
||||||
|
public const IMAGE = 'avatar-default-symbolic';
|
||||||
|
public const LABEL = 'Auth';
|
||||||
|
public const TOOLTIP = 'Select identity';
|
||||||
|
|
||||||
|
protected function _onCLick(
|
||||||
|
GtkButton $entity
|
||||||
|
): void
|
||||||
|
{
|
||||||
|
// Show auth dialog
|
||||||
|
if ($this->navbar->page->auth->dialog())
|
||||||
|
{
|
||||||
|
// Update page
|
||||||
|
$this->navbar->page->update(
|
||||||
|
false
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function refresh(): void
|
||||||
|
{
|
||||||
|
// Activate on feature supported by request protocol
|
||||||
|
$this->gtk->set_sensitive(
|
||||||
|
boolval(
|
||||||
|
parse_url(
|
||||||
|
$this->navbar->request->getValue(),
|
||||||
|
PHP_URL_SCHEME
|
||||||
|
) == 'gemini'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue