[Xfce4-commits] <midori:master> Add 'Last open tabs' option to Clear Private Data

Christian Dywan noreply at xfce.org
Sun Jul 24 22:12:01 CEST 2011


Updating branch refs/heads/master
         to 22a7862654ab057ca02fc4401499d428835e8a78 (commit)
       from c277857ea437190a124f7ddf00c4d55b6801ae3d (commit)

commit 22a7862654ab057ca02fc4401499d428835e8a78
Author: Christian Dywan <christian at twotoasts.de>
Date:   Sun Jul 24 21:41:47 2011 +0200

    Add 'Last open tabs' option to Clear Private Data
    
    Fixes: https://bugs.launchpad.net/midori/+bug/814739

 midori/main.c               |    1 +
 midori/midori-browser.c     |   14 ++++++++++++++
 midori/midori-websettings.h |    1 +
 3 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/midori/main.c b/midori/main.c
index ba0b04b..3afa9c2 100644
--- a/midori/main.c
+++ b/midori/main.c
@@ -2571,6 +2571,7 @@ main (int    argc,
         GList* data_items = sokoke_register_privacy_item (NULL, NULL, NULL);
         gchar* clear_data = katze_object_get_string (settings, "clear-data");
 
+        midori_remove_config_file (clear_prefs, MIDORI_CLEAR_SESSION, "session.xbel");
         midori_remove_config_file (clear_prefs, MIDORI_CLEAR_HISTORY, "history.db");
         midori_remove_config_file (clear_prefs, MIDORI_CLEAR_TRASH, "tabtrash.xbel");
 
diff --git a/midori/midori-browser.c b/midori/midori-browser.c
index fe95d9e..aafa450 100644
--- a/midori/midori-browser.c
+++ b/midori/midori-browser.c
@@ -4293,6 +4293,15 @@ midori_browser_clear_private_data_response_cb (GtkWidget*     dialog,
         GString* clear_data = g_string_new (NULL);
         g_object_get (browser->settings, "clear-private-data", &saved_prefs, NULL);
 
+        button = g_object_get_data (G_OBJECT (dialog), "session");
+        if (gtk_toggle_button_get_active (button))
+        {
+            GList* tabs = gtk_container_get_children (GTK_CONTAINER (browser->notebook));
+            for (; tabs != NULL; tabs = g_list_next (tabs))
+                gtk_widget_destroy (tabs->data);
+            g_list_free (tabs);
+            clear_prefs |= MIDORI_CLEAR_SESSION;
+        }
         button = g_object_get_data (G_OBJECT (dialog), "history");
         if (gtk_toggle_button_get_active (button))
         {
@@ -4394,6 +4403,11 @@ _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);
+        button = gtk_check_button_new_with_mnemonic (_("Last open _tabs"));
+        if ((clear_prefs & MIDORI_CLEAR_SESSION) == MIDORI_CLEAR_SESSION)
+            gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
+        g_object_set_data (G_OBJECT (dialog), "session", button);
+        gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
         /* i18n: Browsing history, visited web pages */
         button = gtk_check_button_new_with_mnemonic (_("_History"));
         if ((clear_prefs & MIDORI_CLEAR_HISTORY) == MIDORI_CLEAR_HISTORY)
diff --git a/midori/midori-websettings.h b/midori/midori-websettings.h
index f35a12c..1809425 100644
--- a/midori/midori-websettings.h
+++ b/midori/midori-websettings.h
@@ -44,6 +44,7 @@ enum
     MIDORI_CLEAR_TRASH = 16,
     MIDORI_CLEAR_ON_QUIT = 32,
     MIDORI_CLEAR_WEB_CACHE = 64, /* deprecated */
+    MIDORI_CLEAR_SESSION = 128,
 };
 
 typedef enum


More information about the Xfce4-commits mailing list