]> spindle.queued.net Git - midori/commitdiff
Clear the history folders on collapse, repopulate on expand
authorAlexander Butenko <a.butenka@gmail.com>
Wed, 3 Feb 2010 21:13:00 +0000 (22:13 +0100)
committerChristian Dywan <christian@twotoasts.de>
Wed, 3 Feb 2010 21:13:00 +0000 (22:13 +0100)
panels/midori-history.c

index 3f56ddb28125f115653d1ad69a8bc0095b7ca324..1c6f748c34dc33a692c36664d593ab8c103726ca 100644 (file)
@@ -808,20 +808,26 @@ midori_history_row_expanded_cb (GtkTreeView*   treeview,
 
     model = gtk_tree_view_get_model (GTK_TREE_VIEW (treeview));
     gtk_tree_model_get (model, iter, 0, &item, -1);
-    /* FIXME: We need always repopulate parent. Now ignoring dupes */
-    if (gtk_tree_model_iter_n_children (model, iter) < 2)
-        midori_history_read_from_db (history, GTK_TREE_STORE (model),
-                                     iter, katze_item_get_added (item));
+    midori_history_read_from_db (history, GTK_TREE_STORE (model),
+                                 iter, katze_item_get_added (item));
     g_object_unref (item);
 }
 
 static void
 midori_history_row_collapsed_cb (GtkTreeView *treeview,
-                                 GtkTreeIter *iter,
+                                 GtkTreeIter *parent,
                                  GtkTreePath *path,
                                  gpointer     user_data)
 {
-    /* FIXME: Free parent childs on close and repopulate them again on open */
+    GtkTreeModel* model;
+    GtkTreeIter child;
+
+    model = gtk_tree_view_get_model (GTK_TREE_VIEW (treeview));
+    while (gtk_tree_model_iter_n_children (model, parent) > 1)
+    {
+        if (gtk_tree_model_iter_children (model, &child, parent))
+            gtk_tree_store_remove (GTK_TREE_STORE (model), &child);
+    }
 }
 #endif