From 6b91591aa56cb788a838083ab92a2971ad9ba066 Mon Sep 17 00:00:00 2001 From: yggverse Date: Sun, 4 Aug 2024 01:02:18 +0300 Subject: [PATCH] implement auth navbar button --- src/Entity/Browser/Container/Page/Navbar.php | 11 +++++ .../Browser/Container/Page/Navbar/Auth.php | 44 +++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 src/Entity/Browser/Container/Page/Navbar/Auth.php diff --git a/src/Entity/Browser/Container/Page/Navbar.php b/src/Entity/Browser/Container/Page/Navbar.php index b5e4c806..c782e67b 100644 --- a/src/Entity/Browser/Container/Page/Navbar.php +++ b/src/Entity/Browser/Container/Page/Navbar.php @@ -18,6 +18,7 @@ class Navbar public Page $page; // Requirements + public Navbar\Auth $auth; public Navbar\Base $base; public Navbar\Bookmark $bookmark; public Navbar\History $history; @@ -106,12 +107,22 @@ class Navbar $this->bookmark->gtk ); + // Append auth button + $this->auth = new Navbar\Auth( + $this + ); + + $this->gtk->add( + $this->auth->gtk + ); + // Render $this->gtk->show(); } public function refresh() { + $this->auth->refresh(); $this->base->refresh(); $this->bookmark->refresh(); $this->history->refresh(); diff --git a/src/Entity/Browser/Container/Page/Navbar/Auth.php b/src/Entity/Browser/Container/Page/Navbar/Auth.php new file mode 100644 index 00000000..24cf4239 --- /dev/null +++ b/src/Entity/Browser/Container/Page/Navbar/Auth.php @@ -0,0 +1,44 @@ +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' + ) + ); + } +} \ No newline at end of file