From a4406499ddc59b01f6c64b75a3ff50fe575bee25 Mon Sep 17 00:00:00 2001 From: yggverse Date: Sat, 3 Aug 2024 20:07:36 +0300 Subject: [PATCH] fix identity name entry --- src/Entity/Browser/Container/Page/Auth.php | 8 ++++++-- .../Container/Page/Auth/Option/Identity.php | 8 +++----- .../Page/Auth/Option/Identity/Name.php | 17 ++++++++++++----- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/Entity/Browser/Container/Page/Auth.php b/src/Entity/Browser/Container/Page/Auth.php index 85fe7a3b..1338b3c9 100644 --- a/src/Entity/Browser/Container/Page/Auth.php +++ b/src/Entity/Browser/Container/Page/Auth.php @@ -92,6 +92,10 @@ class Auth Auth\Option\Identity::ID_CRT_NEW ); + $this->_options[ + Auth\Option\Identity::ID_CRT_NEW + ]->useName(); + // Search database for auth records foreach ($this->page->container->browser->database->auth->like( sprintf( @@ -140,7 +144,7 @@ class Auth { // Append name entry after new identity option $content->add( - $option->name, + $option->name->gtk, true, true, 0 @@ -203,7 +207,7 @@ class Auth $this->page->container->browser->database->identity->add( $identity->crt(), $identity->key(), - $this->_name->get_text() ? $this->_name->get_text() : null + $option->name->getValue() ), $this->page->navbar->request->getValue() ); diff --git a/src/Entity/Browser/Container/Page/Auth/Option/Identity.php b/src/Entity/Browser/Container/Page/Auth/Option/Identity.php index 2b4ce7ba..f0beded3 100644 --- a/src/Entity/Browser/Container/Page/Auth/Option/Identity.php +++ b/src/Entity/Browser/Container/Page/Auth/Option/Identity.php @@ -98,12 +98,10 @@ class Identity } } - public function setName( - string $label + public function useName( + bool $value = true ): void { - $this->name = new Identity\Name( - $this - ); + $this->name = $value ? new Identity\Name($this) : null; } } \ No newline at end of file diff --git a/src/Entity/Browser/Container/Page/Auth/Option/Identity/Name.php b/src/Entity/Browser/Container/Page/Auth/Option/Identity/Name.php index 7eeb6d32..da81c174 100644 --- a/src/Entity/Browser/Container/Page/Auth/Option/Identity/Name.php +++ b/src/Entity/Browser/Container/Page/Auth/Option/Identity/Name.php @@ -6,6 +6,8 @@ namespace Yggverse\Yoda\Entity\Browser\Container\Page\Auth\Option\Identity; use \GtkEntry; +use Yggverse\Yoda\Entity\Browser\Container\Page\Auth\Option\Identity; + class Name { // GTK @@ -28,26 +30,31 @@ class Name // Init GTK $this->gtk = new GtkEntry; - $this->_name->set_alignment( + $this->gtk->set_alignment( $this::ALIGNMENT ); - $this->_name->set_placeholder_text( + $this->gtk->set_placeholder_text( _($this::PLACEHOLDER) ); - $this->_name->set_margin_start( + $this->gtk->set_margin_start( $this::MARGIN ); - $this->_name->set_margin_end( + $this->gtk->set_margin_end( $this::MARGIN ); - $this->_name->set_margin_bottom( + $this->gtk->set_margin_bottom( $this::MARGIN ); $this->gtk->show(); } + + public function getValue(): ?string + { + return $this->gtk->get_text(); + } } \ No newline at end of file