From: Alexander Butenko Date: Thu, 11 Feb 2010 22:22:58 +0000 (+0100) Subject: Clear history via sqlite if selected in 'Clear private data' dialog X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f733f453d237066511e772ddbbd1dbb90f070b9a;p=midori Clear history via sqlite if selected in 'Clear private data' dialog --- diff --git a/midori/midori-browser.c b/midori/midori-browser.c index 74530c79..6dd0d7bd 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -4542,12 +4542,25 @@ midori_browser_clear_private_data_response_cb (GtkWidget* dialog, g_object_get (browser->settings, "clear-private-data", &saved_prefs, NULL); + #if HAVE_SQLITE button = g_object_get_data (G_OBJECT (dialog), "history"); if (gtk_toggle_button_get_active (button)) { - katze_array_clear (browser->history); + const gchar* sqlcmd; + sqlite3* db; + char* errmsg = NULL; + + db = g_object_get_data (G_OBJECT (browser->history), "db"); + sqlcmd = "DELETE FROM history"; + + if (sqlite3_exec (db, sqlcmd, NULL, NULL, &errmsg) != SQLITE_OK) + { + g_printerr (_("Failed to remove history item: %s\n"), errmsg); + sqlite3_free (errmsg); + } clear_prefs |= MIDORI_CLEAR_HISTORY; } + #endif button = g_object_get_data (G_OBJECT (dialog), "cookies"); if (gtk_toggle_button_get_active (button)) { @@ -4674,11 +4687,13 @@ _action_clear_private_data_activate (GtkAction* action, vbox = gtk_vbox_new (TRUE, 4); alignment = gtk_alignment_new (0, 0, 1, 1); gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 6, 12, 0); + #if HAVE_SQLITE button = gtk_check_button_new_with_mnemonic (_("History")); if ((clear_prefs & MIDORI_CLEAR_HISTORY) == MIDORI_CLEAR_HISTORY) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); g_object_set_data (G_OBJECT (dialog), "history", button); gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0); + #endif button = gtk_check_button_new_with_mnemonic (_("Cookies")); if ((clear_prefs & MIDORI_CLEAR_COOKIES) == MIDORI_CLEAR_COOKIES) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);