#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;
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);
</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)
{
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;
}