encapsulate memory container

This commit is contained in:
yggverse 2024-04-09 16:56:25 +03:00
parent 6c1213e180
commit e518b0a898
2 changed files with 8 additions and 6 deletions

View file

@ -13,9 +13,15 @@ class Main
public \Yggverse\Yoda\Label\Content $content;
public \Yggverse\Yoda\Label\Tray $tray;
public \Yggverse\Yoda\Model\Memory $memory;
public function __construct(
string $name = 'boxMain'
) {
// Init memory
$this->memory = new \Yggverse\Yoda\Model\Memory();
// Init container
$this->box = new \GtkBox(
\GtkOrientation::VERTICAL
);
@ -72,7 +78,6 @@ class Main
function ($entry)
{
global $config;
global $memory;
$this->tray->label->set_text(
sprintf(
@ -93,7 +98,7 @@ class Main
$name = $address->getHost();
if (!$host = $memory->get($name))
if (!$host = $this->memory->get($name))
{
$resolve = new \Yggverse\Net\Resolve(
$config->resolver->request->record,
@ -110,7 +115,7 @@ class Main
{
$host = $resolved->getHost();
$memory->set(
$this->memory->set(
$name,
$host
);

View file

@ -9,9 +9,6 @@ require_once __DIR__ .
// Init config
$config = \Yggverse\Yoda\Model\File::getConfig();
// Init memory
$memory = new \Yggverse\Yoda\Model\Memory();
// Init GTK
\Gtk::init();