From 67bbc5bad5f8241d2a1e31e9579ac8b2f25debfa Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 17 Dec 2006 23:02:59 +0000 Subject: use tree for download summary --- TODO | 4 ++-- src/plugins/fs/download.c | 27 +++++++++++++++++++++------ src/plugins/fs/upload.c | 20 +++++++++----------- 3 files changed, 32 insertions(+), 19 deletions(-) diff --git a/TODO b/TODO index 7807870f..d879180c 100644 --- a/TODO +++ b/TODO @@ -20,8 +20,8 @@ Notes: * stop download of directory (=> kills pending downloads of files) * re-start download of files => assertion failure (once for each re-started download) -- should show upload/download status as tree, not flat list [pre3] - (makes recursive nature of aborting upload/download clearer!) +- investigate #1088 [RC] +- investigate #1153 [RC] 0.7.2 (goal: re-enable all 0.7.0 features): - create custom gtk logger (via memory logger?) diff --git a/src/plugins/fs/download.c b/src/plugins/fs/download.c index 1fd31bfb..9f123578 100644 --- a/src/plugins/fs/download.c +++ b/src/plugins/fs/download.c @@ -189,6 +189,7 @@ fs_download_started(struct FSUI_DownloadList * fsui_dl, FSUI_State state) { DownloadList * list; GtkTreeIter iter; + GtkTreeIter piter; GtkTreePath * path; unsigned long long size; char * size_h; @@ -205,11 +206,26 @@ fs_download_started(struct FSUI_DownloadList * fsui_dl, sizeof(DownloadList)); list->uri = ECRS_dupUri(fi->uri); list->filename = STRDUP(filename); - /* FIXME: if we have dl_parent, - we may not want to just append! */ - gtk_tree_store_append(download_summary, - &iter, - NULL); + if ( (dl_parent != NULL) && + (NULL != (path = gtk_tree_row_reference_get_path(dl_parent->summaryViewRowReference) ) ) ) { + valid = gtk_tree_model_get_iter(GTK_TREE_MODEL(download_summary), + &piter, + path); + if (valid) { + gtk_tree_store_append(download_summary, + &iter, + &piter); + } else { + gtk_tree_store_append(download_summary, + &iter, + NULL); + } + gtk_tree_path_free(path); + } else { + gtk_tree_store_append(download_summary, + &iter, + NULL); + } size = ECRS_fileSize(fi->uri); size_h = string_get_fancy_byte_size(size); sname = &filename[strlen(filename)-1]; @@ -244,7 +260,6 @@ fs_download_started(struct FSUI_DownloadList * fsui_dl, list->searchViewRowReference = NULL; if (sl_parent != NULL) { if (dl_parent != NULL) { - GtkTreeIter piter; /* have parent, must be download from directory inside of search */ diff --git a/src/plugins/fs/upload.c b/src/plugins/fs/upload.c index d25e7d94..5ab6d75a 100644 --- a/src/plugins/fs/upload.c +++ b/src/plugins/fs/upload.c @@ -141,7 +141,8 @@ fs_upload_started(struct FSUI_UploadList * fsui, GtkTreeIter iter; GtkTreePath * path; int progress; - + GtkTreeIter par; + ret = MALLOC(sizeof(UploadList)); memset(ret, 0, @@ -149,14 +150,8 @@ fs_upload_started(struct FSUI_UploadList * fsui, ret->filename = STRDUP(filename); ret->fsui_list = fsui; ret->total = total; - if (parent == NULL) { - gtk_tree_store_append(upload_summary, - &iter, - NULL); - } else { - GtkTreeIter par; - - path = gtk_tree_row_reference_get_path(parent->summaryViewRowReference); + if ( (parent != NULL) && + (NULL != (path = gtk_tree_row_reference_get_path(parent->summaryViewRowReference))) ) { gtk_tree_model_get_iter(GTK_TREE_MODEL(upload_summary), &par, path); @@ -164,8 +159,11 @@ fs_upload_started(struct FSUI_UploadList * fsui, gtk_tree_store_append(upload_summary, &iter, &par); - } - + } else { + gtk_tree_store_append(upload_summary, + &iter, + NULL); + } if (total != 0) progress = 100 * completed / total; else -- cgit v1.2.3