Browse Source

encapsulate memory container

PHP-GTK3
yggverse 7 months ago
parent
commit
e518b0a898
  1. 11
      src/Box/Main.php
  2. 3
      src/Yoda.php

11
src/Box/Main.php

@ -13,9 +13,15 @@ class Main @@ -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 @@ -72,7 +78,6 @@ class Main
function ($entry)
{
global $config;
global $memory;
$this->tray->label->set_text(
sprintf(
@ -93,7 +98,7 @@ class Main @@ -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 @@ -110,7 +115,7 @@ class Main
{
$host = $resolved->getHost();
$memory->set(
$this->memory->set(
$name,
$host
);

3
src/Yoda.php

@ -9,9 +9,6 @@ require_once __DIR__ . @@ -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();

Loading…
Cancel
Save