From 107718022d2c6fb6adde5ee5b3faae1f6eb4f804 Mon Sep 17 00:00:00 2001 From: yggverse Date: Wed, 24 Jul 2024 19:52:02 +0300 Subject: [PATCH] define dependencies ns --- src/Entity/Browser/Container/Page.php | 18 ++++++--- src/Entity/Browser/Container/Page/Content.php | 7 +++- .../Container/Page/Content/Gemtext.php | 33 ++++++++++----- .../Browser/Container/Page/Content/Image.php | 6 ++- .../Browser/Container/Page/Content/Plain.php | 9 +++-- .../Container/Page/Content/Viewport.php | 7 +++- src/Entity/Browser/Container/Page/Navbar.php | 10 +++-- .../Browser/Container/Page/Navbar/Base.php | 4 +- .../Container/Page/Navbar/Bookmark.php | 4 +- .../Browser/Container/Page/Navbar/History.php | 16 +++++--- .../Container/Page/Navbar/History/Back.php | 4 +- .../Container/Page/Navbar/History/Forward.php | 4 +- .../Browser/Container/Page/Navbar/Request.php | 20 ++++++---- .../Browser/Container/Page/Navbar/Update.php | 4 +- .../Browser/Container/Page/Progressbar.php | 12 ++++-- .../Browser/Container/Page/Response.php | 10 +++-- .../Browser/Container/Page/Response/Query.php | 15 ++++--- .../Browser/Container/Page/Response/Send.php | 4 +- src/Entity/Browser/Container/Page/Title.php | 7 +++- src/Entity/Browser/Container/Tab.php | 40 +++++++++++-------- src/Entity/Browser/Header/Tray.php | 10 +++-- src/Entity/Browser/Header/Tray/Navigation.php | 7 +++- src/Entity/Browser/Header/Tray/Tab.php | 18 ++++++--- 23 files changed, 179 insertions(+), 90 deletions(-) diff --git a/src/Entity/Browser/Container/Page.php b/src/Entity/Browser/Container/Page.php index 10985d8b..cf6b1d7d 100644 --- a/src/Entity/Browser/Container/Page.php +++ b/src/Entity/Browser/Container/Page.php @@ -4,6 +4,11 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser\Container; +use \Exception; +use \Gtk; +use \GtkBox; +use \GtkOrientation; + use \Yggverse\Yoda\Entity\Browser\Container; use \Yggverse\Yoda\Model\Connection; @@ -11,7 +16,8 @@ use \Yggverse\Yoda\Model\Filesystem; class Page { - public \GtkBox $gtk; + // GTK + public GtkBox $gtk; // Dependencies public Container $container; @@ -30,8 +36,8 @@ class Page $this->container = $container; // Init container - $this->gtk = new \GtkBox( - \GtkOrientation::VERTICAL + $this->gtk = new GtkBox( + GtkOrientation::VERTICAL ); // Init title @@ -106,7 +112,7 @@ class Page if ($focus) { - \Gtk::timeout_add( + Gtk::timeout_add( 100, function() { @@ -142,7 +148,7 @@ class Page if (empty($this->navbar->request->getValue())) { // return; - throw new \Exception; + throw new Exception; } // Update title @@ -174,7 +180,7 @@ class Page $expire = time() + $timeout; // Listen response - \Gtk::timeout_add( + Gtk::timeout_add( $refresh, function() use ($connection, $expire, $history) { diff --git a/src/Entity/Browser/Container/Page/Content.php b/src/Entity/Browser/Container/Page/Content.php index 0513d1de..fc40c22c 100644 --- a/src/Entity/Browser/Container/Page/Content.php +++ b/src/Entity/Browser/Container/Page/Content.php @@ -4,13 +4,16 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser\Container\Page; +use \GtkScrolledWindow; + use \Yggverse\Yoda\Entity\Browser\Container\Page; use \Yggverse\Yoda\Model\Filesystem; class Content { - public \GtkScrolledWindow $gtk; + // GTK + public GtkScrolledWindow $gtk; // Dependencies public Page $page; @@ -30,7 +33,7 @@ class Content $this->page = $page; // Init scrolled window container - $this->gtk = new \GtkScrolledWindow; + $this->gtk = new GtkScrolledWindow; $this->gtk->set_margin_start( $this::MARGIN diff --git a/src/Entity/Browser/Container/Page/Content/Gemtext.php b/src/Entity/Browser/Container/Page/Content/Gemtext.php index fd097008..1aaa372d 100644 --- a/src/Entity/Browser/Container/Page/Content/Gemtext.php +++ b/src/Entity/Browser/Container/Page/Content/Gemtext.php @@ -4,9 +4,20 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser\Container\Page\Content; +use \Exception; +use \GdkEvent; +use \GtkLabel; + use \Yggverse\Yoda\Abstract\Entity\Browser\Container\Page\Content\Markup; use \Yggverse\Gemtext\Document; +use \Yggverse\Gemtext\Entity\Code; +use \Yggverse\Gemtext\Entity\Header; +use \Yggverse\Gemtext\Entity\Link; +use \Yggverse\Gemtext\Entity\Listing; +use \Yggverse\Gemtext\Entity\Quote; +use \Yggverse\Gemtext\Entity\Text; + use \Yggverse\Net\Address; class Gemtext extends Markup @@ -27,7 +38,7 @@ class Gemtext extends Markup { switch (true) { - case $entity instanceof \Yggverse\Gemtext\Entity\Code: + case $entity instanceof Code: if ($entity->isInline()) { @@ -48,7 +59,7 @@ class Gemtext extends Markup break; - case $entity instanceof \Yggverse\Gemtext\Entity\Header: + case $entity instanceof Header: if ($preformatted) { @@ -109,13 +120,13 @@ class Gemtext extends Markup break; default: - throw new \Exception; + throw new Exception; } } break; - case $entity instanceof \Yggverse\Gemtext\Entity\Link: + case $entity instanceof Link: if ($preformatted) { @@ -149,7 +160,7 @@ class Gemtext extends Markup break; - case $entity instanceof \Yggverse\Gemtext\Entity\Listing: + case $entity instanceof Listing: if ($preformatted) { @@ -174,7 +185,7 @@ class Gemtext extends Markup break; - case $entity instanceof \Yggverse\Gemtext\Entity\Quote: + case $entity instanceof Quote: if ($preformatted) { @@ -199,7 +210,7 @@ class Gemtext extends Markup break; - case $entity instanceof \Yggverse\Gemtext\Entity\Text: + case $entity instanceof Text: if ($preformatted) { @@ -223,7 +234,7 @@ class Gemtext extends Markup default: - throw new \Exception; + throw new Exception; } } @@ -236,7 +247,7 @@ class Gemtext extends Markup } protected function _onActivateLink( - \GtkLabel $label, + GtkLabel $label, string $href ): bool { @@ -270,8 +281,8 @@ class Gemtext extends Markup } protected function _onButtonPressEvent( - \GtkLabel $label, - \GdkEvent $event + GtkLabel $label, + GdkEvent $event ): bool { // Markup container has focus event disabled (hidden cursor position) diff --git a/src/Entity/Browser/Container/Page/Content/Image.php b/src/Entity/Browser/Container/Page/Content/Image.php index 77a0fb0f..564af8c4 100644 --- a/src/Entity/Browser/Container/Page/Content/Image.php +++ b/src/Entity/Browser/Container/Page/Content/Image.php @@ -4,11 +4,13 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser\Container\Page\Content; +use \GtkImage; + use \Yggverse\Yoda\Entity\Browser\Container\Page\Content; class Image { - public \GtkImage $gtk; + public GtkImage $gtk; // Dependencies public Content $content; @@ -20,7 +22,7 @@ class Image $this->content = $content; // Init image object - $this->gtk = new \GtkImage; + $this->gtk = new GtkImage; } public function set( diff --git a/src/Entity/Browser/Container/Page/Content/Plain.php b/src/Entity/Browser/Container/Page/Content/Plain.php index 60156671..08265127 100644 --- a/src/Entity/Browser/Container/Page/Content/Plain.php +++ b/src/Entity/Browser/Container/Page/Content/Plain.php @@ -4,6 +4,9 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser\Container\Page\Content; +use \GdkEvent; +use \GtkLabel; + use \Yggverse\Yoda\Abstract\Entity\Browser\Container\Page\Content\Markup; class Plain extends Markup @@ -23,7 +26,7 @@ class Plain extends Markup } protected function _onActivateLink( - \GtkLabel $label, + GtkLabel $label, string $href ): bool { @@ -31,8 +34,8 @@ class Plain extends Markup } protected function _onButtonPressEvent( - \GtkLabel $label, - \GdkEvent $event + GtkLabel $label, + GdkEvent $event ): bool { // Markup container has focus event disabled (hidden cursor position) diff --git a/src/Entity/Browser/Container/Page/Content/Viewport.php b/src/Entity/Browser/Container/Page/Content/Viewport.php index d9f77e4a..77258944 100644 --- a/src/Entity/Browser/Container/Page/Content/Viewport.php +++ b/src/Entity/Browser/Container/Page/Content/Viewport.php @@ -4,11 +4,14 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser\Container\Page\Content; +use \GtkViewport; + use \Yggverse\Yoda\Entity\Browser\Container\Page\Content; class Viewport { - public \GtkViewport $gtk; + // GTK + public GtkViewport $gtk; // Dependencies public Content $content; @@ -23,7 +26,7 @@ class Viewport $this->content = $content; // Init viewport - $this->gtk = new \GtkViewport; + $this->gtk = new GtkViewport; } public function set( diff --git a/src/Entity/Browser/Container/Page/Navbar.php b/src/Entity/Browser/Container/Page/Navbar.php index 66b824fb..b5e4c806 100644 --- a/src/Entity/Browser/Container/Page/Navbar.php +++ b/src/Entity/Browser/Container/Page/Navbar.php @@ -4,11 +4,15 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser\Container\Page; +use \GtkBox; +use \GtkOrientation; + use \Yggverse\Yoda\Entity\Browser\Container\Page; class Navbar { - public \GtkBox $gtk; + // GTK + public GtkBox $gtk; // Dependencies public Page $page; @@ -30,8 +34,8 @@ class Navbar $this->page = $page; // Init navbar - $this->gtk = new \GtkBox( - \GtkOrientation::HORIZONTAL + $this->gtk = new GtkBox( + GtkOrientation::HORIZONTAL ); $this->gtk->set_margin_top( diff --git a/src/Entity/Browser/Container/Page/Navbar/Base.php b/src/Entity/Browser/Container/Page/Navbar/Base.php index d506e2a4..a65be0b5 100644 --- a/src/Entity/Browser/Container/Page/Navbar/Base.php +++ b/src/Entity/Browser/Container/Page/Navbar/Base.php @@ -4,6 +4,8 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser\Container\Page\Navbar; +use \GtkButton; + class Base extends \Yggverse\Yoda\Abstract\Entity\Browser\Container\Page\Navbar\Button { public const IMAGE = 'go-home-symbolic'; @@ -11,7 +13,7 @@ class Base extends \Yggverse\Yoda\Abstract\Entity\Browser\Container\Page\Navbar\ public const TOOLTIP = 'Base'; protected function _onCLick( - \GtkButton $entity + GtkButton $entity ): void { $address = new \Yggverse\Net\Address( diff --git a/src/Entity/Browser/Container/Page/Navbar/Bookmark.php b/src/Entity/Browser/Container/Page/Navbar/Bookmark.php index 7b196096..a49f9f15 100644 --- a/src/Entity/Browser/Container/Page/Navbar/Bookmark.php +++ b/src/Entity/Browser/Container/Page/Navbar/Bookmark.php @@ -4,6 +4,8 @@ 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 Bookmark extends Button @@ -19,7 +21,7 @@ class Bookmark extends Button public const SENSITIVE = true; protected function _onCLick( - \GtkButton $entity + GtkButton $entity ): void { $this->setImage( diff --git a/src/Entity/Browser/Container/Page/Navbar/History.php b/src/Entity/Browser/Container/Page/Navbar/History.php index 0f03aee7..d2d7007d 100644 --- a/src/Entity/Browser/Container/Page/Navbar/History.php +++ b/src/Entity/Browser/Container/Page/Navbar/History.php @@ -4,13 +4,19 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser\Container\Page\Navbar; +use \Exception; +use \GtkButtonBox; +use \GtkButtonBoxStyle; +use \GtkOrientation; + use \Yggverse\Yoda\Entity\Browser\Container\Page\Navbar; use \Yggverse\Yoda\Model\History as Memory; class History { - public \GtkButtonBox $gtk; + // GTK + public GtkButtonBox $gtk; // Dependencies public Navbar $navbar; @@ -27,12 +33,12 @@ class History $this->navbar = $navbar; - $this->gtk = new \GtkButtonBox( - \GtkOrientation::HORIZONTAL + $this->gtk = new GtkButtonBox( + GtkOrientation::HORIZONTAL ); $this->gtk->set_layout( - \GtkButtonBoxStyle::EXPAND + GtkButtonBoxStyle::EXPAND ); $this->back = new History\Back( @@ -61,7 +67,7 @@ class History { if (empty($value)) { - throw new \Exception; + throw new Exception; } if ($value != $this->memory->getCurrent()) diff --git a/src/Entity/Browser/Container/Page/Navbar/History/Back.php b/src/Entity/Browser/Container/Page/Navbar/History/Back.php index d5bc0a1c..dc14601b 100644 --- a/src/Entity/Browser/Container/Page/Navbar/History/Back.php +++ b/src/Entity/Browser/Container/Page/Navbar/History/Back.php @@ -4,6 +4,8 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser\Container\Page\Navbar\History; +use \GtkButton; + use \Yggverse\Yoda\Abstract\Entity\Browser\Container\Page\Navbar\Button; class Back extends Button @@ -13,7 +15,7 @@ class Back extends Button public const TOOLTIP = 'Back'; protected function _onCLick( - \GtkButton $entity + GtkButton $entity ): void { if ($this->navbar->history->memory->getBack()) diff --git a/src/Entity/Browser/Container/Page/Navbar/History/Forward.php b/src/Entity/Browser/Container/Page/Navbar/History/Forward.php index fda1d1c7..8e13b2f2 100644 --- a/src/Entity/Browser/Container/Page/Navbar/History/Forward.php +++ b/src/Entity/Browser/Container/Page/Navbar/History/Forward.php @@ -4,6 +4,8 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser\Container\Page\Navbar\History; +use \GtkButton; + use \Yggverse\Yoda\Abstract\Entity\Browser\Container\Page\Navbar\Button; class Forward extends Button @@ -13,7 +15,7 @@ class Forward extends Button public const TOOLTIP = 'Forward'; protected function _onCLick( - \GtkButton $entity + GtkButton $entity ): void { if ($this->navbar->history->memory->getForward()) diff --git a/src/Entity/Browser/Container/Page/Navbar/Request.php b/src/Entity/Browser/Container/Page/Navbar/Request.php index 1f6e3748..1b90b628 100644 --- a/src/Entity/Browser/Container/Page/Navbar/Request.php +++ b/src/Entity/Browser/Container/Page/Navbar/Request.php @@ -4,6 +4,10 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser\Container\Page\Navbar; +use \GdkEvent; +use \Gtk; +use \GtkEntry; + use \Yggverse\Yoda\Abstract\Entity\Browser\Container\Page\Navbar\Entry; class Request extends Entry @@ -13,7 +17,7 @@ class Request extends Entry private ?int $_changed = null; protected function _onActivate( - \GtkEntry $entry + GtkEntry $entry ): void { if (empty($this->getValue())) @@ -29,8 +33,8 @@ class Request extends Entry } protected function _onKeyRelease( - \GtkEntry $entry, - \GdkEvent $event + GtkEntry $entry, + GdkEvent $event ): void { // Delegate @@ -40,7 +44,7 @@ class Request extends Entry } protected function _onChanged( - \GtkEntry $entry + GtkEntry $entry ): void { // Refresh navigation elements @@ -52,7 +56,7 @@ class Request extends Entry // Reset previous event if ($this->_changed) { - \Gtk::source_remove( + Gtk::source_remove( $this->_changed ); @@ -60,7 +64,7 @@ class Request extends Entry } // Wait for one second to apply act - $this->_changed = \Gtk::timeout_add( + $this->_changed = Gtk::timeout_add( 1000, function() { @@ -75,8 +79,8 @@ class Request extends Entry } protected function _onFocusOut( - \GtkEntry $entry, - \GdkEvent $event + GtkEntry $entry, + GdkEvent $event ): void {} } \ No newline at end of file diff --git a/src/Entity/Browser/Container/Page/Navbar/Update.php b/src/Entity/Browser/Container/Page/Navbar/Update.php index a777472e..5b52955b 100644 --- a/src/Entity/Browser/Container/Page/Navbar/Update.php +++ b/src/Entity/Browser/Container/Page/Navbar/Update.php @@ -4,6 +4,8 @@ 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 Update extends Button @@ -13,7 +15,7 @@ class Update extends Button public const TOOLTIP = 'Update'; protected function _onCLick( - \GtkButton $entity + GtkButton $entity ): void { $this->navbar->page->update(); diff --git a/src/Entity/Browser/Container/Page/Progressbar.php b/src/Entity/Browser/Container/Page/Progressbar.php index 78828e43..066fd005 100644 --- a/src/Entity/Browser/Container/Page/Progressbar.php +++ b/src/Entity/Browser/Container/Page/Progressbar.php @@ -4,11 +4,15 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser\Container\Page; +use \Gtk; +use \GtkProgressBar; + use \Yggverse\Yoda\Entity\Browser\Container\Page; class Progressbar { - public \GtkProgressBar $gtk; + // GTK + public GtkProgressBar $gtk; // Dependencies public Page $page; @@ -25,7 +29,7 @@ class Progressbar $this->page = $page; // Init container - $this->gtk = new \GtkProgressBar; + $this->gtk = new GtkProgressBar; /* Prevent global initiation $this->gtk->set_no_show_all( @@ -73,7 +77,7 @@ class Progressbar $this->gtk->set_fraction(0); // Begin iterator - \Gtk::timeout_add( + Gtk::timeout_add( $timeout, function() { @@ -108,7 +112,7 @@ class Progressbar ); // Begin iterator - \Gtk::timeout_add( + Gtk::timeout_add( $timeout, function() { diff --git a/src/Entity/Browser/Container/Page/Response.php b/src/Entity/Browser/Container/Page/Response.php index 72cdb5cd..e3b45e65 100644 --- a/src/Entity/Browser/Container/Page/Response.php +++ b/src/Entity/Browser/Container/Page/Response.php @@ -4,13 +4,17 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser\Container\Page; +use \GtkBox; +use \GtkOrientation; + use \Yggverse\Yoda\Entity\Browser\Container\Page; use \Yggverse\Net\Address; class Response { - public \GtkBox $gtk; + // GTK + public GtkBox $gtk; // Dependencies public Page $page; @@ -30,8 +34,8 @@ class Response $this->page = $page; // Init container - $this->gtk = new \GtkBox( - \GtkOrientation::HORIZONTAL + $this->gtk = new GtkBox( + GtkOrientation::HORIZONTAL ); $this->gtk->set_margin_top( diff --git a/src/Entity/Browser/Container/Page/Response/Query.php b/src/Entity/Browser/Container/Page/Response/Query.php index 454e87d5..34197c1e 100644 --- a/src/Entity/Browser/Container/Page/Response/Query.php +++ b/src/Entity/Browser/Container/Page/Response/Query.php @@ -4,6 +4,9 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser\Container\Page\Response; +use \GdkEvent; +use \GtkEntry; + use \Yggverse\Yoda\Entity\Browser\Container\Page\Response; class Query extends \Yggverse\Yoda\Abstract\Entity\Entry @@ -24,28 +27,28 @@ class Query extends \Yggverse\Yoda\Abstract\Entity\Entry } protected function _onActivate( - \GtkEntry $entry + GtkEntry $entry ): void { $this->response->send(); } protected function _onKeyRelease( - \GtkEntry $entry, - \GdkEvent $event + GtkEntry $entry, + GdkEvent $event ): void { $this->response->refresh(); } protected function _onChanged( - \GtkEntry $entry + GtkEntry $entry ): void {} protected function _onFocusOut( - \GtkEntry $entry, - \GdkEvent $event + GtkEntry $entry, + GdkEvent $event ): void {} diff --git a/src/Entity/Browser/Container/Page/Response/Send.php b/src/Entity/Browser/Container/Page/Response/Send.php index 3834c702..e535447a 100644 --- a/src/Entity/Browser/Container/Page/Response/Send.php +++ b/src/Entity/Browser/Container/Page/Response/Send.php @@ -4,6 +4,8 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser\Container\Page\Response; +use \GtkButton; + use \Yggverse\Yoda\Entity\Browser\Container\Page\Response; class Send extends \Yggverse\Yoda\Abstract\Entity\Button @@ -25,7 +27,7 @@ class Send extends \Yggverse\Yoda\Abstract\Entity\Button } protected function _onCLick( - \GtkButton $entity + GtkButton $entity ): void { $this->response->send(); diff --git a/src/Entity/Browser/Container/Page/Title.php b/src/Entity/Browser/Container/Page/Title.php index 5836cc90..58297e4e 100644 --- a/src/Entity/Browser/Container/Page/Title.php +++ b/src/Entity/Browser/Container/Page/Title.php @@ -4,11 +4,14 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser\Container\Page; +use \GtkLabel; + use \Yggverse\Yoda\Entity\Browser\Container\Page; class Title { - public \GtkLabel $gtk; + // GTK + public GtkLabel $gtk; // Extras public ?string $subtitle = null; @@ -30,7 +33,7 @@ class Title $this->page = $page; // Init container - $this->gtk = new \GtkLabel( + $this->gtk = new GtkLabel( $this::VALUE ); diff --git a/src/Entity/Browser/Container/Tab.php b/src/Entity/Browser/Container/Tab.php index e9ad687f..e13f24c8 100644 --- a/src/Entity/Browser/Container/Tab.php +++ b/src/Entity/Browser/Container/Tab.php @@ -4,11 +4,19 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser\Container; +use \Exception; +use \Gdk; +use \GdkEvent; +use \GtkEventBox; +use \GtkNotebook; +use \GtkWidget; + use \Yggverse\Yoda\Entity\Browser\Container; class Tab { - public \GtkNotebook $gtk; + // GTK + public GtkNotebook $gtk; // Dependencies public Container $container; @@ -27,7 +35,7 @@ class Tab $this->container = $container; // Init container - $this->gtk = new \GtkNotebook; + $this->gtk = new GtkNotebook; $this->gtk->set_scrollable( $this::SCROLLABLE @@ -51,8 +59,8 @@ class Tab $this->gtk->connect( 'switch-page', function ( - ?\GtkNotebook $self, - ?\GtkWidget $child, + ?GtkNotebook $self, + ?GtkWidget $child, int $page_num ) { // Update header bar title @@ -62,7 +70,7 @@ class Tab $page->title->getValue(), $page->title->getSubtitle() ); - } else throw new \Exception; + } else throw new Exception; // Keep current selection $self->grab_focus(); @@ -72,8 +80,8 @@ class Tab $this->gtk->connect( 'page-added', function ( - ?\GtkNotebook $self, - ?\GtkWidget $child, + ?GtkNotebook $self, + ?GtkWidget $child, int $page_num ) { $this->reorder(); @@ -83,8 +91,8 @@ class Tab $this->gtk->connect( 'page-removed', function ( - ?\GtkNotebook $self, - ?\GtkWidget $child, + ?GtkNotebook $self, + ?GtkWidget $child, int $page_num ) { $this->reorder(); @@ -94,8 +102,8 @@ class Tab $this->gtk->connect( 'page-reordered', function ( - ?\GtkNotebook $self, - ?\GtkWidget $child, + ?GtkNotebook $self, + ?GtkWidget $child, int $page_num ) { $this->reorder(); @@ -116,7 +124,7 @@ class Tab ); // Create event box to listen for double click on title label - $label = new \GtkEventBox; + $label = new GtkEventBox; $label->add( $page->title->gtk @@ -127,11 +135,11 @@ class Tab $label->connect( 'button-press-event', function ( - ?\GtkEventBox $self, - ?\GdkEvent $event + ?GtkEventBox $self, + ?GdkEvent $event ) { // Close tab on double click - if ($event->type == \Gdk::DOUBLE_BUTTON_PRESS) + if ($event->type == Gdk::DOUBLE_BUTTON_PRESS) { $this->close(); } @@ -198,7 +206,7 @@ class Tab // Validate page index exists if (empty($this->_page[$page_num])) { - throw new \Exception; + throw new Exception; } // Return page entity diff --git a/src/Entity/Browser/Header/Tray.php b/src/Entity/Browser/Header/Tray.php index d205eef3..b3cb4f8e 100644 --- a/src/Entity/Browser/Header/Tray.php +++ b/src/Entity/Browser/Header/Tray.php @@ -4,11 +4,15 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser\Header; +use \GtkBox; +use \GtkOrientation; + use \Yggverse\Yoda\Entity\Browser\Header; class Tray { - public \GtkBox $gtk; + // GTK + public GtkBox $gtk; // Dependencies public Header $header; @@ -28,8 +32,8 @@ class Tray $this->header = $header; // Init header - $this->gtk = new \GtkBox( - \GtkOrientation::HORIZONTAL + $this->gtk = new GtkBox( + GtkOrientation::HORIZONTAL ); $this->gtk->set_margin_start( diff --git a/src/Entity/Browser/Header/Tray/Navigation.php b/src/Entity/Browser/Header/Tray/Navigation.php index 0d8737a2..a4a5d55d 100644 --- a/src/Entity/Browser/Header/Tray/Navigation.php +++ b/src/Entity/Browser/Header/Tray/Navigation.php @@ -4,12 +4,15 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser\Header\Tray; +use \GtkMenuButton; + use \Yggverse\Yoda\Entity\Browser\Header\Tray; use \Yggverse\Yoda\Entity\Browser\Menu; class Navigation { - public \GtkMenuButton $gtk; + // GTK + public GtkMenuButton $gtk; // Dependencies public Tray $tray; @@ -27,7 +30,7 @@ class Navigation $this->tray = $tray; // Init navigation container - $this->gtk = new \GtkMenuButton; + $this->gtk = new GtkMenuButton; $this->gtk->set_tooltip_text( _($this::TOOLTIP) diff --git a/src/Entity/Browser/Header/Tray/Tab.php b/src/Entity/Browser/Header/Tray/Tab.php index 16651b71..a266a0bd 100644 --- a/src/Entity/Browser/Header/Tray/Tab.php +++ b/src/Entity/Browser/Header/Tray/Tab.php @@ -4,11 +4,17 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser\Header\Tray; +use \GtkButton; +use \GtkIconSize; +use \GtkIconTheme; +use \GtkImage; + use \Yggverse\Yoda\Entity\Browser\Header\Tray; class Tab { - public \GtkButton $gtk; + // GTK + public GtkButton $gtk; // Dependencies public Tray $tray; @@ -25,14 +31,14 @@ class Tab $this->tray = $tray; // Init GTK - $this->gtk = new \GtkButton; + $this->gtk = new GtkButton; - if (\GtkIconTheme::get_default()->has_icon($this::IMAGE)) + if (GtkIconTheme::get_default()->has_icon($this::IMAGE)) { $this->gtk->set_image( - \GtkImage::new_from_icon_name( + GtkImage::new_from_icon_name( $this::IMAGE, - \GtkIconSize::BUTTON + GtkIconSize::BUTTON ) ); } @@ -55,7 +61,7 @@ class Tab $this->gtk->connect( 'clicked', function( - \GtkButton $entity + GtkButton $entity ) { $this->tray->header->browser->container->tab->append( null,