mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 17:45:28 +00:00
implement history tab constructor
This commit is contained in:
parent
8f46ba1398
commit
5df6332346
2 changed files with 76 additions and 1 deletions
|
|
@ -134,6 +134,13 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"history":
|
||||||
|
{
|
||||||
|
"time":
|
||||||
|
{
|
||||||
|
"format":"c"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,11 @@ class History
|
||||||
{
|
{
|
||||||
public \Yggverse\Yoda\Entity\App $app;
|
public \Yggverse\Yoda\Entity\App $app;
|
||||||
|
|
||||||
|
public \GtkBox $box;
|
||||||
|
public \GtkListStore $list;
|
||||||
|
public \GtkTreeView $treeview;
|
||||||
|
public \GtkScrolledWindow $container;
|
||||||
|
|
||||||
public object $config;
|
public object $config;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
|
|
@ -17,6 +22,69 @@ class History
|
||||||
$this->app = $app;
|
$this->app = $app;
|
||||||
|
|
||||||
// Init config
|
// Init config
|
||||||
$this->config = \Yggverse\Yoda\Model\File::getConfig()->app->tab->page;
|
$this->config = \Yggverse\Yoda\Model\File::getConfig()->app->tab->history;
|
||||||
|
|
||||||
|
// Build history list
|
||||||
|
$this->treeview = new \GtkTreeView();
|
||||||
|
|
||||||
|
$this->treeview->append_column(
|
||||||
|
new \GtkTreeViewColumn(
|
||||||
|
'URL',
|
||||||
|
new \GtkCellRendererText(),
|
||||||
|
'text',
|
||||||
|
0
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->treeview->append_column(
|
||||||
|
new \GtkTreeViewColumn(
|
||||||
|
'Time',
|
||||||
|
new \GtkCellRendererText(),
|
||||||
|
'text',
|
||||||
|
1
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Create list storage
|
||||||
|
$this->list = new \GtkListStore(
|
||||||
|
\GObject::TYPE_STRING,
|
||||||
|
\GObject::TYPE_STRING
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->treeview->set_model(
|
||||||
|
$this->list
|
||||||
|
);
|
||||||
|
|
||||||
|
// Build history list from database records
|
||||||
|
foreach ($this->app->database->getHistory() as $record)
|
||||||
|
{
|
||||||
|
$this->list->append(
|
||||||
|
[
|
||||||
|
$record->url,
|
||||||
|
date(
|
||||||
|
$this->config->time->format,
|
||||||
|
$record->time
|
||||||
|
)
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compose page
|
||||||
|
$this->box = new \GtkBox(
|
||||||
|
\GtkOrientation::VERTICAL
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->container = new \GtkScrolledWindow();
|
||||||
|
|
||||||
|
$this->container->add(
|
||||||
|
$this->treeview
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->box->pack_start(
|
||||||
|
$this->container,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
0
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue