mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
encapsulate memory container
This commit is contained in:
parent
6c1213e180
commit
e518b0a898
2 changed files with 8 additions and 6 deletions
|
|
@ -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
|
||||
);
|
||||
|
|
|
|||
|
|
@ -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…
Add table
Add a link
Reference in a new issue