Add item to clear Form History database
This commit is contained in:
parent
6480329bbf
commit
ce64fd3e25
1 changed files with 24 additions and 2 deletions
|
@ -21,7 +21,11 @@
|
|||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <sqlite3.h>
|
||||
#ifdef G_OS_WIN32
|
||||
#define LIBPREFIX ""
|
||||
#else
|
||||
#define LIBPREFIX "lib"
|
||||
#endif
|
||||
|
||||
static GHashTable* global_keys;
|
||||
static gchar* jsforms;
|
||||
|
@ -434,7 +438,7 @@ formhistory_activate_cb (MidoriExtension* extension,
|
|||
config_dir = midori_extension_get_config_dir (extension);
|
||||
katze_mkdir_with_parents (config_dir, 0700);
|
||||
filename = g_build_filename (config_dir, "forms.db", NULL);
|
||||
if (sqlite3_open (filename, &db))
|
||||
if (sqlite3_open (filename, &db) != SQLITE_OK)
|
||||
{
|
||||
g_warning (_("Failed to open database: %s\n"), sqlite3_errmsg (db));
|
||||
sqlite3_close (db);
|
||||
|
@ -487,6 +491,21 @@ formhistory_activate_cb (MidoriExtension* extension,
|
|||
</html> */
|
||||
#endif
|
||||
|
||||
static void
|
||||
formhistory_clear_database_cb (void)
|
||||
{
|
||||
gchar* filename = g_build_filename (sokoke_set_config_dir (NULL),
|
||||
"extensions", LIBPREFIX "formhistory." G_MODULE_SUFFIX, "forms.db", NULL);
|
||||
sqlite3* db;
|
||||
if (sqlite3_open (filename, &db) == SQLITE_OK)
|
||||
{
|
||||
sqlite3_exec (db, "DELETE FROM forms", NULL, NULL, NULL);
|
||||
sqlite3_close (db);
|
||||
}
|
||||
g_free (filename);
|
||||
|
||||
}
|
||||
|
||||
MidoriExtension*
|
||||
extension_init (void)
|
||||
{
|
||||
|
@ -520,5 +539,8 @@ extension_init (void)
|
|||
g_signal_connect (extension, "activate",
|
||||
G_CALLBACK (formhistory_activate_cb), NULL);
|
||||
|
||||
sokoke_register_privacy_item ("formhistory", _("_Form History"),
|
||||
G_CALLBACK (formhistory_clear_database_cb));
|
||||
|
||||
return extension;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue