From c5b62addd4cf95c0956e0c12c8f1b8b1b5c34812 Mon Sep 17 00:00:00 2001 From: yggverse Date: Sat, 6 Jul 2024 03:29:39 +0300 Subject: [PATCH] remove HeaderBar abstraction --- src/Abstract/Entity/HeaderBar.php | 46 --------------------------- src/Entity/Browser/Header.php | 38 +++++++++++++++++++++- src/Entity/Browser/History/Header.php | 38 +++++++++++++++++++++- 3 files changed, 74 insertions(+), 48 deletions(-) delete mode 100644 src/Abstract/Entity/HeaderBar.php diff --git a/src/Abstract/Entity/HeaderBar.php b/src/Abstract/Entity/HeaderBar.php deleted file mode 100644 index ce8ba6e6..00000000 --- a/src/Abstract/Entity/HeaderBar.php +++ /dev/null @@ -1,46 +0,0 @@ -gtk = new \GtkHeaderBar; - - $this->gtk->set_show_close_button( - $this->_actions - ); - - $this->gtk->set_title( - $this->_title - ); - - $this->gtk->set_subtitle( - $this->_subtitle - ); - } - - public function setTitle( - ?string $title = null - ): void - { - $this->gtk->set_title( - is_null($title) ? $this->_title : sprintf( - '%s - %s', - trim( - $title - ), - $this->_title - ) - ); - } -} \ No newline at end of file diff --git a/src/Entity/Browser/Header.php b/src/Entity/Browser/Header.php index f2998e64..7a7770fa 100644 --- a/src/Entity/Browser/Header.php +++ b/src/Entity/Browser/Header.php @@ -4,7 +4,43 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser; -class Header extends \Yggverse\Yoda\Abstract\Entity\HeaderBar +class Header { + public \GtkHeaderBar $gtk; + + protected bool $_actions = true; protected string $_title = 'Yoda'; + protected string $_subtitle = ''; + + public function __construct() + { + $this->gtk = new \GtkHeaderBar; + + $this->gtk->set_show_close_button( + $this->_actions + ); + + $this->gtk->set_title( + $this->_title + ); + + $this->gtk->set_subtitle( + $this->_subtitle + ); + } + + public function setTitle( + ?string $title = null + ): void + { + $this->gtk->set_title( + is_null($title) ? $this->_title : sprintf( + '%s - %s', + trim( + $title + ), + $this->_title + ) + ); + } } \ No newline at end of file diff --git a/src/Entity/Browser/History/Header.php b/src/Entity/Browser/History/Header.php index 86044c41..d7fec8c0 100644 --- a/src/Entity/Browser/History/Header.php +++ b/src/Entity/Browser/History/Header.php @@ -4,7 +4,43 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser\History; -class Header extends \Yggverse\Yoda\Abstract\Entity\HeaderBar +class Header { + public \GtkHeaderBar $gtk; + + protected bool $_actions = true; protected string $_title = 'History - Yoda'; + protected string $_subtitle = ''; + + public function __construct() + { + $this->gtk = new \GtkHeaderBar; + + $this->gtk->set_show_close_button( + $this->_actions + ); + + $this->gtk->set_title( + $this->_title + ); + + $this->gtk->set_subtitle( + $this->_subtitle + ); + } + + public function setTitle( + ?string $title = null + ): void + { + $this->gtk->set_title( + is_null($title) ? $this->_title : sprintf( + '%s - %s', + trim( + $title + ), + $this->_title + ) + ); + } } \ No newline at end of file