[Xfce4-commits] <midori:master> Limit items in trash in private browsing

Christian Dywan noreply at xfce.org
Thu Dec 1 20:06:01 CET 2011


Updating branch refs/heads/master
         to d0db33711df65a8709af472dfbb2a0cc5acb675d (commit)
       from 339e18aa03e57375782c533cd0dc24d08eb3d7fd (commit)

commit d0db33711df65a8709af472dfbb2a0cc5acb675d
Author: Christian Dywan <christian at twotoasts.de>
Date:   Thu Dec 1 19:55:17 2011 +0100

    Limit items in trash in private browsing

 midori/main.c |   28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/midori/main.c b/midori/main.c
index c8dfd5a..bdfe414 100644
--- a/midori/main.c
+++ b/midori/main.c
@@ -673,23 +673,12 @@ midori_search_engines_move_item_cb (KatzeArray* array,
 }
 
 static void
-midori_trash_add_item_cb (KatzeArray* trash,
-                          GObject*    item)
+midori_trash_add_item_no_save_cb (KatzeArray* trash,
+                                  GObject*    item)
 {
-    gchar* config_file = build_config_filename ("tabtrash.xbel");
-    GError* error = NULL;
-    GObject* obsolete_item;
-    if (!midori_array_to_file (trash, config_file, "xbel", &error))
-    {
-        /* i18n: Trash, or wastebin, containing closed tabs */
-        g_warning (_("The trash couldn't be saved. %s"), error->message);
-        g_error_free (error);
-    }
-    g_free (config_file);
-
     if (katze_array_get_nth_item (trash, 10))
     {
-        obsolete_item = katze_array_get_nth_item (trash, 0);
+        KatzeItem* obsolete_item = katze_array_get_nth_item (trash, 0);
         katze_array_remove_item (trash, obsolete_item);
     }
 }
@@ -700,8 +689,10 @@ midori_trash_remove_item_cb (KatzeArray* trash,
 {
     gchar* config_file = build_config_filename ("tabtrash.xbel");
     GError* error = NULL;
+    midori_trash_add_item_no_save_cb (trash, item);
     if (!midori_array_to_file (trash, config_file, "xbel", &error))
     {
+        /* i18n: Trash, or wastebin, containing closed tabs */
         g_warning (_("The trash couldn't be saved. %s"), error->message);
         g_error_free (error);
     }
@@ -709,6 +700,13 @@ midori_trash_remove_item_cb (KatzeArray* trash,
 }
 
 static void
+midori_trash_add_item_cb (KatzeArray* trash,
+                          GObject*    item)
+{
+    midori_trash_remove_item_cb (trash, item);
+}
+
+static void
 midori_browser_show_preferences_cb (MidoriBrowser*    browser,
                                     KatzePreferences* preferences,
                                     MidoriApp*        app)
@@ -2171,6 +2169,8 @@ main (int    argc,
         {
             /* In-memory trash for re-opening closed tabs */
             trash = katze_array_new (KATZE_TYPE_ITEM);
+            g_signal_connect_after (trash, "add-item",
+              G_CALLBACK (midori_trash_add_item_no_save_cb), NULL);
             g_object_set (browser, "trash", trash, NULL);
 
             g_object_set (settings,


More information about the Xfce4-commits mailing list