[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r12567 - gnunet gnunet-gtk/src
From: |
gnunet |
Subject: |
[GNUnet-SVN] r12567 - gnunet gnunet-gtk/src |
Date: |
Sun, 15 Aug 2010 23:52:25 +0200 |
Author: grothoff
Date: 2010-08-15 23:52:24 +0200 (Sun, 15 Aug 2010)
New Revision: 12567
Modified:
gnunet-gtk/src/fs_event_handler.c
gnunet/TODO
Log:
handling lost parent
Modified: gnunet/TODO
===================================================================
--- gnunet/TODO 2010-08-15 17:59:10 UTC (rev 12566)
+++ gnunet/TODO 2010-08-15 21:52:24 UTC (rev 12567)
@@ -1,7 +1,4 @@
0.9.0pre2:
-* UTIL:
- - only connect() sockets that are ready (select()) [Nils]
- [On W32, we need to select after calling socket before doing connect etc.]
* CORE:
- derived key generation [Nils]
- Jun 27 11:51:54 core-7670 ERROR Assertion failed at
gnunet-service-core.c:3616.
@@ -13,12 +10,10 @@
=> may have been fixed with instant-notification of disconnect
to core on session-oriented connection hick-up; not perfect but
likely good enough until we get ATS going; still should be tested...
-` => "peers connected (transport)" now instantly goes to ZERO (core
statistic),
+ => "peers connected (transport)" now instantly goes to ZERO (core
statistic),
but "established sessions" stays up...
- * PWNAT: [Nate/MW/Nils]
+* PWNAT: [Nate/MW/Nils]
- W32 port
-* GNUNET-GTK: [CG]
- - handle 'lost parent' case for recursive downloads (need to move children!)
0.9.0pre3:
* Determine RC bugs and fix those (release should have no known real bugs)
@@ -83,6 +78,9 @@
0.9.0:
* Determine RC bugs and fix those (release should have no known real bugs)
+* UTIL:
+ - only connect() sockets that are ready (select()) [Nils]
+ [On W32, we need to select after calling socket before doing connect etc.]
* new webpage: [BL]
- convert documentation pages to books
- update books (especially for developers)
Modified: gnunet-gtk/src/fs_event_handler.c
===================================================================
--- gnunet-gtk/src/fs_event_handler.c 2010-08-15 17:59:10 UTC (rev 12566)
+++ gnunet-gtk/src/fs_event_handler.c 2010-08-15 21:52:24 UTC (rev 12567)
@@ -393,6 +393,131 @@
/**
+ * Move (aka copy) all of the children of 'src_iter' from the 'src_model'
+ * to become children of 'dst_iter' in the 'dst_model'.
+ *
+ * The models are both 'GNUNET_GTK_file_sharing_result_tree_store' models.
+ *
+ * Note that we also need to update the 'struct SearchResult'
+ * and (if it exists) the respective 'struct DownloadEntry'
+ * to refer to the new model.
+ */
+static void
+move_children (GtkTreeModel *src_model,
+ GtkTreeIter *src_iter,
+ GtkTreeModel *dst_model,
+ GtkTreeIter *dst_iter)
+{
+ GtkTreeIter src_child;
+ GtkTreeIter dst_child;
+ GtkTreePath *path;
+ struct GNUNET_CONTAINER_MetaData *meta;
+ struct GNUNET_FS_Uri *uri;
+ guint64 filesize;
+ GdkPixbuf *preview;
+ guint percent_progress;
+ guint percent_availability;
+ char *filename;
+ char *uri_as_string;
+ char *status_colour;
+ struct SearchResult *search_result;
+ char *mimetype;
+ guint applicability_rank;
+ guint availability_certainty;
+ gint availability_rank;
+
+ if (TRUE == gtk_tree_model_iter_children (src_model,
+ &src_child,
+ src_iter))
+ {
+ do
+ {
+ gtk_tree_model_get (src_model,
+ &src_child,
+ 0, &meta,
+ 1, &uri,
+ 2, &filesize,
+ 3, &preview,
+ 4, &percent_progress,
+ 5, &percent_availability,
+ 6, &filename,
+ 7, &uri_as_string,
+ 8, &status_colour,
+ 9, &search_result,
+ 10, &mimetype,
+ 11, &applicability_rank,
+ 12, &availability_certainty,
+ 13, &availability_rank,
+ -1);
+ gtk_tree_store_insert_with_values (GTK_TREE_STORE (dst_model),
+ &dst_child,
+ dst_iter,
+ G_MAXINT,
+ 0, meta,
+ 1, uri,
+ 2, filesize,
+ 3, preview,
+ 4, percent_progress,
+ 5, percent_availability,
+ 6, filename,
+ 7, uri_as_string,
+ 8, status_colour,
+ 9, search_result,
+ 10, mimetype,
+ 11, applicability_rank,
+ 12, availability_certainty,
+ 13, availability_rank,
+ -1);
+ g_free (filename);
+ g_free (uri_as_string);
+ g_free (status_colour);
+ g_free (mimetype);
+ if (preview != NULL)
+ g_object_unref (preview);
+ gtk_tree_row_reference_free (search_result->rr);
+ path = gtk_tree_model_get_path (dst_model,
+ &dst_child);
+ search_result->rr = gtk_tree_row_reference_new (dst_model,
+ path);
+ gtk_tree_path_free (path);
+ if (search_result->download != NULL)
+ {
+ search_result->download->ts = GTK_TREE_STORE (dst_model);
+ gtk_tree_row_reference_free (search_result->download->rr);
+ search_result->download->rr = gtk_tree_row_reference_copy
(search_result->rr);
+ }
+ move_children (src_model,
+ &src_child,
+ dst_model,
+ &dst_child);
+ }
+ while (TRUE == gtk_tree_model_iter_next (src_model,
+ &src_child));
+ }
+}
+
+
+/**
+ * Delete the entire given subtree from the model.
+ * Does not free anything inside of the respective
+ * model's fields (since they have been moved).
+ */
+static void
+delete_stale_subtree (GtkTreeModel *model,
+ GtkTreeIter *iter)
+{
+ GtkTreeIter child;
+
+ while (TRUE == gtk_tree_model_iter_children (model,
+ &child,
+ iter))
+ delete_stale_subtree (model, &child);
+ gtk_tree_store_remove (GTK_TREE_STORE (model),
+ iter);
+}
+
+
+/**
* Handle the case where an active download lost its
* search parent by moving it to the URI tab.
*/
@@ -405,8 +530,11 @@
GtkTreeIter iter;
GtkTreePath *path;
struct SearchTab *tab;
+ GtkTreeRowReference *rr_old;
+ GtkTreeModel *tm_old;
+ GtkTreeIter iter_old;
- gtk_tree_row_reference_free (de->rr);
+ rr_old = de->rr;
de->sr = NULL;
tab = GNUNET_GTK_add_to_uri_tab (&iter,
NULL,
@@ -420,8 +548,19 @@
gtk_tree_path_free (path);
mark_download_progress (de, size, completed,
NULL, 0, 0, 0);
- /* FIXME: need to also move sub-downloads ---
- this could be a recursive download! */
+ tm_old = gtk_tree_row_reference_get_model (rr_old);
+ path = gtk_tree_row_reference_get_path (rr_old);
+ gtk_tree_row_reference_free (rr_old);
+ gtk_tree_model_get_iter (tm_old,
+ &iter_old,
+ path);
+ gtk_tree_path_free (path);
+ move_children (tm_old,
+ &iter_old,
+ GTK_TREE_MODEL (de->ts),
+ &iter);
+ delete_stale_subtree (tm_old,
+ &iter_old);
if (size > completed)
{
if (is_active)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r12567 - gnunet gnunet-gtk/src,
gnunet <=