[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r16940 - gnunet-gtk/src/fs
From: |
gnunet |
Subject: |
[GNUnet-SVN] r16940 - gnunet-gtk/src/fs |
Date: |
Mon, 19 Sep 2011 00:11:40 +0200 |
Author: grothoff
Date: 2011-09-19 00:11:40 +0200 (Mon, 19 Sep 2011)
New Revision: 16940
Modified:
gnunet-gtk/src/fs/gnunet-fs-gtk-event_handler.c
Log:
fixing 1772, also use filename for description if/once available
Modified: gnunet-gtk/src/fs/gnunet-fs-gtk-event_handler.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk-event_handler.c 2011-09-18 21:34:08 UTC
(rev 16939)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk-event_handler.c 2011-09-18 22:11:40 UTC
(rev 16940)
@@ -157,10 +157,28 @@
static void
stop_download (struct DownloadEntry *de, int is_suspend)
{
- change_download_colour (de, "white");
+ GtkTreeIter iter;
+ GtkTreePath *path;
+ GtkTreeModel *tm;
+ struct SearchResult *search_result;
+
+ path = gtk_tree_row_reference_get_path (de->rr);
+ tm = gtk_tree_row_reference_get_model (de->rr);
+ if (TRUE != gtk_tree_model_get_iter (tm, &iter, path))
+ GNUNET_break (0);
+ else
+ {
+ gtk_tree_model_get (tm, &iter,
+ 9, &search_result, -1);
+ GNUNET_assert (search_result->download == de);
+ search_result->download = NULL;
+ if (NULL == search_result->result)
+ (void) gtk_tree_store_remove (GTK_TREE_STORE (tm), &iter);
+ else
+ change_download_colour (de, "white");
+ }
+ gtk_tree_path_free (path);
gtk_tree_row_reference_free (de->rr);
- if (is_suspend == GNUNET_NO)
- GNUNET_FS_download_stop (de->dc, GNUNET_YES);
GNUNET_FS_uri_destroy (de->uri);
GNUNET_CONTAINER_meta_data_destroy (de->meta);
GNUNET_free (de);
@@ -415,6 +433,7 @@
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);
+ search_result->result = NULL;
gtk_tree_path_free (path);
if (search_result->download != NULL)
{
@@ -464,8 +483,8 @@
GtkTreeModel * model;
rr_old = de->rr;
- de->sr = NULL;
- tab = GNUNET_GTK_add_to_uri_tab (&iter, NULL, de->meta, de->uri);
+ tab = GNUNET_GTK_add_to_uri_tab (&iter, &de->sr, de->meta, de->uri);
+ de->sr->download = de;
de->ts = tab->ts;
model = GTK_TREE_MODEL (de->ts);
path = gtk_tree_model_get_path (model, &iter);
@@ -511,6 +530,7 @@
setup_download (struct DownloadEntry *de, struct DownloadEntry *pde,
struct SearchResult *sr, struct GNUNET_FS_DownloadContext *dc,
const struct GNUNET_FS_Uri *uri,
+ const char *filename,
const struct GNUNET_CONTAINER_MetaData *meta, uint64_t size,
uint64_t completed)
{
@@ -520,12 +540,15 @@
if (de == NULL)
{
de = GNUNET_malloc (sizeof (struct DownloadEntry));
+ de->uri = GNUNET_FS_uri_dup (uri);
+ }
+ de->dc = dc;
+ de->sr = sr;
+ if (NULL != sr)
+ {
GNUNET_assert (sr->download == NULL);
sr->download = de;
- de->sr = sr;
- de->dc = dc;
- de->uri = GNUNET_FS_uri_dup (uri);
- }
+ }
de->pde = pde;
if ((meta != NULL) && (de->meta == NULL))
de->meta = GNUNET_CONTAINER_meta_data_duplicate (meta);
@@ -555,6 +578,7 @@
(guint) ((size >
0) ? (100 * completed /
size) : 100) /* progress */ ,
+ 6, filename /* filename/description */ ,
8, "blue" /* status colour: pending */ ,
-1);
return de;
@@ -994,7 +1018,7 @@
{
gtk_tree_model_get (tm, &iter, 9, &sr, -1);
if ((sr->download != NULL) && (sr->download->is_done == GNUNET_YES))
- GNUNET_FS_download_stop (sr->download->dc, GNUNET_YES);
+ GNUNET_FS_download_stop (sr->download->dc, GNUNET_YES);
}
while (TRUE == gtk_tree_model_iter_next (tm, &iter));
}
@@ -1227,7 +1251,8 @@
}
desc =
GNUNET_CONTAINER_meta_data_get_first_by_types (meta,
-
EXTRACTOR_METATYPE_PACKAGE_NAME,
+
EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME,
+
EXTRACTOR_METATYPE_PACKAGE_NAME,
EXTRACTOR_METATYPE_TITLE,
EXTRACTOR_METATYPE_BOOK_TITLE,
EXTRACTOR_METATYPE_FILENAME,
@@ -1709,6 +1734,7 @@
return setup_download (info->value.download.cctx,
info->value.download.pctx,
info->value.download.sctx, info->value.download.dc,
info->value.download.uri,
+ info->value.download.filename,
info->value.download.specifics.start.meta,
info->value.download.size,
info->value.download.completed);
@@ -1717,6 +1743,7 @@
setup_download (info->value.download.cctx, info->value.download.pctx,
info->value.download.sctx, info->value.download.dc,
info->value.download.uri,
+ info->value.download.filename,
info->value.download.specifics.resume.meta,
info->value.download.size,
info->value.download.completed);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r16940 - gnunet-gtk/src/fs,
gnunet <=