Yoda/src/Entity/Browser/Bookmark/Container/Navbar/Delete.php
2024-08-02 22:00:28 +03:00

39 lines
899 B
PHP

<?php
declare(strict_types=1);
namespace Yggverse\Yoda\Entity\Browser\Bookmark\Container\Navbar;
use \GtkButton;
use \Yggverse\Yoda\Abstract\Entity\Browser\Bookmark\Container\Navbar\Button;
class Delete extends Button
{
public const IMAGE = 'edit-delete-symbolic';
public const LABEL = 'Delete';
public const TOOLTIP = 'Delete';
protected function _onCLick(
GtkButton $entity
): void
{
if ($id = $this->navbar->container->content->table->getSelectedId())
{
$this->navbar->container->bookmark->browser->database->bookmark->delete(
$id
);
}
$this->navbar->container->refresh();
}
public function refresh(): void
{
$this->gtk->set_sensitive(
boolval(
$this->navbar->container->content->table->getSelectedId()
)
);
}
}