[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r18919 - gnunet-gtk/src/fs
From: |
gnunet |
Subject: |
[GNUnet-SVN] r18919 - gnunet-gtk/src/fs |
Date: |
Mon, 2 Jan 2012 06:59:46 +0100 |
Author: grothoff
Date: 2012-01-02 06:59:46 +0100 (Mon, 02 Jan 2012)
New Revision: 18919
Modified:
gnunet-gtk/src/fs/gnunet-fs-gtk-event_handler.c
Log:
-LRN: removing delayed update patch
Modified: gnunet-gtk/src/fs/gnunet-fs-gtk-event_handler.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk-event_handler.c 2012-01-02 05:06:30 UTC
(rev 18918)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk-event_handler.c 2012-01-02 05:59:46 UTC
(rev 18919)
@@ -113,22 +113,6 @@
static struct PublishTab *publish_tab;
-struct UpdateSearchItem
-{
- struct UpdateSearchItem *prev;
- struct UpdateSearchItem *next;
- struct DownloadEntry *de;
- uint64_t size;
- uint64_t completed;
- void *block_data;
- uint64_t offset;
- uint64_t block_size;
- unsigned int depth;
-};
-
-GNUNET_SCHEDULER_TaskIdentifier update_progress_task =
GNUNET_SCHEDULER_NO_TASK;
-
-
static void
closure_notify_free (gpointer data, GClosure *closure)
{
@@ -311,120 +295,50 @@
}
-static void
-mark_download_progress_delayed (struct DownloadEntry *de, uint64_t size,
- uint64_t completed, const void *block_data,
- uint64_t offset, uint64_t block_size, unsigned int depth)
-{
- GtkTreeIter iter;
- GtkTreePath *path;
-
- do
- {
- path = gtk_tree_row_reference_get_path (de->rr);
- if (TRUE != gtk_tree_model_get_iter (GTK_TREE_MODEL (de->ts), &iter, path))
- {
- GNUNET_break (0);
- gtk_tree_path_free (path);
- break;
- }
- gtk_tree_path_free (path);
- gtk_tree_store_set (de->ts, &iter, 4,
- (guint) ((size >
- 0) ? (100 * completed /
- size) : 100) /* progress */ ,
- 14, completed, -1);
- if ((depth == 0) && (block_size > 0) &&
- (GNUNET_YES == GNUNET_FS_meta_data_test_for_directory (de->meta)))
- {
- struct AddDirectoryEntryContext ade;
- ade.de = de;
- ade.prr = de->rr;
- ade.check_duplicates = GNUNET_NO;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "It is a directory, list its
contents\n");
- if (GNUNET_SYSERR ==
- GNUNET_FS_directory_list_contents ((size_t) block_size, block_data,
- offset, &add_directory_entry,
&ade))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _
- ("Metadata wrongly claims that this is a GNUnet
directory!\n"));
- }
- }
- } while (0);
-}
-
-
-void
-GNUNET_FS_GTK_update_download_progress (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
- struct SearchTab *st;
- GtkTreeStore *ts;
- struct UpdateSearchItem *usi_head;
- struct UpdateSearchItem *usi_tail;
- struct UpdateSearchItem *usi;
- struct UpdateSearchItem *next;
-
- update_progress_task = GNUNET_SCHEDULER_NO_TASK;
- for (st = search_tab_head; st; st = st->next)
- {
- ts = st->ts;
- usi_head = g_object_get_data (G_OBJECT (ts), "usi_head");
- usi_tail = g_object_get_data (G_OBJECT (ts), "usi_tail");
- for (usi = usi_head; NULL != usi; usi = next)
- {
- next = usi->next;
- mark_download_progress_delayed (usi->de, usi->size,
- usi->completed, usi->block_data, usi->offset, usi->block_size,
- usi->depth);
- GNUNET_CONTAINER_DLL_remove (usi_head, usi_tail, usi);
- GNUNET_free_non_null (usi->block_data);
- GNUNET_free (usi);
- }
- g_object_set_data (G_OBJECT (ts), "usi_head", usi_head);
- g_object_set_data (G_OBJECT (ts), "usi_tail", usi_tail);
- }
- if (!(tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
- update_progress_task = GNUNET_SCHEDULER_add_delayed (
- GNUNET_TIME_UNIT_SECONDS,
- GNUNET_FS_GTK_update_download_progress, NULL);
-}
-
-
static struct DownloadEntry *
mark_download_progress (struct DownloadEntry *de, uint64_t size,
uint64_t completed, const void *block_data,
uint64_t offset, uint64_t block_size,
unsigned int depth)
{
- struct UpdateSearchItem *usi_head;
- struct UpdateSearchItem *usi_tail;
- struct UpdateSearchItem *usi_new;
+ GtkTreeIter iter;
+ GtkTreePath *path;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Marking download progress for DE=%p, %llu/%llu, address@hidden
depth=%u\n",
de, completed, size, block_size, offset, depth);
- usi_head = g_object_get_data (G_OBJECT (de->ts), "usi_head");
- usi_tail = g_object_get_data (G_OBJECT (de->ts), "usi_tail");
- usi_new = GNUNET_malloc (sizeof (struct UpdateSearchItem));
- usi_new->de = de;
- usi_new->size = size;
- usi_new->completed = completed;
- usi_new->block_data = GNUNET_malloc (block_size);
- memcpy (usi_new->block_data, block_data, block_size);
- usi_new->offset = offset;
- usi_new->block_size = block_size;
- usi_new->depth = depth;
- GNUNET_CONTAINER_DLL_insert_tail (usi_head, usi_tail, usi_new);
- g_object_set_data (G_OBJECT (de->ts), "usi_head", usi_head);
- g_object_set_data (G_OBJECT (de->ts), "usi_tail", usi_tail);
- if (update_progress_task == GNUNET_SCHEDULER_NO_TASK)
- update_progress_task = GNUNET_SCHEDULER_add_delayed (
- GNUNET_TIME_UNIT_SECONDS,
- GNUNET_FS_GTK_update_download_progress, NULL);
+ path = gtk_tree_row_reference_get_path (de->rr);
+ if (TRUE != gtk_tree_model_get_iter (GTK_TREE_MODEL (de->ts), &iter, path))
+ {
+ GNUNET_break (0);
+ gtk_tree_path_free (path);
+ return de;
+ }
+ gtk_tree_path_free (path);
+ gtk_tree_store_set (de->ts, &iter, 4,
+ (guint) ((size >
+ 0) ? (100 * completed /
+ size) : 100) /* progress */ ,
+ 14, completed, -1);
+ if ((depth == 0) && (block_size > 0) &&
+ (GNUNET_YES == GNUNET_FS_meta_data_test_for_directory (de->meta)))
+ {
+ struct AddDirectoryEntryContext ade;
+ ade.de = de;
+ ade.prr = de->rr;
+ ade.check_duplicates = GNUNET_NO;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "It is a directory, list its
contents\n");
+ if (GNUNET_SYSERR ==
+ GNUNET_FS_directory_list_contents ((size_t) block_size, block_data,
+ offset, &add_directory_entry, &ade))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _
+ ("Metadata wrongly claims that this is a GNUnet
directory!\n"));
+ }
+ }
return de;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r18919 - gnunet-gtk/src/fs,
gnunet <=