aboutsummaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/fs/download.c19
-rw-r--r--src/plugins/fs/fs.c22
-rw-r--r--src/plugins/fs/fs.h4
-rw-r--r--src/plugins/fs/search.c19
4 files changed, 59 insertions, 5 deletions
diff --git a/src/plugins/fs/download.c b/src/plugins/fs/download.c
index 9b6839b8..15ed911d 100644
--- a/src/plugins/fs/download.c
+++ b/src/plugins/fs/download.c
@@ -309,7 +309,7 @@ fs_download_started(struct FSUI_DownloadList * fsui_dl,
309 gtk_tree_path_free(path); 309 gtk_tree_path_free(path);
310 gtk_tree_store_set(sl_parent->tree, 310 gtk_tree_store_set(sl_parent->tree,
311 &iter, 311 &iter,
312 SEARCH_CELL_BG_COLOR, "yellow", 312 SEARCH_CELL_BG_COLOR, getColorCode(URITRACK_DOWNLOAD_STARTED),
313 -1); 313 -1);
314 break; 314 break;
315 } 315 }
@@ -398,7 +398,7 @@ void fs_download_completed(DownloadList * downloadContext) {
398 gtk_tree_path_free(path); 398 gtk_tree_path_free(path);
399 gtk_tree_store_set(downloadContext->searchList->tree, 399 gtk_tree_store_set(downloadContext->searchList->tree,
400 &iter, 400 &iter,
401 SEARCH_CELL_BG_COLOR, "green", 401 SEARCH_CELL_BG_COLOR, getColorCode(URITRACK_DOWNLOAD_COMPLETED),
402 -1); 402 -1);
403 } 403 }
404 downloadContext->has_terminated = YES; 404 downloadContext->has_terminated = YES;
@@ -410,7 +410,20 @@ void fs_download_completed(DownloadList * downloadContext) {
410 * possibly refresh directory listing. 410 * possibly refresh directory listing.
411 */ 411 */
412void fs_download_aborted(DownloadList * downloadContext) { 412void fs_download_aborted(DownloadList * downloadContext) {
413 /* FIXME: update summary? / search list status entry! */ 413 GtkTreeIter iter;
414 GtkTreePath * path;
415
416 if (downloadContext->searchViewRowReference != NULL) {
417 path = gtk_tree_row_reference_get_path(downloadContext->searchViewRowReference);
418 gtk_tree_model_get_iter(GTK_TREE_MODEL(downloadContext->searchList->tree),
419 &iter,
420 path);
421 gtk_tree_path_free(path);
422 gtk_tree_store_set(downloadContext->searchList->tree,
423 &iter,
424 SEARCH_CELL_BG_COLOR, getColorCode(URITRACK_DOWNLOAD_ABORTED),
425 -1);
426 }
414 downloadContext->has_terminated = YES; 427 downloadContext->has_terminated = YES;
415 refreshDirectoryViewFromDisk(downloadContext); 428 refreshDirectoryViewFromDisk(downloadContext);
416} 429}
diff --git a/src/plugins/fs/fs.c b/src/plugins/fs/fs.c
index 4514bb9a..f3d4d459 100644
--- a/src/plugins/fs/fs.c
+++ b/src/plugins/fs/fs.c
@@ -649,4 +649,26 @@ void done_fs() {
649 CO_done(); 649 CO_done();
650} 650}
651 651
652
653const char * getColorCode(enum URITRACK_STATE state) {
654 if (state & (URITRACK_DIRECTORY_ADDED))
655 return "blue";
656 if (state & (URITRACK_INSERTED || URITRACK_INDEXED))
657 return "cyan";
658 if ( (state & URITRACK_DOWNLOAD_STARTED) &&
659 (0 == (state &
660 (URITRACK_DOWNLOAD_COMPLETED |
661 URITRACK_DOWNLOAD_ABORTED)) ) )
662 return "yellow";
663 if (state & URITRACK_DOWNLOAD_COMPLETED)
664 return "springgreen";
665 if (state & URITRACK_DOWNLOAD_ABORTED)
666 return "red";
667 if (state & (URITRACK_SEARCH_RESULT |
668 URITRACK_DIRECTORY_FOUND) )
669 return "gray";
670 return "white";
671}
672
673
652/* end of fs.c */ 674/* end of fs.c */
diff --git a/src/plugins/fs/fs.h b/src/plugins/fs/fs.h
index 0cba8086..efe5d0eb 100644
--- a/src/plugins/fs/fs.h
+++ b/src/plugins/fs/fs.h
@@ -29,6 +29,7 @@
29 29
30#include <GNUnet/gnunet_ecrs_lib.h> 30#include <GNUnet/gnunet_ecrs_lib.h>
31#include <GNUnet/gnunet_fsui_lib.h> 31#include <GNUnet/gnunet_fsui_lib.h>
32#include <GNUnet/gnunet_uritrack_lib.h>
32#include "gnunetgtk_common.h" 33#include "gnunetgtk_common.h"
33 34
34/** 35/**
@@ -316,4 +317,7 @@ extern GtkTreeStore * download_summary;
316 317
317extern GtkTreeStore * upload_summary; 318extern GtkTreeStore * upload_summary;
318 319
320const char * getColorCode(enum URITRACK_STATE state);
321
322
319#endif 323#endif
diff --git a/src/plugins/fs/search.c b/src/plugins/fs/search.c
index 3cbde2f9..a3ac8bc0 100644
--- a/src/plugins/fs/search.c
+++ b/src/plugins/fs/search.c
@@ -106,7 +106,11 @@ void addEntryToSearchTree(SearchList * searchContext,
106 unsigned long long size; 106 unsigned long long size;
107 char * size_h; 107 char * size_h;
108 GdkPixbuf * pixbuf; 108 GdkPixbuf * pixbuf;
109 enum URITRACK_STATE state;
109 110
111 state = URITRACK_getState(ectx,
112 cfg,
113 info->uri);
110 mime = getMimeTypeFromMetaData(info->meta); 114 mime = getMimeTypeFromMetaData(info->meta);
111 desc = getDescriptionFromMetaData(info->meta); 115 desc = getDescriptionFromMetaData(info->meta);
112 name = getFileNameFromMetaData(info->meta); 116 name = getFileNameFromMetaData(info->meta);
@@ -123,7 +127,7 @@ void addEntryToSearchTree(SearchList * searchContext,
123 SEARCH_PIXBUF, pixbuf, 127 SEARCH_PIXBUF, pixbuf,
124 SEARCH_URI, ECRS_dupUri(info->uri), 128 SEARCH_URI, ECRS_dupUri(info->uri),
125 SEARCH_META, ECRS_dupMetaData(info->meta), 129 SEARCH_META, ECRS_dupMetaData(info->meta),
126 SEARCH_CELL_BG_COLOR, "white", 130 SEARCH_CELL_BG_COLOR, getColorCode(state),
127 SEARCH_CELL_FG_COLOR, "black", 131 SEARCH_CELL_FG_COLOR, "black",
128 SEARCH_INTERNAL, searchContext, 132 SEARCH_INTERNAL, searchContext,
129 SEARCH_INTERNAL_PARENT, downloadParent, 133 SEARCH_INTERNAL_PARENT, downloadParent,
@@ -147,7 +151,18 @@ void fs_search_result_received(SearchList * searchContext,
147 const struct ECRS_URI * uri) { 151 const struct ECRS_URI * uri) {
148 GtkTreeStore * model; 152 GtkTreeStore * model;
149 GtkTreeIter iter; 153 GtkTreeIter iter;
150 154 enum URITRACK_STATE state;
155
156 state = URITRACK_getState(ectx,
157 cfg,
158 info->uri);
159 if ( (state & (URITRACK_INSERTED |
160 URITRACK_INDEXED) ) &&
161 (YES == GC_get_configuration_value_yesno(cfg,
162 "GNUNET-GTK",
163 "DISABLE-OWN",
164 YES)) )
165 return;
151 model = GTK_TREE_STORE(gtk_tree_view_get_model(searchContext->treeview)); 166 model = GTK_TREE_STORE(gtk_tree_view_get_model(searchContext->treeview));
152 gtk_tree_store_append(model, 167 gtk_tree_store_append(model,
153 &iter, 168 &iter,