add page history save mode

This commit is contained in:
yggverse 2024-04-17 10:45:47 +03:00
parent c2ddd3dba5
commit 64ae36eecf
3 changed files with 32 additions and 2 deletions

View file

@ -86,7 +86,11 @@
},
"database":
{
"enabled":true
"enabled":true,
"mode":
{
"renew":true
}
}
},
"progressbar":

View file

@ -343,6 +343,32 @@ class History
$this->treeview->show_all();
}
public function add(
string $url,
?string $title = null,
bool $renew = false // delete previous records with same URL
): ?int
{
if ($renew)
{
foreach ($this->app->database->getHistory($url) as $record)
{
$this->app->database->deleteHistory(
$record->id
);
}
}
$id = $this->app->database->addHistory(
$url,
$title
);
$this->refresh();
return $id;
}
public function getSelectedColumn(
int $column,
\GtkTreeView $treeview = null

View file

@ -711,7 +711,7 @@ class Page
$this->app->history->add(
$url,
$title,
$this->config->history->database->renew
$this->config->history->database->mode->renew
);
}
}