aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/helper.c53
-rw-r--r--src/include/gnunetgtk_common.h9
-rw-r--r--src/plugins/daemon/daemon.c10
-rw-r--r--src/plugins/fs/Makefile.am2
-rw-r--r--src/plugins/fs/download.c17
-rw-r--r--src/plugins/fs/fs.c8
-rw-r--r--src/plugins/fs/namespace.c4
-rw-r--r--src/plugins/fs/search.c18
-rw-r--r--src/plugins/fs/upload.c20
9 files changed, 109 insertions, 32 deletions
diff --git a/src/common/helper.c b/src/common/helper.c
index 97ec690c..7ffc84a5 100644
--- a/src/common/helper.c
+++ b/src/common/helper.c
@@ -625,6 +625,10 @@ char * validate_utf8(char * msg) {
625 FREE(msg); 625 FREE(msg);
626 msg = STRDUP(ret); 626 msg = STRDUP(ret);
627 g_free(ret); 627 g_free(ret);
628 GE_BREAK(NULL,
629 TRUE == g_utf8_validate(msg,
630 -1,
631 &end));
628 return msg; 632 return msg;
629} 633}
630 634
@@ -685,4 +689,53 @@ gboolean startGNUnetSetup (gboolean run_wizard) {
685 return code; 689 return code;
686} 690}
687 691
692/**
693 * Identical to "gtk_tree_selection_selected_foreach",
694 * except that modifications of the underlying model
695 * during the iteration are tolerated.
696 */
697void ggc_tree_selection_selected_foreach(GtkTreeSelection *selection,
698 GtkTreeSelectionForeachFunc func,
699 gpointer data) {
700 unsigned int i;
701 unsigned int size;
702 GList * selected;
703 GtkTreeRowReference ** refs;
704 GtkTreeModel * model;
705 GtkTreePath * path;
706 GtkTreeIter iter;
707
708 selected = gtk_tree_selection_get_selected_rows(selection,
709 &model);
710
711 i = g_list_length(selected);
712 size = 0;
713 refs = NULL;
714 GROW(refs,
715 size,
716 i);
717 for (i=0;i<size;i++)
718 refs[i] = gtk_tree_row_reference_new(model,
719 g_list_nth_data(selected, i));
720 g_list_foreach(selected,
721 (GFunc) &gtk_tree_path_free,
722 NULL);
723 g_list_free(selected);
724 for (i=0;i<size;i++) {
725 path = gtk_tree_row_reference_get_path(refs[i]);
726 gtk_tree_row_reference_free(refs[i]);
727 if (TRUE == gtk_tree_model_get_iter(model,
728 &iter,
729 path))
730 func(model,
731 path,
732 &iter,
733 data);
734 gtk_tree_path_free(path);
735 }
736 GROW(refs,
737 size,
738 0);
739}
740
688/* end of helper.c */ 741/* end of helper.c */
diff --git a/src/include/gnunetgtk_common.h b/src/include/gnunetgtk_common.h
index 4f139f59..6f0402b8 100644
--- a/src/include/gnunetgtk_common.h
+++ b/src/include/gnunetgtk_common.h
@@ -142,4 +142,13 @@ void gnunet_gtk_main_quit();
142*/ 142*/
143gboolean startGNUnetSetup (gboolean run_wizard); 143gboolean startGNUnetSetup (gboolean run_wizard);
144 144
145/**
146 * Identical to "gtk_tree_selection_selected_foreach",
147 * except that modifications of the underlying model
148 * during the iteration are tolerated.
149 */
150void ggc_tree_selection_selected_foreach(GtkTreeSelection *selection,
151 GtkTreeSelectionForeachFunc func,
152 gpointer data);
153
145#endif 154#endif
diff --git a/src/plugins/daemon/daemon.c b/src/plugins/daemon/daemon.c
index 9d89b4c9..c23a087e 100644
--- a/src/plugins/daemon/daemon.c
+++ b/src/plugins/daemon/daemon.c
@@ -56,13 +56,11 @@ static void * updateAppModelSafe(void * unused) {
56 G_TYPE_STRING); 56 G_TYPE_STRING);
57 sock = client_connection_create(ectx, cfg); 57 sock = client_connection_create(ectx, cfg);
58 if (sock == NULL) { 58 if (sock == NULL) {
59 apps = NULL; 59 apps = STRDUP("");
60 } else { 60 } else {
61 GC_get_configuration_value_string(cfg, 61 apps = getConfigurationOptionValue(sock,
62 "GNUNETD", 62 "GNUNETD",
63 "APPLICATIONS", 63 "APPLICATIONS");
64 "about daemon fs stats",
65 &apps);
66 } 64 }
67 if (apps != NULL) { 65 if (apps != NULL) {
68 next = apps; 66 next = apps;
diff --git a/src/plugins/fs/Makefile.am b/src/plugins/fs/Makefile.am
index fae720d5..52d85aa7 100644
--- a/src/plugins/fs/Makefile.am
+++ b/src/plugins/fs/Makefile.am
@@ -20,7 +20,7 @@ libgnunetgtkmodule_fs_la_SOURCES = \
20 upload.c upload.h 20 upload.c upload.h
21libgnunetgtkmodule_fs_la_LIBADD = \ 21libgnunetgtkmodule_fs_la_LIBADD = \
22 $(top_builddir)/src/common/libgnunetgtk_common.la \ 22 $(top_builddir)/src/common/libgnunetgtk_common.la \
23 @GTK_LIBS@ \ 23 @GTK_LIBS@ -lgsf-1 \
24 @GNUNETGTK_LIBS@ \ 24 @GNUNETGTK_LIBS@ \
25 $(INTLLIBS) \ 25 $(INTLLIBS) \
26 -lgthread-2.0 \ 26 -lgthread-2.0 \
diff --git a/src/plugins/fs/download.c b/src/plugins/fs/download.c
index b77615d6..d7ac628e 100644
--- a/src/plugins/fs/download.c
+++ b/src/plugins/fs/download.c
@@ -213,12 +213,18 @@ fs_download_started(struct FSUI_DownloadList * fsui_dl,
213 list->searchList = sl_parent; 213 list->searchList = sl_parent;
214 if (sl_parent != NULL) { 214 if (sl_parent != NULL) {
215 if (dl_parent != NULL) { 215 if (dl_parent != NULL) {
216 GtkTreeIter piter;
217
216 /* have parent, must be download from 218 /* have parent, must be download from
217 directory inside of search */ 219 directory inside of search */
218 path = gtk_tree_row_reference_get_path(dl_parent->searchViewRowReference); 220 path = gtk_tree_row_reference_get_path(dl_parent->searchViewRowReference);
219 valid = gtk_tree_model_get_iter(GTK_TREE_MODEL(sl_parent->tree), 221 valid = gtk_tree_model_get_iter(GTK_TREE_MODEL(sl_parent->tree),
220 &iter, 222 &piter,
221 path); 223 path);
224 if (valid == TRUE)
225 valid = gtk_tree_model_iter_children(GTK_TREE_MODEL(sl_parent->tree),
226 &iter,
227 &piter);
222 } else { 228 } else {
223 /* must be top-level entry in search */ 229 /* must be top-level entry in search */
224 valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(sl_parent->tree), 230 valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(sl_parent->tree),
@@ -563,7 +569,7 @@ void on_downloadButton_clicked_fs(GtkWidget * treeview,
563 GtkTreeSelection * selection; 569 GtkTreeSelection * selection;
564 570
565 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)); 571 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
566 gtk_tree_selection_selected_foreach 572 ggc_tree_selection_selected_foreach
567 (selection, 573 (selection,
568 &initiateDownload, 574 &initiateDownload,
569 NULL); 575 NULL);
@@ -682,7 +688,8 @@ void on_clearCompletedDownloadsButton_clicked_fs(void * unused,
682 downloadList = glade_xml_get_widget(getMainXML(), 688 downloadList = glade_xml_get_widget(getMainXML(),
683 "activeDownloadsList"); 689 "activeDownloadsList");
684 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(downloadList)); 690 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(downloadList));
685 gtk_tree_selection_selected_foreach 691
692 ggc_tree_selection_selected_foreach
686 (selection, 693 (selection,
687 &clearCompletedDownloadCallback, 694 &clearCompletedDownloadCallback,
688 NULL); 695 NULL);
@@ -716,7 +723,7 @@ void on_abortDownloadButton_clicked_fs(void * unused,
716 downloadList = glade_xml_get_widget(getMainXML(), 723 downloadList = glade_xml_get_widget(getMainXML(),
717 "activeDownloadsList"); 724 "activeDownloadsList");
718 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(downloadList)); 725 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(downloadList));
719 gtk_tree_selection_selected_foreach 726 ggc_tree_selection_selected_foreach
720 (selection, 727 (selection,
721 &fsuiCallDownloadCallback, 728 &fsuiCallDownloadCallback,
722 &FSUI_abortDownload); 729 &FSUI_abortDownload);
@@ -730,7 +737,7 @@ void on_stopDownloadButton_clicked_fs(void * unused,
730 downloadList = glade_xml_get_widget(getMainXML(), 737 downloadList = glade_xml_get_widget(getMainXML(),
731 "activeDownloadsList"); 738 "activeDownloadsList");
732 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(downloadList)); 739 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(downloadList));
733 gtk_tree_selection_selected_foreach 740 ggc_tree_selection_selected_foreach
734 (selection, 741 (selection,
735 &fsuiCallDownloadCallback, 742 &fsuiCallDownloadCallback,
736 &FSUI_stopDownload); 743 &FSUI_stopDownload);
diff --git a/src/plugins/fs/fs.c b/src/plugins/fs/fs.c
index 19e83929..ccd0584c 100644
--- a/src/plugins/fs/fs.c
+++ b/src/plugins/fs/fs.c
@@ -414,6 +414,9 @@ void init_fs(struct GE_Context * e,
414 gtk_notebook_set_current_page(GTK_NOTEBOOK(book), 1); 414 gtk_notebook_set_current_page(GTK_NOTEBOOK(book), 1);
415 gtk_notebook_set_current_page(GTK_NOTEBOOK(book), num); 415 gtk_notebook_set_current_page(GTK_NOTEBOOK(book), num);
416 416
417 fs_summary_start();
418 fs_collection_start();
419 fs_namespace_start();
417 ctx = FSUI_start(ectx, 420 ctx = FSUI_start(ectx,
418 cfg, 421 cfg,
419 "gnunet-gtk", 422 "gnunet-gtk",
@@ -421,9 +424,6 @@ void init_fs(struct GE_Context * e,
421 YES, 424 YES,
422 &eventProcessor, 425 &eventProcessor,
423 NULL); 426 NULL);
424 fs_collection_start();
425 fs_summary_start();
426 fs_namespace_start();
427} 427}
428 428
429void done_fs() { 429void done_fs() {
@@ -433,9 +433,9 @@ void done_fs() {
433 = glade_xml_get_widget(getMainXML(), 433 = glade_xml_get_widget(getMainXML(),
434 "fsnotebook"); 434 "fsnotebook");
435 gtk_widget_hide(tab); 435 gtk_widget_hide(tab);
436 FSUI_stop(ctx);
436 fs_summary_stop(); 437 fs_summary_stop();
437 fs_namespace_stop(); 438 fs_namespace_stop();
438 FSUI_stop(ctx);
439} 439}
440 440
441/* end of fs.c */ 441/* end of fs.c */
diff --git a/src/plugins/fs/namespace.c b/src/plugins/fs/namespace.c
index e0c1808f..88d9ec86 100644
--- a/src/plugins/fs/namespace.c
+++ b/src/plugins/fs/namespace.c
@@ -936,7 +936,7 @@ void on_namespaceInsertButton_clicked_fs(GtkWidget * dummy1,
936 cls.nextId = &nextId; 936 cls.nextId = &nextId;
937 } 937 }
938 cls.meta = meta; 938 cls.meta = meta;
939 gtk_tree_selection_selected_foreach 939 ggc_tree_selection_selected_foreach
940 (selection, 940 (selection,
941 &initiateUpload, 941 &initiateUpload,
942 &cls); 942 &cls);
@@ -1161,7 +1161,7 @@ void on_namespaceUpdateButton_clicked_fs(GtkWidget * dummy1,
1161 cls.anonymityLevel 1161 cls.anonymityLevel
1162 = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin)); 1162 = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin));
1163 1163
1164 gtk_tree_selection_selected_foreach 1164 ggc_tree_selection_selected_foreach
1165 (selection, 1165 (selection,
1166 &initiateUpload, 1166 &initiateUpload,
1167 &cls); 1167 &cls);
diff --git a/src/plugins/fs/search.c b/src/plugins/fs/search.c
index 71744feb..669477f6 100644
--- a/src/plugins/fs/search.c
+++ b/src/plugins/fs/search.c
@@ -183,7 +183,6 @@ fs_search_started(struct FSUI_SearchList * fsui_list,
183 sizeof(SearchList)); 183 sizeof(SearchList));
184 list->searchString 184 list->searchString
185 = STRDUP(dhead); 185 = STRDUP(dhead);
186 FREE(description);
187 list->uri 186 list->uri
188 = ECRS_dupUri(uri); 187 = ECRS_dupUri(uri);
189 list->fsui_list 188 list->fsui_list
@@ -306,6 +305,7 @@ fs_search_started(struct FSUI_SearchList * fsui_list,
306 SEARCH_SUMMARY_RESULT_COUNT, 0, 305 SEARCH_SUMMARY_RESULT_COUNT, 0,
307 SEARCH_SUMMARY_INTERNAL, list, 306 SEARCH_SUMMARY_INTERNAL, list,
308 -1); 307 -1);
308 FREE(description);
309 path = gtk_tree_model_get_path(GTK_TREE_MODEL(search_summary), 309 path = gtk_tree_model_get_path(GTK_TREE_MODEL(search_summary),
310 &iter); 310 &iter);
311 list->summaryViewRowReference 311 list->summaryViewRowReference
@@ -327,6 +327,8 @@ fs_search_started(struct FSUI_SearchList * fsui_list,
327 fs_search_result_received(list, 327 fs_search_result_received(list,
328 &results[i], 328 &results[i],
329 uri); 329 uri);
330 if (resultCount == 0) /* otherwise already done! */
331 updateSearchSummary(list);
330 332
331 /* insert new page into search notebook */ 333 /* insert new page into search notebook */
332 notebook 334 notebook
@@ -669,12 +671,12 @@ static void stopSearch(GtkTreeModel * model,
669/** 671/**
670 * The stop button in the search summary was clicked. 672 * The stop button in the search summary was clicked.
671 */ 673 */
672void on_closeSearchSummaryButton_clicked_fs(GtkWidget * treeview, 674void on_closeSearchSummaryButton_clicked_fs(GtkWidget * closeButton,
673 GtkWidget * closeButton) { 675 GtkWidget * treeview) {
674 GtkTreeSelection * selection; 676 GtkTreeSelection * selection;
675 677
676 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)); 678 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
677 gtk_tree_selection_selected_foreach 679 ggc_tree_selection_selected_foreach
678 (selection, 680 (selection,
679 &stopSearch, 681 &stopSearch,
680 NULL); 682 NULL);
@@ -703,17 +705,15 @@ static void abortSearch(GtkTreeModel * model,
703/** 705/**
704 * The abort button in the search summary was clicked. 706 * The abort button in the search summary was clicked.
705 */ 707 */
706void on_abortSearchSummaryButton_clicked_fs(GtkWidget * treeview, 708void on_abortSearchSummaryButton_clicked_fs(GtkWidget * closeButton,
707 GtkWidget * closeButton) { 709 GtkWidget * treeview) {
708 GtkTreeSelection * selection; 710 GtkTreeSelection * selection;
709 711
710 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)); 712 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
711 gtk_tree_selection_selected_foreach 713 ggc_tree_selection_selected_foreach
712 (selection, 714 (selection,
713 &abortSearch, 715 &abortSearch,
714 NULL); 716 NULL);
715} 717}
716 718
717
718
719/* end of search.c */ 719/* end of search.c */
diff --git a/src/plugins/fs/upload.c b/src/plugins/fs/upload.c
index 103cdce9..c742bd13 100644
--- a/src/plugins/fs/upload.c
+++ b/src/plugins/fs/upload.c
@@ -365,6 +365,7 @@ selectFile(const char * oldfilename) {
365void on_mainFileSharingInsertBrowseButton_clicked_fs(GtkWidget * browseButton, 365void on_mainFileSharingInsertBrowseButton_clicked_fs(GtkWidget * browseButton,
366 gpointer dummy) { 366 gpointer dummy) {
367 char * filename; 367 char * filename;
368 char * ofn;
368 const char *oldfilename; 369 const char *oldfilename;
369 GtkWidget * uploadLine; 370 GtkWidget * uploadLine;
370 GtkEntry * entry; 371 GtkEntry * entry;
@@ -375,8 +376,17 @@ void on_mainFileSharingInsertBrowseButton_clicked_fs(GtkWidget * browseButton,
375 "uploadFilenameComboBoxEntry"); 376 "uploadFilenameComboBoxEntry");
376 entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(uploadLine))); 377 entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(uploadLine)));
377 oldfilename = gtk_entry_get_text(entry); 378 oldfilename = gtk_entry_get_text(entry);
378 if (NULL == (filename = selectFile(oldfilename))) 379 if (oldfilename == NULL)
379 return; 380 oldfilename = getenv("PWD");
381 if (oldfilename == NULL)
382 oldfilename = getenv("HOME");
383 if (oldfilename == NULL)
384 oldfilename = "/";
385 ofn = string_expandFileName(ectx, oldfilename);
386 filename = selectFile(ofn);
387 FREE(ofn);
388 if (NULL == filename)
389 return;
380 gtk_entry_set_text(entry, 390 gtk_entry_set_text(entry,
381 filename); 391 filename);
382 model = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(uploadLine))); 392 model = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(uploadLine)));
@@ -435,7 +445,7 @@ void on_clearCompletedUploadsButton_clicked_fs(void * unused,
435 uploadList = glade_xml_get_widget(getMainXML(), 445 uploadList = glade_xml_get_widget(getMainXML(),
436 "activeUploadsList"); 446 "activeUploadsList");
437 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(uploadList)); 447 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(uploadList));
438 gtk_tree_selection_selected_foreach 448 ggc_tree_selection_selected_foreach
439 (selection, 449 (selection,
440 &clearCompletedUploadCallback, 450 &clearCompletedUploadCallback,
441 NULL); 451 NULL);
@@ -469,7 +479,7 @@ void on_abortUploadButton_clicked_fs(void * unused,
469 uploadList = glade_xml_get_widget(getMainXML(), 479 uploadList = glade_xml_get_widget(getMainXML(),
470 "activeUploadsList"); 480 "activeUploadsList");
471 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(uploadList)); 481 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(uploadList));
472 gtk_tree_selection_selected_foreach 482 ggc_tree_selection_selected_foreach
473 (selection, 483 (selection,
474 &fsuiCallUploadCallback, 484 &fsuiCallUploadCallback,
475 &FSUI_abortUpload); 485 &FSUI_abortUpload);
@@ -483,7 +493,7 @@ void on_stopUploadButton_clicked_fs(void * unused,
483 uploadList = glade_xml_get_widget(getMainXML(), 493 uploadList = glade_xml_get_widget(getMainXML(),
484 "activeUploadsList"); 494 "activeUploadsList");
485 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(uploadList)); 495 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(uploadList));
486 gtk_tree_selection_selected_foreach 496 ggc_tree_selection_selected_foreach
487 (selection, 497 (selection,
488 &fsuiCallUploadCallback, 498 &fsuiCallUploadCallback,
489 &FSUI_stopUpload); 499 &FSUI_stopUpload);