[Xfce4-commits] <midori:master> Add item to clear Form History database

Christian Dywan noreply at xfce.org
Sun Oct 17 23:16:03 CEST 2010


Updating branch refs/heads/master
         to ce64fd3e25f7159ac71f7955f4cfc3144300f855 (commit)
       from 6480329bbf024eb2142c7d3ff72f9b1b70024cd6 (commit)

commit ce64fd3e25f7159ac71f7955f4cfc3144300f855
Author: Christian Dywan <christian at twotoasts.de>
Date:   Sun Oct 17 23:11:50 2010 +0200

    Add item to clear Form History database

 extensions/formhistory.c |   26 ++++++++++++++++++++++++--
 1 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/extensions/formhistory.c b/extensions/formhistory.c
index 44958a3..c058777 100644
--- a/extensions/formhistory.c
+++ b/extensions/formhistory.c
@@ -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;
 }



More information about the Xfce4-commits mailing list