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": "database":
{ {
"enabled":true "enabled":true,
"mode":
{
"renew":true
}
} }
}, },
"progressbar": "progressbar":

View file

@ -343,6 +343,32 @@ class History
$this->treeview->show_all(); $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( public function getSelectedColumn(
int $column, int $column,
\GtkTreeView $treeview = null \GtkTreeView $treeview = null

View file

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