aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2006-12-02 01:54:10 +0000
committerChristian Grothoff <christian@grothoff.org>2006-12-02 01:54:10 +0000
commit72f6c1fd08280851feb85aaf4c1066a1ee6eaeb6 (patch)
tree4edcc7ee23097e18677143d5de77420d71115e21
parenta70388adc0bb83bddc1bf5ec5157aa4850e700ce (diff)
downloadgnunet-gtk-72f6c1fd08280851feb85aaf4c1066a1ee6eaeb6.tar.gz
gnunet-gtk-72f6c1fd08280851feb85aaf4c1066a1ee6eaeb6.zip
cleanup
-rw-r--r--TODO1
-rw-r--r--src/plugins/fs/download.c39
-rw-r--r--src/plugins/fs/upload.c3
3 files changed, 22 insertions, 21 deletions
diff --git a/TODO b/TODO
index ea1c35ab..fec3cddd 100644
--- a/TODO
+++ b/TODO
@@ -2,6 +2,7 @@
2- deadlock (download directory, download files in 2- deadlock (download directory, download files in
3 directory, clear (multiple) completed downloads 3 directory, clear (multiple) completed downloads
4 => strange deadlock) 4 => strange deadlock)
5- Assertion failed at download.c:264 in fs_download_started.
5- disable inactive buttons (if no search/download 6- disable inactive buttons (if no search/download
6 is selected to operate on) [ medium ] [pre1] 7 is selected to operate on) [ medium ] [pre1]
7- highlight active downloads in search list [ easy ] [pre1] 8- highlight active downloads in search list [ easy ] [pre1]
diff --git a/src/plugins/fs/download.c b/src/plugins/fs/download.c
index bdae8406..9d8d446f 100644
--- a/src/plugins/fs/download.c
+++ b/src/plugins/fs/download.c
@@ -60,9 +60,8 @@ addFilesToDirectory(const ECRS_FileInfo * fi,
60 &iter, 60 &iter,
61 path); 61 path);
62 gtk_tree_path_free(path); 62 gtk_tree_path_free(path);
63 /* check for existing entry -- this function 63 /* check for existing entry -- this function maybe called multiple
64 maybe called multiple times for the same 64 times for the same directory entry */
65 directory entry */
66 for (i=gtk_tree_model_iter_n_children(model, 65 for (i=gtk_tree_model_iter_n_children(model,
67 &iter)-1;i>=0;i--) { 66 &iter)-1;i>=0;i--) {
68 if (TRUE == gtk_tree_model_iter_nth_child(model, 67 if (TRUE == gtk_tree_model_iter_nth_child(model,
@@ -214,6 +213,7 @@ fs_download_started(struct FSUI_DownloadList * fsui_dl,
214 path); 213 path);
215 gtk_tree_path_free(path); 214 gtk_tree_path_free(path);
216 list->searchList = sl_parent; 215 list->searchList = sl_parent;
216 list->searchViewRowReference = NULL;
217 if (sl_parent != NULL) { 217 if (sl_parent != NULL) {
218 if (dl_parent != NULL) { 218 if (dl_parent != NULL) {
219 GtkTreeIter piter; 219 GtkTreeIter piter;
@@ -256,11 +256,12 @@ fs_download_started(struct FSUI_DownloadList * fsui_dl,
256 } 256 }
257 } while (TRUE == gtk_tree_model_iter_next(GTK_TREE_MODEL(sl_parent->tree), 257 } while (TRUE == gtk_tree_model_iter_next(GTK_TREE_MODEL(sl_parent->tree),
258 &iter)); 258 &iter));
259 } else {
260 GE_BREAK(ectx, 0);
259 } 261 }
260 if (valid == FALSE) { 262 if (valid == FALSE) {
261 /* did not find matching entry in search list 263 /* did not find matching entry in search list -- bug! Continue
262 -- bug! Continue without adding to to 264 without adding to to search list! */
263 search list! */
264 GE_BREAK(ectx, 0); 265 GE_BREAK(ectx, 0);
265 list->searchList = NULL; 266 list->searchList = NULL;
266 } 267 }
@@ -290,6 +291,7 @@ void fs_download_update(DownloadList * list,
290 GtkTreeIter iter; 291 GtkTreeIter iter;
291 GtkTreePath * path; 292 GtkTreePath * path;
292 unsigned int val; 293 unsigned int val;
294 struct ECRS_MetaData * meta;
293 295
294 path = gtk_tree_row_reference_get_path(list->summaryViewRowReference); 296 path = gtk_tree_row_reference_get_path(list->summaryViewRowReference);
295 gtk_tree_model_get_iter(GTK_TREE_MODEL(download_summary), 297 gtk_tree_model_get_iter(GTK_TREE_MODEL(download_summary),
@@ -307,8 +309,6 @@ void fs_download_update(DownloadList * list,
307 if ( (list->is_directory == YES) && 309 if ( (list->is_directory == YES) &&
308 (list->searchList != NULL) && 310 (list->searchList != NULL) &&
309 (list->searchViewRowReference != NULL) ) { 311 (list->searchViewRowReference != NULL) ) {
310 struct ECRS_MetaData * meta;
311
312 meta = NULL; 312 meta = NULL;
313 ECRS_listDirectory(ectx, 313 ECRS_listDirectory(ectx,
314 data, 314 data,
@@ -560,7 +560,6 @@ initiateDownload(GtkTreeModel * model,
560 } 560 }
561 gtk_tree_path_free(dirTreePath); 561 gtk_tree_path_free(dirTreePath);
562 562
563
564 /* construct completed/directory/real-filename */ 563 /* construct completed/directory/real-filename */
565 idc_final_download_destination = MALLOC(strlen(final_download_dir) + 2 + 564 idc_final_download_destination = MALLOC(strlen(final_download_dir) + 2 +
566 strlen(idc_name) + strlen(GNUNET_DIRECTORY_EXT) + 565 strlen(idc_name) + strlen(GNUNET_DIRECTORY_EXT) +
@@ -574,7 +573,8 @@ initiateDownload(GtkTreeModel * model,
574 dirPath); 573 dirPath);
575 disk_directory_create(ectx, 574 disk_directory_create(ectx,
576 idc_final_download_destination); 575 idc_final_download_destination);
577 strcat(idc_final_download_destination, idc_name); 576 strcat(idc_final_download_destination,
577 idc_name);
578 if ( (idc_final_download_destination[strlen(idc_final_download_destination) - 1] == '/') || 578 if ( (idc_final_download_destination[strlen(idc_final_download_destination) - 1] == '/') ||
579 (idc_final_download_destination[strlen(idc_final_download_destination) - 1] == '\\') ) 579 (idc_final_download_destination[strlen(idc_final_download_destination) - 1] == '\\') )
580 idc_final_download_destination[strlen(idc_final_download_destination) - 1] = '\0'; 580 idc_final_download_destination[strlen(idc_final_download_destination) - 1] = '\0';
@@ -585,13 +585,14 @@ initiateDownload(GtkTreeModel * model,
585 (0 != strcmp(&idc_final_download_destination[strlen(idc_final_download_destination) 585 (0 != strcmp(&idc_final_download_destination[strlen(idc_final_download_destination)
586 - strlen(GNUNET_DIRECTORY_EXT)], 586 - strlen(GNUNET_DIRECTORY_EXT)],
587 GNUNET_DIRECTORY_EXT)) ) ) 587 GNUNET_DIRECTORY_EXT)) ) )
588 strcat(idc_final_download_destination, GNUNET_DIRECTORY_EXT); 588 strcat(idc_final_download_destination,
589 GNUNET_DIRECTORY_EXT);
589 590
590 /* FIXME: check that there is no pending download 591 /* FIXME: check that there is no pending download for idc_name! */
591 for idc_name! */
592 if (OK == check_pending(idc_name, 592 if (OK == check_pending(idc_name,
593 NULL)) { 593 NULL)) {
594 addLogEntry(_("Downloading `%s'"), idc_name); 594 addLogEntry(_("Downloading `%s'"),
595 idc_name);
595 FSUI_startDownload(ctx, 596 FSUI_startDownload(ctx,
596 getSpinButtonValue(searchContext->searchXML, 597 getSpinButtonValue(searchContext->searchXML,
597 "downloadAnonymitySpinButton"), 598 "downloadAnonymitySpinButton"),
@@ -602,7 +603,8 @@ initiateDownload(GtkTreeModel * model,
602 searchContext->fsui_list, 603 searchContext->fsui_list,
603 (parentContext != NULL) ? parentContext->fsui_list : NULL); 604 (parentContext != NULL) ? parentContext->fsui_list : NULL);
604 } else { 605 } else {
605 addLogEntry(_("ERROR: already downloading `%s'"), idc_name); 606 addLogEntry(_("ERROR: already downloading `%s'"),
607 idc_name);
606 } 608 }
607 FREE(uri_name); 609 FREE(uri_name);
608 FREE(dirPath); 610 FREE(dirPath);
@@ -634,7 +636,6 @@ void on_downloadButton_clicked_fs(GtkWidget * treeview,
634 * 636 *
635 * TODO: 637 * TODO:
636 * - support for recursive downloads 638 * - support for recursive downloads
637 * - support for showing directories (if downloaded like this)
638 * - support for user-specified filename 639 * - support for user-specified filename
639 */ 640 */
640void on_statusDownloadURIEntry_editing_done_fs(GtkWidget * entry, 641void on_statusDownloadURIEntry_editing_done_fs(GtkWidget * entry,
@@ -682,7 +683,8 @@ void on_statusDownloadURIEntry_editing_done_fs(GtkWidget * entry,
682 strcat(idc_final_download_destination, DIR_SEPARATOR_STR); 683 strcat(idc_final_download_destination, DIR_SEPARATOR_STR);
683 strcat(idc_final_download_destination, dname); 684 strcat(idc_final_download_destination, dname);
684 685
685 addLogEntry(_("Downloading `%s'"), uris); 686 addLogEntry(_("Downloading `%s'"),
687 uris);
686 idc_meta = ECRS_createMetaData(); 688 idc_meta = ECRS_createMetaData();
687 FSUI_startDownload(ctx, 689 FSUI_startDownload(ctx,
688 getSpinButtonValue(getMainXML(), 690 getSpinButtonValue(getMainXML(),
@@ -710,7 +712,7 @@ static void * fsui_callback(void * cls) {
710 return NULL; 712 return NULL;
711} 713}
712 714
713static gboolean 715static void
714clearCompletedDownloadCallback(GtkTreeModel * model, 716clearCompletedDownloadCallback(GtkTreeModel * model,
715 GtkTreePath * path, 717 GtkTreePath * path,
716 GtkTreeIter * iter, 718 GtkTreeIter * iter,
@@ -730,7 +732,6 @@ clearCompletedDownloadCallback(GtkTreeModel * model,
730 run_with_save_calls(&fsui_callback, 732 run_with_save_calls(&fsui_callback,
731 &fcbc); 733 &fcbc);
732 } 734 }
733 return FALSE;
734} 735}
735 736
736void on_clearCompletedDownloadsButton_clicked_fs(void * unused, 737void on_clearCompletedDownloadsButton_clicked_fs(void * unused,
diff --git a/src/plugins/fs/upload.c b/src/plugins/fs/upload.c
index 54ac87a0..5b14a19f 100644
--- a/src/plugins/fs/upload.c
+++ b/src/plugins/fs/upload.c
@@ -420,7 +420,7 @@ static void * fsui_callback(void * cls) {
420 return NULL; 420 return NULL;
421} 421}
422 422
423static gboolean 423static void
424clearCompletedUploadCallback(GtkTreeModel * model, 424clearCompletedUploadCallback(GtkTreeModel * model,
425 GtkTreePath * path, 425 GtkTreePath * path,
426 GtkTreeIter * iter, 426 GtkTreeIter * iter,
@@ -440,7 +440,6 @@ clearCompletedUploadCallback(GtkTreeModel * model,
440 run_with_save_calls(&fsui_callback, 440 run_with_save_calls(&fsui_callback,
441 &fcbc); 441 &fcbc);
442 } 442 }
443 return FALSE;
444} 443}
445 444
446void on_clearCompletedUploadsButton_clicked_fs(void * unused, 445void on_clearCompletedUploadsButton_clicked_fs(void * unused,