gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r19658 - in gnunet-gtk/src: fs include lib


From: gnunet
Subject: [GNUnet-SVN] r19658 - in gnunet-gtk/src: fs include lib
Date: Fri, 3 Feb 2012 00:13:22 +0100

Author: grothoff
Date: 2012-02-03 00:13:22 +0100 (Fri, 03 Feb 2012)
New Revision: 19658

Modified:
   gnunet-gtk/src/fs/gnunet-fs-gtk_publish-dialog.c
   gnunet-gtk/src/include/gnunet_gtk.h
   gnunet-gtk/src/lib/glade.c
Log:
-factoring out remove subtree API, using it to better clean up publish dialog

Modified: gnunet-gtk/src/fs/gnunet-fs-gtk_publish-dialog.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk_publish-dialog.c    2012-02-02 20:18:06 UTC 
(rev 19657)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk_publish-dialog.c    2012-02-02 23:13:22 UTC 
(rev 19658)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet
-     (C) 2005, 2006, 2010 Christian Grothoff (and other contributing authors)
+     (C) 2005, 2006, 2010, 2012 Christian Grothoff (and other contributing 
authors)
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -414,27 +414,9 @@
 
 
 /**
- * Remove the given entry and all of its children from the tree store.
- *
- * @param ts tree store to edit
- * @param root root of the subtree to remove
- */
-static void
-remove_old_entry (GtkTreeStore * ts,
-                 GtkTreeIter * root)
-{
-  GtkTreeIter child;
-
-  while (gtk_tree_model_iter_children (GTK_TREE_MODEL (ts), &child, root))
-    remove_old_entry (ts, &child);
-  gtk_tree_store_remove (ts, root);
-}
-
-
-/**
  * Copy an entry in the tree from the 'old' position to the 'new'
  * position.  All of the fields are copied, plain pointers will be
- * aliased (model will thus be inconsistent until 'remove_old_entry'
+ * aliased (model will thus be inconsistent until the subtree remover
  * is called on the 'old' entry).
  *
  * @param ctx main publishing context
@@ -641,7 +623,7 @@
     return;
   }
   copy_entry (ctx, ctx->file_info_treemodel, &iter, &pos, GNUNET_YES);
-  remove_old_entry (GTK_TREE_STORE (ctx->file_info_treemodel), &iter);
+  GNUNET_FS_GTK_remove_treestore_subtree (GTK_TREE_STORE 
(ctx->file_info_treemodel), &iter);
 }
 
 
@@ -860,11 +842,8 @@
   }
   gtk_tree_model_get (ctx->file_info_treemodel, &iter, 5, &fip, -1);
   GNUNET_FS_file_information_destroy (fip, &free_fi_row_reference, NULL);
-  /* FIXME-BUG: the call above frees the row references in the entire 
-     subtree; however, with the 'remove' operation below we
-     ONLY delete the top-level entry; we probably want to delete
-     the entire directory subtree here... */
-  gtk_tree_store_remove (GTK_TREE_STORE (ctx->file_info_treemodel), &iter);
+  GNUNET_FS_GTK_remove_treestore_subtree  (GTK_TREE_STORE 
(ctx->file_info_treemodel), 
+                                          &iter);
   update_selectivity (ctx);
 }
 

Modified: gnunet-gtk/src/include/gnunet_gtk.h
===================================================================
--- gnunet-gtk/src/include/gnunet_gtk.h 2012-02-02 20:18:06 UTC (rev 19657)
+++ gnunet-gtk/src/include/gnunet_gtk.h 2012-02-02 23:13:22 UTC (rev 19658)
@@ -158,7 +158,17 @@
 GNUNET_GTK_filechooser_get_filename_utf8 (GtkFileChooser * fc);
 
 
+/**
+ * Remove the given entry and all of its children from the tree store.
+ *
+ * @param ts tree store to change
+ * @param root root of the subtree to remove
+ */
+void
+GNUNET_FS_GTK_remove_treestore_subtree (GtkTreeStore * ts,
+                                       GtkTreeIter * root);
 
+
 /* ******************* main loop ***************** */
 
 /**

Modified: gnunet-gtk/src/lib/glade.c
===================================================================
--- gnunet-gtk/src/lib/glade.c  2012-02-02 20:18:06 UTC (rev 19657)
+++ gnunet-gtk/src/lib/glade.c  2012-02-02 23:13:22 UTC (rev 19658)
@@ -127,5 +127,22 @@
 }
 
 
+/**
+ * Remove the given entry and all of its children from the tree store.
+ *
+ * @param ts tree store to change
+ * @param root root of the subtree to remove
+ */
+void
+GNUNET_FS_GTK_remove_treestore_subtree (GtkTreeStore * ts,
+                                       GtkTreeIter * root)
+{
+  GtkTreeIter child;
+  
+  while (gtk_tree_model_iter_children (GTK_TREE_MODEL (ts), &child, root))
+    GNUNET_FS_GTK_remove_treestore_subtree (ts, &child);
+  gtk_tree_store_remove (ts, root);
+}
 
+
 /* end of glade.c */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]