aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-09-15 13:18:57 +0000
committerChristian Grothoff <christian@grothoff.org>2011-09-15 13:18:57 +0000
commita416b9314e82889e83be800acbe5bb07a8038b77 (patch)
tree0c892ee62ab9aedab5c6d2bcd27fb4b95d28b0c2
parent89ff2dd5130bdb229a9058bff171e7ab5436808d (diff)
downloadgnunet-gtk-a416b9314e82889e83be800acbe5bb07a8038b77.tar.gz
gnunet-gtk-a416b9314e82889e83be800acbe5bb07a8038b77.zip
trying to clean up shutdown
-rwxr-xr-xcontrib/removetrailingwhitespace14
-rw-r--r--src/fs/gnunet-fs-gtk-anonymity_spin_buttons.c4
-rw-r--r--src/fs/gnunet-fs-gtk-common.c2
-rw-r--r--src/fs/gnunet-fs-gtk-common.h2
-rw-r--r--src/fs/gnunet-fs-gtk-download.h2
-rw-r--r--src/fs/gnunet-fs-gtk-edit_publish_dialog.c4
-rw-r--r--src/fs/gnunet-fs-gtk-event_handler.c24
-rw-r--r--src/fs/gnunet-fs-gtk-event_handler.h6
-rw-r--r--src/fs/gnunet-fs-gtk-main_window_file_publish.c6
-rw-r--r--src/include/gnunet_gtk.h2
-rw-r--r--src/lib/eventloop.c48
-rw-r--r--src/lib/glade.c2
-rw-r--r--src/peerinfo/gnunet-peerinfo-gtk-about.c3
-rw-r--r--src/peerinfo/gnunet-peerinfo-gtk-flags.c46
-rw-r--r--src/peerinfo/gnunet-peerinfo-gtk-flags.h2
-rw-r--r--src/peerinfo/gnunet-peerinfo-gtk.c240
-rw-r--r--src/setup/gnunet-setup-options.c8
-rw-r--r--src/setup/gnunet-setup-options.h2
-rw-r--r--src/setup/gnunet-setup.c25
19 files changed, 218 insertions, 224 deletions
diff --git a/contrib/removetrailingwhitespace b/contrib/removetrailingwhitespace
new file mode 100755
index 00000000..9e620cbb
--- /dev/null
+++ b/contrib/removetrailingwhitespace
@@ -0,0 +1,14 @@
1#!/usr/bin/python
2
3import sys
4import re
5
6for fileName in sys.argv[1:]:
7 f = open(fileName, 'r+')
8 fileString = f.read()
9
10 fileString = re.sub(r'[ ]+\n', r'\n', fileString)
11 fileString = re.sub(r'\r', r'', fileString)
12 f.seek(0)
13 f.write(fileString)
14 f.truncate(len(fileString))
diff --git a/src/fs/gnunet-fs-gtk-anonymity_spin_buttons.c b/src/fs/gnunet-fs-gtk-anonymity_spin_buttons.c
index 826d1b79..bf53e859 100644
--- a/src/fs/gnunet-fs-gtk-anonymity_spin_buttons.c
+++ b/src/fs/gnunet-fs-gtk-anonymity_spin_buttons.c
@@ -47,10 +47,10 @@ GNUNET_GTK_anonymity_spin_button_value_changed_cb (GtkWidget * w, gpointer data)
47 return; 47 return;
48 } 48 }
49 val = gtk_spin_button_get_value_as_int (spin); 49 val = gtk_spin_button_get_value_as_int (spin);
50 if (val == 0) 50 if (val == 0)
51 { 51 {
52 if ((TRUE == gdk_rgba_parse (&bcolor, "red")) && 52 if ((TRUE == gdk_rgba_parse (&bcolor, "red")) &&
53 (TRUE == gdk_rgba_parse (&fcolor, "black")) ) 53 (TRUE == gdk_rgba_parse (&fcolor, "black")))
54 { 54 {
55 gtk_widget_override_background_color (w, GTK_STATE_NORMAL, &bcolor); 55 gtk_widget_override_background_color (w, GTK_STATE_NORMAL, &bcolor);
56 gtk_widget_override_color (w, GTK_STATE_NORMAL, &fcolor); 56 gtk_widget_override_color (w, GTK_STATE_NORMAL, &fcolor);
diff --git a/src/fs/gnunet-fs-gtk-common.c b/src/fs/gnunet-fs-gtk-common.c
index 4f7b0112..e7cb07f1 100644
--- a/src/fs/gnunet-fs-gtk-common.c
+++ b/src/fs/gnunet-fs-gtk-common.c
@@ -34,7 +34,7 @@
34 * used in the main libextractor library and yielding 34 * used in the main libextractor library and yielding
35 * meta data). 35 * meta data).
36 * @param type libextractor-type describing the meta data 36 * @param type libextractor-type describing the meta data
37 * @param format basic format information about data 37 * @param format basic format information about data
38 * @param data_mime_type mime-type of data (not of the original file); 38 * @param data_mime_type mime-type of data (not of the original file);
39 * can be NULL (if mime-type is not known) 39 * can be NULL (if mime-type is not known)
40 * @param data actual meta-data found 40 * @param data actual meta-data found
diff --git a/src/fs/gnunet-fs-gtk-common.h b/src/fs/gnunet-fs-gtk-common.h
index b523c911..9484b0e7 100644
--- a/src/fs/gnunet-fs-gtk-common.h
+++ b/src/fs/gnunet-fs-gtk-common.h
@@ -87,7 +87,7 @@ GNUNET_FS_GTK_mmap_and_scan (const char *filename,
87 * used in the main libextractor library and yielding 87 * used in the main libextractor library and yielding
88 * meta data). 88 * meta data).
89 * @param type libextractor-type describing the meta data 89 * @param type libextractor-type describing the meta data
90 * @param format basic format information about data 90 * @param format basic format information about data
91 * @param data_mime_type mime-type of data (not of the original file); 91 * @param data_mime_type mime-type of data (not of the original file);
92 * can be NULL (if mime-type is not known) 92 * can be NULL (if mime-type is not known)
93 * @param data actual meta-data found 93 * @param data actual meta-data found
diff --git a/src/fs/gnunet-fs-gtk-download.h b/src/fs/gnunet-fs-gtk-download.h
index 401164da..28a65f95 100644
--- a/src/fs/gnunet-fs-gtk-download.h
+++ b/src/fs/gnunet-fs-gtk-download.h
@@ -54,7 +54,7 @@ struct DownloadContext
54 char *filename; 54 char *filename;
55 55
56 /** 56 /**
57 * Row reference (if URI was found by search, or 57 * Row reference (if URI was found by search, or
58 * part of directory, etc.); otherwise NULL (download by URI). 58 * part of directory, etc.); otherwise NULL (download by URI).
59 */ 59 */
60 GtkTreeRowReference *rr; 60 GtkTreeRowReference *rr;
diff --git a/src/fs/gnunet-fs-gtk-edit_publish_dialog.c b/src/fs/gnunet-fs-gtk-edit_publish_dialog.c
index e075446a..2465e6ac 100644
--- a/src/fs/gnunet-fs-gtk-edit_publish_dialog.c
+++ b/src/fs/gnunet-fs-gtk-edit_publish_dialog.c
@@ -336,7 +336,7 @@ add_keyword (void *cls, const char *keyword, int is_mandatory)
336 * used in the main libextractor library and yielding 336 * used in the main libextractor library and yielding
337 * meta data). 337 * meta data).
338 * @param type libextractor-type describing the meta data 338 * @param type libextractor-type describing the meta data
339 * @param format basic format information about data 339 * @param format basic format information about data
340 * @param data_mime_type mime-type of data (not of the original file); 340 * @param data_mime_type mime-type of data (not of the original file);
341 * can be NULL (if mime-type is not known) 341 * can be NULL (if mime-type is not known)
342 * @param data actual meta-data found 342 * @param data actual meta-data found
@@ -455,7 +455,7 @@ file_information_extract (void *cls, struct GNUNET_FS_FileInformation *fi,
455 * used in the main libextractor library and yielding 455 * used in the main libextractor library and yielding
456 * meta data). 456 * meta data).
457 * @param type libextractor-type describing the meta data 457 * @param type libextractor-type describing the meta data
458 * @param format basic format information about data 458 * @param format basic format information about data
459 * @param data_mime_type mime-type of data (not of the original file); 459 * @param data_mime_type mime-type of data (not of the original file);
460 * can be NULL (if mime-type is not known) 460 * can be NULL (if mime-type is not known)
461 * @param data actual meta-data found 461 * @param data actual meta-data found
diff --git a/src/fs/gnunet-fs-gtk-event_handler.c b/src/fs/gnunet-fs-gtk-event_handler.c
index 826ff173..4c41191f 100644
--- a/src/fs/gnunet-fs-gtk-event_handler.c
+++ b/src/fs/gnunet-fs-gtk-event_handler.c
@@ -451,7 +451,7 @@ delete_stale_subtree (GtkTreeModel * model, GtkTreeIter * iter)
451 451
452 452
453/** 453/**
454 * Handle the case where an active download lost its 454 * Handle the case where an active download lost its
455 * search parent by moving it to the URI tab. 455 * search parent by moving it to the URI tab.
456 */ 456 */
457static struct DownloadEntry * 457static struct DownloadEntry *
@@ -748,8 +748,8 @@ search_list_on_menu (GtkWidget * widget, GdkEvent * event, gpointer user_data)
748 * - view full meta data (in new window) 748 * - view full meta data (in new window)
749 * - copy URI to clipboard 749 * - copy URI to clipboard
750 * - start recursive download 750 * - start recursive download
751 * - abort active download (!) 751 * - abort active download (!)
752 * => need to know download status before creating menu! 752 * => need to know download status before creating menu!
753 */ 753 */
754 menu = GTK_MENU (gtk_menu_new ()); 754 menu = GTK_MENU (gtk_menu_new ());
755 if (sr->download == NULL) 755 if (sr->download == NULL)
@@ -977,7 +977,7 @@ stop_search (GtkButton * button, gpointer user_data)
977 * Stop completed downloads (or those that failed). Should 977 * Stop completed downloads (or those that failed). Should
978 * iterate over the underlying tree store and stop all 978 * iterate over the underlying tree store and stop all
979 * completed entries. Furthermore, if the resulting tree 979 * completed entries. Furthermore, if the resulting tree
980 * store is empty and has no search associated with it, 980 * store is empty and has no search associated with it,
981 * the tab should be closed. 981 * the tab should be closed.
982 */ 982 */
983static void 983static void
@@ -1331,7 +1331,7 @@ process_search_result (void *cls, struct SearchResult *parent,
1331 * the URI tab first. 1331 * the URI tab first.
1332 * 1332 *
1333 * @param iter set to the new entry 1333 * @param iter set to the new entry
1334 * @param srp set to search result 1334 * @param srp set to search result
1335 * @param meta metadata for the new entry 1335 * @param meta metadata for the new entry
1336 * @param uri URI for the new entry 1336 * @param uri URI for the new entry
1337 * @return NULL on error, otherwise tree store matching iter 1337 * @return NULL on error, otherwise tree store matching iter
@@ -1493,11 +1493,11 @@ free_search_result (struct SearchResult *sr)
1493 tm = gtk_tree_row_reference_get_model (sr->rr); 1493 tm = gtk_tree_row_reference_get_model (sr->rr);
1494 GNUNET_assert (tm != NULL); 1494 GNUNET_assert (tm != NULL);
1495 if (TRUE != gtk_tree_model_get_iter (tm, &iter, tp)) 1495 if (TRUE != gtk_tree_model_get_iter (tm, &iter, tp))
1496 { 1496 {
1497 GNUNET_break (0); 1497 GNUNET_break (0);
1498 gtk_tree_path_free (tp); 1498 gtk_tree_path_free (tp);
1499 return; 1499 return;
1500 } 1500 }
1501 gtk_tree_path_free (tp); 1501 gtk_tree_path_free (tp);
1502 gtk_tree_model_get (tm, &iter, 0, &meta, 1, &uri, -1); 1502 gtk_tree_model_get (tm, &iter, 0, &meta, 1, &uri, -1);
1503 if (uri != NULL) 1503 if (uri != NULL)
@@ -1621,9 +1621,9 @@ setup_publish (struct GNUNET_FS_PublishContext *pc, const char *fn,
1621 1621
1622 1622
1623/** 1623/**
1624 * Notification of FS to a client about the progress of an 1624 * Notification of FS to a client about the progress of an
1625 * operation. Callbacks of this type will be used for uploads, 1625 * operation. Callbacks of this type will be used for uploads,
1626 * downloads and searches. Some of the arguments depend a bit 1626 * downloads and searches. Some of the arguments depend a bit
1627 * in their meaning on the context in which the callback is used. 1627 * in their meaning on the context in which the callback is used.
1628 * 1628 *
1629 * @param cls closure 1629 * @param cls closure
diff --git a/src/fs/gnunet-fs-gtk-event_handler.h b/src/fs/gnunet-fs-gtk-event_handler.h
index 6658af32..fcca7cef 100644
--- a/src/fs/gnunet-fs-gtk-event_handler.h
+++ b/src/fs/gnunet-fs-gtk-event_handler.h
@@ -141,7 +141,7 @@ struct DownloadEntry
141 * the URI tab first. 141 * the URI tab first.
142 * 142 *
143 * @param iter set to the new entry 143 * @param iter set to the new entry
144 * @param srp set to search result 144 * @param srp set to search result
145 * @param meta metadata for the new entry 145 * @param meta metadata for the new entry
146 * @param uri URI for the new entry 146 * @param uri URI for the new entry
147 * @return NULL on error, otherwise search tab with the new entry 147 * @return NULL on error, otherwise search tab with the new entry
@@ -175,9 +175,9 @@ GNUNET_GTK_add_search_result (struct SearchTab *tab, GtkTreeIter * iter,
175 175
176 176
177/** 177/**
178 * Notification of FS to a client about the progress of an 178 * Notification of FS to a client about the progress of an
179 * operation. Callbacks of this type will be used for uploads, 179 * operation. Callbacks of this type will be used for uploads,
180 * downloads and searches. Some of the arguments depend a bit 180 * downloads and searches. Some of the arguments depend a bit
181 * in their meaning on the context in which the callback is used. 181 * in their meaning on the context in which the callback is used.
182 * 182 *
183 * @param cls closure 183 * @param cls closure
diff --git a/src/fs/gnunet-fs-gtk-main_window_file_publish.c b/src/fs/gnunet-fs-gtk-main_window_file_publish.c
index 0422c068..c4ad5117 100644
--- a/src/fs/gnunet-fs-gtk-main_window_file_publish.c
+++ b/src/fs/gnunet-fs-gtk-main_window_file_publish.c
@@ -437,7 +437,7 @@ struct AddDirContext
437 * used in the main libextractor library and yielding 437 * used in the main libextractor library and yielding
438 * meta data). 438 * meta data).
439 * @param type libextractor-type describing the meta data 439 * @param type libextractor-type describing the meta data
440 * @param format basic format information about data 440 * @param format basic format information about data
441 * @param data_mime_type mime-type of data (not of the original file); 441 * @param data_mime_type mime-type of data (not of the original file);
442 * can be NULL (if mime-type is not known) 442 * can be NULL (if mime-type is not known)
443 * @param data actual meta-data found 443 * @param data actual meta-data found
@@ -670,7 +670,7 @@ struct MetaProcessContext
670 struct GNUNET_CONTAINER_MetaData *md; 670 struct GNUNET_CONTAINER_MetaData *md;
671 671
672 /** 672 /**
673 * How often does a keyword have to occur to be 673 * How often does a keyword have to occur to be
674 * migrated to the parent? 674 * migrated to the parent?
675 */ 675 */
676 unsigned int threshold; 676 unsigned int threshold;
@@ -704,7 +704,7 @@ migrate_and_drop (void *cls, const GNUNET_HashCode * key, void *value)
704 * Go over the collected meta data from all entries in the 704 * Go over the collected meta data from all entries in the
705 * directory and push common meta data up one level (by 705 * directory and push common meta data up one level (by
706 * adding it to the returned struct). 706 * adding it to the returned struct).
707 * 707 *
708 * @param adc collection of child meta data 708 * @param adc collection of child meta data
709 * @return meta data to moved to parent 709 * @return meta data to moved to parent
710 */ 710 */
diff --git a/src/include/gnunet_gtk.h b/src/include/gnunet_gtk.h
index 39c9389e..f5e61bb7 100644
--- a/src/include/gnunet_gtk.h
+++ b/src/include/gnunet_gtk.h
@@ -59,7 +59,7 @@ GNUNET_GTK_set_icon_search_path ();
59/** 59/**
60 * Get the name of the directory where all of our package 60 * Get the name of the directory where all of our package
61 * data is stored ($PREFIX/share/) 61 * data is stored ($PREFIX/share/)
62 * 62 *
63 * @return name of the data directory 63 * @return name of the data directory
64 */ 64 */
65const char * 65const char *
diff --git a/src/lib/eventloop.c b/src/lib/eventloop.c
index 42a2b89d..cc0ab120 100644
--- a/src/lib/eventloop.c
+++ b/src/lib/eventloop.c
@@ -27,11 +27,11 @@
27 27
28#define DEBUG_EVENTLOOP GNUNET_NO 28#define DEBUG_EVENTLOOP GNUNET_NO
29 29
30/** 30/**
31 * Initial size of our poll array cache. 31 * Initial size of our poll array cache.
32 * 32 *
33 * TODO: get some statistics, find the maximum number of fds ever 33 * TODO: get some statistics, find the maximum number of fds ever
34 * polled during normal gnunet-gtk operation, and set this to that number. 34 * polled during normal gnunet-gtk operation, and set this to that number.
35 */ 35 */
36#define INITIAL_POLL_ARRAY_SIZE 30 36#define INITIAL_POLL_ARRAY_SIZE 30
37 37
@@ -178,8 +178,12 @@ void
178GNUNET_GTK_main_loop_quit (struct GNUNET_GTK_MainLoop *ml) 178GNUNET_GTK_main_loop_quit (struct GNUNET_GTK_MainLoop *ml)
179{ 179{
180 g_main_loop_quit (ml->gml); 180 g_main_loop_quit (ml->gml);
181 GNUNET_SCHEDULER_cancel (ml->dummy_task); 181 ml->gml = NULL;
182 ml->dummy_task = GNUNET_SCHEDULER_NO_TASK; 182 if (GNUNET_SCHEDULER_NO_TASK != ml->dummy_task)
183 {
184 GNUNET_SCHEDULER_cancel (ml->dummy_task);
185 ml->dummy_task = GNUNET_SCHEDULER_NO_TASK;
186 }
183} 187}
184 188
185 189
@@ -546,18 +550,20 @@ gnunet_gtk_select (void *cls, struct GNUNET_NETWORK_FDSet *rfds,
546#endif 550#endif
547 551
548 /* combine with Gtk events */ 552 /* combine with Gtk events */
549 g_main_context_prepare (ml->gmc, &max_priority); 553 if (NULL != ml->gmc)
550 while (1)
551 { 554 {
552 need_gfds = 555 g_main_context_prepare (ml->gmc, &max_priority);
553 g_main_context_query (ml->gmc, max_priority, &delay, 556 while (1)
554 &ml->cached_poll_array[fd_counter], 557 {
555 ml->cached_poll_array_size - fd_counter); 558 need_gfds =
556 if (ml->cached_poll_array_size >= need_gfds + fd_counter) 559 g_main_context_query (ml->gmc, max_priority, &delay,
557 break; 560 &ml->cached_poll_array[fd_counter],
558 resize_cached_poll_array (ml, fd_counter + need_gfds); 561 ml->cached_poll_array_size - fd_counter);
562 if (ml->cached_poll_array_size >= need_gfds + fd_counter)
563 break;
564 resize_cached_poll_array (ml, fd_counter + need_gfds);
565 }
559 } 566 }
560
561 if (timeout.rel_value != GNUNET_TIME_UNIT_FOREVER_REL.rel_value) 567 if (timeout.rel_value != GNUNET_TIME_UNIT_FOREVER_REL.rel_value)
562 { 568 {
563 if (delay >= 0) 569 if (delay >= 0)
@@ -597,12 +603,14 @@ gnunet_gtk_select (void *cls, struct GNUNET_NETWORK_FDSet *rfds,
597 * from within a task (currently we're not in a task, but in a select() call, remember) 603 * from within a task (currently we're not in a task, but in a select() call, remember)
598 * Startup reason is used to pass the scheduler sanity check. 604 * Startup reason is used to pass the scheduler sanity check.
599 */ 605 */
600 if (TRUE == 606 if (NULL != ml->gmc)
601 g_main_context_check (ml->gmc, max_priority, 607 {
602 &ml->cached_poll_array[fd_counter], need_gfds)) 608 if (TRUE ==
603 GNUNET_SCHEDULER_add_continuation (&dispatch_gtk_task, ml, 609 g_main_context_check (ml->gmc, max_priority,
604 GNUNET_SCHEDULER_REASON_STARTUP); 610 &ml->cached_poll_array[fd_counter], need_gfds))
605 611 GNUNET_SCHEDULER_add_continuation (&dispatch_gtk_task, ml,
612 GNUNET_SCHEDULER_REASON_STARTUP);
613 }
606 /* Now map back GNUnet scheduler events ... */ 614 /* Now map back GNUnet scheduler events ... */
607#if !WINDOWS 615#if !WINDOWS
608 if (NULL != rfds) 616 if (NULL != rfds)
diff --git a/src/lib/glade.c b/src/lib/glade.c
index b230bd1c..90c4649e 100644
--- a/src/lib/glade.c
+++ b/src/lib/glade.c
@@ -44,7 +44,7 @@ GNUNET_GTK_set_icon_search_path ()
44/** 44/**
45 * Get the name of the directory where all of our package 45 * Get the name of the directory where all of our package
46 * data is stored ($PREFIX/share/) 46 * data is stored ($PREFIX/share/)
47 * 47 *
48 * @return name of the data directory 48 * @return name of the data directory
49 */ 49 */
50const char * 50const char *
diff --git a/src/peerinfo/gnunet-peerinfo-gtk-about.c b/src/peerinfo/gnunet-peerinfo-gtk-about.c
index 12bc9fd8..68994424 100644
--- a/src/peerinfo/gnunet-peerinfo-gtk-about.c
+++ b/src/peerinfo/gnunet-peerinfo-gtk-about.c
@@ -32,7 +32,8 @@
32 * This displays an about window 32 * This displays an about window
33 */ 33 */
34void 34void
35GNUNET_PEERINFO_GTK_main_menu_help_about_activate_cb (GtkWidget * dummy, gpointer data) 35GNUNET_PEERINFO_GTK_main_menu_help_about_activate_cb (GtkWidget * dummy,
36 gpointer data)
36{ 37{
37 GNUNET_GTK_display_about ("gnunet_peerinfo_gtk_about_dialog.glade", 38 GNUNET_GTK_display_about ("gnunet_peerinfo_gtk_about_dialog.glade",
38 "GNUNET_PEERINFO_GTK_about_dialog"); 39 "GNUNET_PEERINFO_GTK_about_dialog");
diff --git a/src/peerinfo/gnunet-peerinfo-gtk-flags.c b/src/peerinfo/gnunet-peerinfo-gtk-flags.c
index 6c45e97c..4970a098 100644
--- a/src/peerinfo/gnunet-peerinfo-gtk-flags.c
+++ b/src/peerinfo/gnunet-peerinfo-gtk-flags.c
@@ -81,10 +81,8 @@ GNUNET_PEERINFO_GTK_get_flag (const char *cc)
81 81
82 if (NULL == cc) 82 if (NULL == cc)
83 return NULL; 83 return NULL;
84 if ((0 == strcasecmp (cc, "edu")) || 84 if ((0 == strcasecmp (cc, "edu")) || (0 == strcasecmp (cc, "com")) ||
85 (0 == strcasecmp (cc, "com")) || 85 (0 == strcasecmp (cc, "net")) || (0 == strcasecmp (cc, "org")) ||
86 (0 == strcasecmp (cc, "net")) ||
87 (0 == strcasecmp (cc, "org")) ||
88 (0 == strcasecmp (cc, "gov")) || (0 == strcasecmp (cc, "mil"))) 86 (0 == strcasecmp (cc, "gov")) || (0 == strcasecmp (cc, "mil")))
89 cc = "us"; 87 cc = "us";
90 if (0 == strcasecmp (cc, "uk")) 88 if (0 == strcasecmp (cc, "uk"))
@@ -93,51 +91,43 @@ GNUNET_PEERINFO_GTK_get_flag (const char *cc)
93 return NULL; 91 return NULL;
94 pos = flags_head; 92 pos = flags_head;
95 while (pos != NULL) 93 while (pos != NULL)
96 { 94 {
97 if (0 == strcmp (pos->cc, cc)) 95 if (0 == strcmp (pos->cc, cc))
98 return pos->flag; 96 return pos->flag;
99 pos = pos->next; 97 pos = pos->next;
100 } 98 }
101 mcc = GNUNET_strdup (cc); 99 mcc = GNUNET_strdup (cc);
102 for (i = 0; i < strlen (mcc); i++) 100 for (i = 0; i < strlen (mcc); i++)
103 mcc[i] = tolower (mcc[i]); 101 mcc[i] = tolower (mcc[i]);
104 dir = GNUNET_GTK_installation_get_path (GNUNET_OS_IPK_DATADIR); 102 dir = GNUNET_GTK_installation_get_path (GNUNET_OS_IPK_DATADIR);
105 GNUNET_asprintf (&fn, 103 GNUNET_asprintf (&fn, "%sgnunet-gtk%sflags%s%s.png", dir, DIR_SEPARATOR_STR,
106 "%sgnunet-gtk%sflags%s%s.png", 104 DIR_SEPARATOR_STR, mcc);
107 dir,
108 DIR_SEPARATOR_STR,
109 DIR_SEPARATOR_STR,
110 mcc);
111 GNUNET_free (dir); 105 GNUNET_free (dir);
112 flagBuf = gdk_pixbuf_new_from_file (fn, NULL); 106 flagBuf = gdk_pixbuf_new_from_file (fn, NULL);
113 pos = GNUNET_malloc (sizeof (struct Flag)); 107 pos = GNUNET_malloc (sizeof (struct Flag));
114 pos->cc = mcc; 108 pos->cc = mcc;
115 pos->flag = flagBuf; 109 pos->flag = flagBuf;
116 GNUNET_CONTAINER_DLL_insert (flags_head, 110 GNUNET_CONTAINER_DLL_insert (flags_head, flags_tail, pos);
117 flags_tail,
118 pos);
119 return flagBuf; 111 return flagBuf;
120} 112}
121 113
122 114
123/** 115/**
124 * Deallocate all cached flags. 116 * Deallocate all cached flags.
125 */ 117 */
126void 118void
127GNUNET_PEERINFO_GTK_flags_shutdown () 119GNUNET_PEERINFO_GTK_flags_shutdown ()
128{ 120{
129 struct Flag *flag; 121 struct Flag *flag;
130 122
131 while (NULL != (flag = flags_head)) 123 while (NULL != (flag = flags_head))
132 { 124 {
133 GNUNET_CONTAINER_DLL_remove (flags_head, 125 GNUNET_CONTAINER_DLL_remove (flags_head, flags_tail, flag);
134 flags_tail, 126 if (flag->flag != NULL)
135 flag); 127 g_object_unref (flag->flag);
136 if (flag->flag != NULL) 128 GNUNET_free (flag->cc);
137 g_object_unref (flag->flag); 129 GNUNET_free (flag);
138 GNUNET_free (flag->cc); 130 }
139 GNUNET_free (flag);
140 }
141} 131}
142 132
143 133
diff --git a/src/peerinfo/gnunet-peerinfo-gtk-flags.h b/src/peerinfo/gnunet-peerinfo-gtk-flags.h
index 6e0d06fd..e4ed39d9 100644
--- a/src/peerinfo/gnunet-peerinfo-gtk-flags.h
+++ b/src/peerinfo/gnunet-peerinfo-gtk-flags.h
@@ -42,7 +42,7 @@ GNUNET_PEERINFO_GTK_get_flag (const char *cc);
42 42
43/** 43/**
44 * Deallocate all cached flags. 44 * Deallocate all cached flags.
45 */ 45 */
46void 46void
47GNUNET_PEERINFO_GTK_flags_shutdown (void); 47GNUNET_PEERINFO_GTK_flags_shutdown (void);
48 48
diff --git a/src/peerinfo/gnunet-peerinfo-gtk.c b/src/peerinfo/gnunet-peerinfo-gtk.c
index 42e44317..7f1d3442 100644
--- a/src/peerinfo/gnunet-peerinfo-gtk.c
+++ b/src/peerinfo/gnunet-peerinfo-gtk.c
@@ -54,7 +54,7 @@ struct PeerInfo
54 * Total number of addresses found. 54 * Total number of addresses found.
55 */ 55 */
56 guint palc_counter; 56 guint palc_counter;
57 57
58}; 58};
59 59
60 60
@@ -108,7 +108,7 @@ get_object (const char *name)
108 108
109 109
110/** 110/**
111 * Function called on each entry in the 'peer2info' map 111 * Function called on each entry in the 'peer2info' map
112 * to free the associated path. 112 * to free the associated path.
113 * 113 *
114 * @param cls unused 114 * @param cls unused
@@ -117,19 +117,17 @@ get_object (const char *name)
117 * @return GNUNET_OK (continue to iterate) 117 * @return GNUNET_OK (continue to iterate)
118 */ 118 */
119static int 119static int
120free_paths (void *cls, 120free_paths (void *cls, const GNUNET_HashCode * key, void *value)
121 const GNUNET_HashCode *key,
122 void *value)
123{ 121{
124 struct PeerInfo *info = value; 122 struct PeerInfo *info = value;
125 123
126 if (NULL != info->palc) 124 if (NULL != info->palc)
127 { 125 {
128 GNUNET_TRANSPORT_peer_address_lookup_cancel (info->palc); 126 GNUNET_TRANSPORT_peer_address_lookup_cancel (info->palc);
129 info->palc = NULL; 127 info->palc = NULL;
130 GNUNET_free (info->palc_accumulator); 128 GNUNET_free (info->palc_accumulator);
131 info->palc_accumulator = NULL; 129 info->palc_accumulator = NULL;
132 } 130 }
133 gtk_tree_row_reference_free (info->rr); 131 gtk_tree_row_reference_free (info->rr);
134 GNUNET_free (info); 132 GNUNET_free (info);
135 return GNUNET_OK; 133 return GNUNET_OK;
@@ -143,8 +141,7 @@ free_paths (void *cls,
143 * @param tc scheduler context, unused 141 * @param tc scheduler context, unused
144 */ 142 */
145static void 143static void
146shutdown_task (void *cls, 144shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
147 const struct GNUNET_SCHEDULER_TaskContext *tc)
148{ 145{
149 GNUNET_PEERINFO_notify_cancel (pnc); 146 GNUNET_PEERINFO_notify_cancel (pnc);
150 pnc = NULL; 147 pnc = NULL;
@@ -153,9 +150,7 @@ shutdown_task (void *cls,
153 GNUNET_CORE_disconnect (core); 150 GNUNET_CORE_disconnect (core);
154 core = NULL; 151 core = NULL;
155 } 152 }
156 GNUNET_CONTAINER_multihashmap_iterate (peer2info, 153 GNUNET_CONTAINER_multihashmap_iterate (peer2info, &free_paths, NULL);
157 &free_paths,
158 NULL);
159 GNUNET_CONTAINER_multihashmap_destroy (peer2info); 154 GNUNET_CONTAINER_multihashmap_destroy (peer2info);
160 peer2info = NULL; 155 peer2info = NULL;
161 GNUNET_PEERINFO_GTK_flags_shutdown (); 156 GNUNET_PEERINFO_GTK_flags_shutdown ();
@@ -169,8 +164,7 @@ shutdown_task (void *cls,
169 * @param address NULL on error, otherwise 0-terminated printable UTF-8 string 164 * @param address NULL on error, otherwise 0-terminated printable UTF-8 string
170 */ 165 */
171static void 166static void
172peer_address_cb (void *cls, 167peer_address_cb (void *cls, const char *address)
173 const char *address)
174{ 168{
175 struct PeerInfo *info = cls; 169 struct PeerInfo *info = cls;
176 char *tmp; 170 char *tmp;
@@ -183,41 +177,34 @@ peer_address_cb (void *cls,
183 char *country; 177 char *country;
184 178
185 if (NULL == address) 179 if (NULL == address)
180 {
181 /* last address, store information in model */
182 country = NULL;
183 colon = strstr (info->palc_accumulator, ":");
184 if (NULL != colon)
186 { 185 {
187 /* last address, store information in model */ 186 for (dot = colon - 1; dot != info->palc_accumulator; dot--)
188 country = NULL; 187 if ('.' == *dot)
189 colon = strstr (info->palc_accumulator, ":"); 188 break;
190 if (NULL != colon) 189 if ('.' == *dot)
191 { 190 country = GNUNET_strndup (&dot[1], (colon - dot) - 1);
192 for (dot = colon - 1; dot != info->palc_accumulator; dot--)
193 if ('.' == *dot)
194 break;
195 if ('.' == *dot)
196 country = GNUNET_strndup (&dot[1], (colon - dot) - 1);
197 }
198 ls = GTK_LIST_STORE (get_object ("GNUNET_PEERINFO_GTK_list_store"));
199 tm = GTK_TREE_MODEL (ls);
200 path = gtk_tree_row_reference_get_path (info->rr);
201 GNUNET_assert (NULL != path);
202 GNUNET_assert (TRUE ==
203 gtk_tree_model_get_iter (tm, &iter, path));
204 gtk_tree_path_free (path);
205 gtk_list_store_set (ls, &iter,
206 1, info->palc_counter,
207 2, country,
208 3, GNUNET_PEERINFO_GTK_get_flag (country),
209 6, &info->palc_accumulator[1],
210 -1);
211 GNUNET_free_non_null (country);
212 info->palc = NULL;
213 GNUNET_free (info->palc_accumulator);
214 info->palc_accumulator = NULL;
215 return;
216 } 191 }
217 GNUNET_asprintf (&tmp, 192 ls = GTK_LIST_STORE (get_object ("GNUNET_PEERINFO_GTK_list_store"));
218 "%s|%s", 193 tm = GTK_TREE_MODEL (ls);
219 info->palc_accumulator, 194 path = gtk_tree_row_reference_get_path (info->rr);
220 address); 195 GNUNET_assert (NULL != path);
196 GNUNET_assert (TRUE == gtk_tree_model_get_iter (tm, &iter, path));
197 gtk_tree_path_free (path);
198 gtk_list_store_set (ls, &iter, 1, info->palc_counter, 2, country, 3,
199 GNUNET_PEERINFO_GTK_get_flag (country), 6,
200 &info->palc_accumulator[1], -1);
201 GNUNET_free_non_null (country);
202 info->palc = NULL;
203 GNUNET_free (info->palc_accumulator);
204 info->palc_accumulator = NULL;
205 return;
206 }
207 GNUNET_asprintf (&tmp, "%s|%s", info->palc_accumulator, address);
221 GNUNET_free (info->palc_accumulator); 208 GNUNET_free (info->palc_accumulator);
222 info->palc_accumulator = tmp; 209 info->palc_accumulator = tmp;
223 info->palc_counter++; 210 info->palc_counter++;
@@ -233,10 +220,9 @@ peer_address_cb (void *cls,
233 * @param err_msg NULL if successful, otherwise contains error message 220 * @param err_msg NULL if successful, otherwise contains error message
234 */ 221 */
235static void 222static void
236peerinfo_processor (void *cls, 223peerinfo_processor (void *cls, const struct GNUNET_PeerIdentity *peer,
237 const struct GNUNET_PeerIdentity *peer, 224 const struct GNUNET_HELLO_Message *hello,
238 const struct GNUNET_HELLO_Message *hello, 225 const char *err_msg)
239 const char *err_msg)
240{ 226{
241 GtkListStore *ls; 227 GtkListStore *ls;
242 GtkTreeModel *tm; 228 GtkTreeModel *tm;
@@ -248,48 +234,43 @@ peerinfo_processor (void *cls,
248 234
249 ls = GTK_LIST_STORE (get_object ("GNUNET_PEERINFO_GTK_list_store")); 235 ls = GTK_LIST_STORE (get_object ("GNUNET_PEERINFO_GTK_list_store"));
250 if (NULL == ls) 236 if (NULL == ls)
251 { 237 {
252 GNUNET_break (0); 238 GNUNET_break (0);
253 return; 239 return;
254 } 240 }
255 tm = GTK_TREE_MODEL (ls); 241 tm = GTK_TREE_MODEL (ls);
256 info = GNUNET_CONTAINER_multihashmap_get (peer2info, 242 info = GNUNET_CONTAINER_multihashmap_get (peer2info, &peer->hashPubKey);
257 &peer->hashPubKey);
258 if (NULL == info) 243 if (NULL == info)
259 { 244 {
260 GNUNET_CRYPTO_hash_to_enc (&peer->hashPubKey, &enc); 245 GNUNET_CRYPTO_hash_to_enc (&peer->hashPubKey, &enc);
261 npid = (char *) &enc; 246 npid = (char *) &enc;
262 npid[4] = '\0'; 247 npid[4] = '\0';
263 gtk_list_store_append (ls, &iter); 248 gtk_list_store_append (ls, &iter);
264 gtk_list_store_set (ls, &iter, 249 gtk_list_store_set (ls, &iter, 0, npid, 1,
265 0, npid, 250 0 /* number of known addresses */ ,
266 1, 0 /* number of known addresses */ , 251 2, "" /* country name */ ,
267 2, "" /* country name */ , 252 3, NULL /* country flag */ ,
268 3, NULL /* country flag */ , 253 4, (guint64) 0 /* bandwidth-in */ ,
269 4, (guint64) 0 /* bandwidth-in */ , 254 5, (guint64) 0 /* bandwidth-out */ ,
270 5, (guint64) 0 /* bandwidth-out */ , 255 6, "" /* addresses as strings */ ,
271 6, "" /* addresses as strings */, 256 -1);
272 -1); 257 path = gtk_tree_model_get_path (tm, &iter);
273 path = gtk_tree_model_get_path (tm, &iter); 258 info = GNUNET_malloc (sizeof (struct PeerInfo));
274 info = GNUNET_malloc (sizeof (struct PeerInfo)); 259 info->rr = gtk_tree_row_reference_new (tm, path);
275 info->rr = gtk_tree_row_reference_new (tm, path); 260 GNUNET_assert (NULL != info->rr);
276 GNUNET_assert (NULL != info->rr); 261 gtk_tree_path_free (path);
277 gtk_tree_path_free (path); 262 GNUNET_CONTAINER_multihashmap_put (peer2info, &peer->hashPubKey, info,
278 GNUNET_CONTAINER_multihashmap_put (peer2info, 263 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
279 &peer->hashPubKey, 264 }
280 info,
281 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
282 }
283 if (NULL == info->palc) 265 if (NULL == info->palc)
284 { 266 {
285 info->palc_accumulator = GNUNET_strdup ("|"); 267 info->palc_accumulator = GNUNET_strdup ("|");
286 info->palc_counter = 0; 268 info->palc_counter = 0;
287 info->palc = GNUNET_TRANSPORT_peer_address_lookup (get_configuration(), 269 info->palc =
288 peer, 270 GNUNET_TRANSPORT_peer_address_lookup (get_configuration (), peer,
289 GNUNET_TIME_UNIT_MINUTES, 271 GNUNET_TIME_UNIT_MINUTES,
290 &peer_address_cb, 272 &peer_address_cb, info);
291 info); 273 }
292 }
293 274
294} 275}
295 276
@@ -306,17 +287,13 @@ peerinfo_processor (void *cls,
306 * @param my_identity ID of this peer, NULL if we failed 287 * @param my_identity ID of this peer, NULL if we failed
307 * @param publicKey public key of this peer, NULL if we failed 288 * @param publicKey public key of this peer, NULL if we failed
308 */ 289 */
309static void 290static void
310init_cb (void *cls, 291init_cb (void *cls, struct GNUNET_CORE_Handle *server,
311 struct GNUNET_CORE_Handle * server, 292 const struct GNUNET_PeerIdentity *my_identity,
312 const struct GNUNET_PeerIdentity * 293 const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey)
313 my_identity,
314 const struct
315 GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded
316 * publicKey)
317{ 294{
318 /* FIXME: should probably do something to my 'own' entry 295 /* FIXME: should probably do something to my 'own' entry
319 in the peerinfo list to make it stand out */ 296 * in the peerinfo list to make it stand out */
320} 297}
321 298
322 299
@@ -331,35 +308,30 @@ init_cb (void *cls,
331 * @param bandwidth_out available amount of outbound bandwidth 308 * @param bandwidth_out available amount of outbound bandwidth
332 * @param atsi performance data for the connection 309 * @param atsi performance data for the connection
333 */ 310 */
334static void 311static void
335status_cb (void *cls, 312status_cb (void *cls, const struct GNUNET_PeerIdentity *peer,
336 const struct GNUNET_PeerIdentity * peer, 313 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
337 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, 314 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
338 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, 315 struct GNUNET_TIME_Absolute timeout,
339 struct GNUNET_TIME_Absolute timeout, 316 const struct GNUNET_TRANSPORT_ATS_Information *atsi)
340 const struct GNUNET_TRANSPORT_ATS_Information* atsi)
341{ 317{
342 struct PeerInfo *info; 318 struct PeerInfo *info;
343 GtkListStore *ls; 319 GtkListStore *ls;
344 GtkTreeModel *tm; 320 GtkTreeModel *tm;
345 GtkTreeIter iter; 321 GtkTreeIter iter;
346 GtkTreePath *path; 322 GtkTreePath *path;
347 323
348 info = GNUNET_CONTAINER_multihashmap_get (peer2info, 324 info = GNUNET_CONTAINER_multihashmap_get (peer2info, &peer->hashPubKey);
349 &peer->hashPubKey);
350 if (NULL == info) 325 if (NULL == info)
351 return; /* should rarely happen... */ 326 return; /* should rarely happen... */
352 ls = GTK_LIST_STORE (get_object ("GNUNET_PEERINFO_GTK_list_store")); 327 ls = GTK_LIST_STORE (get_object ("GNUNET_PEERINFO_GTK_list_store"));
353 tm = GTK_TREE_MODEL (ls); 328 tm = GTK_TREE_MODEL (ls);
354 path = gtk_tree_row_reference_get_path (info->rr); 329 path = gtk_tree_row_reference_get_path (info->rr);
355 GNUNET_assert (NULL != path); 330 GNUNET_assert (NULL != path);
356 GNUNET_assert (TRUE == 331 GNUNET_assert (TRUE == gtk_tree_model_get_iter (tm, &iter, path));
357 gtk_tree_model_get_iter (tm, &iter, path));
358 gtk_tree_path_free (path); 332 gtk_tree_path_free (path);
359 gtk_list_store_set (ls, &iter, 333 gtk_list_store_set (ls, &iter, 4, (guint64) ntohl (bandwidth_in.value__), 5,
360 4, (guint64) ntohl (bandwidth_in.value__), 334 (guint64) ntohl (bandwidth_out.value__), -1);
361 5, (guint64) ntohl (bandwidth_out.value__),
362 -1);
363} 335}
364 336
365 337
@@ -383,30 +355,26 @@ static void
383run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 355run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
384{ 356{
385 GtkWidget *main_window; 357 GtkWidget *main_window;
358
386 ml = cls; 359 ml = cls;
387 360
388 GNUNET_GTK_set_icon_search_path (); 361 GNUNET_GTK_set_icon_search_path ();
389 GNUNET_GTK_setup_nls (); 362 GNUNET_GTK_setup_nls ();
390 peer2info = GNUNET_CONTAINER_multihashmap_create (256); 363 peer2info = GNUNET_CONTAINER_multihashmap_create (256);
391 pnc = GNUNET_PEERINFO_notify (get_configuration(), 364 pnc =
392 &peerinfo_processor, NULL); 365 GNUNET_PEERINFO_notify (get_configuration (), &peerinfo_processor, NULL);
393 if (pnc == NULL) 366 if (pnc == NULL)
394 { 367 {
395 fprintf (stderr, _("Failed to initialize communication with peerinfo service!\n")); 368 fprintf (stderr,
369 _("Failed to initialize communication with peerinfo service!\n"));
396 exit (1); 370 exit (1);
397 } 371 }
398 core = GNUNET_CORE_connect (get_configuration(), 372 core =
399 1, NULL, 373 GNUNET_CORE_connect (get_configuration (), 1, NULL, &init_cb, NULL, NULL,
400 &init_cb, 374 &status_cb, NULL, GNUNET_NO, NULL, GNUNET_NO, NULL);
401 NULL, NULL,
402 &status_cb,
403 NULL, GNUNET_NO,
404 NULL, GNUNET_NO,
405 NULL);
406 375
407 /* setup main window */ 376 /* setup main window */
408 main_window = 377 main_window = GTK_WIDGET (get_object ("GNUNET_PEERINFO_GTK_main_window"));
409 GTK_WIDGET (get_object ("GNUNET_PEERINFO_GTK_main_window"));
410 gtk_window_maximize (GTK_WINDOW (main_window)); 378 gtk_window_maximize (GTK_WINDOW (main_window));
411 GNUNET_GTK_tray_icon_create (GTK_WINDOW (main_window), 379 GNUNET_GTK_tray_icon_create (GTK_WINDOW (main_window),
412 "gnunet-gtk" /* FIXME: different icon? */ , 380 "gnunet-gtk" /* FIXME: different icon? */ ,
@@ -433,10 +401,10 @@ main (int argc, char *const *argv)
433 401
434 if (GNUNET_OK != 402 if (GNUNET_OK !=
435 GNUNET_GTK_main_loop_start ("gnunet-peerinfo-gtk", 403 GNUNET_GTK_main_loop_start ("gnunet-peerinfo-gtk",
436 "GTK GUI for inspecting GNUnet Peers", 404 "GTK GUI for inspecting GNUnet Peers", argc,
437 argc,
438 argv, options, 405 argv, options,
439 "gnunet_peerinfo_gtk_main_window.glade", &run)) 406 "gnunet_peerinfo_gtk_main_window.glade",
407 &run))
440 return 1; 408 return 1;
441 return 0; 409 return 0;
442} 410}
diff --git a/src/setup/gnunet-setup-options.c b/src/setup/gnunet-setup-options.c
index 7e62678a..7af3288a 100644
--- a/src/setup/gnunet-setup-options.c
+++ b/src/setup/gnunet-setup-options.c
@@ -471,7 +471,7 @@ load_string_list_store (const void *cls, const char *section,
471 471
472/** 472/**
473 * The GtkCellRenderer has emmited the 'edited' signal. 473 * The GtkCellRenderer has emmited the 'edited' signal.
474 * 474 *
475 * 475 *
476 * @param cls closure (unused) 476 * @param cls closure (unused)
477 * @param section section with the value (NULL) 477 * @param section section with the value (NULL)
@@ -664,7 +664,7 @@ struct DnsInfo
664/** 664/**
665 * Function called for each section in the configuration. 665 * Function called for each section in the configuration.
666 * Gather existing ttl, section names and altnames. 666 * Gather existing ttl, section names and altnames.
667 * 667 *
668 * @param cls 'struct DnsInfo**' to create 668 * @param cls 'struct DnsInfo**' to create
669 * @param section name of a section in the configuration 669 * @param section name of a section in the configuration
670 */ 670 */
@@ -696,7 +696,7 @@ collect_dns_sections (void *cls, const char *section)
696/** 696/**
697 * Function called for each section in the configuration. 697 * Function called for each section in the configuration.
698 * Removes those ending in '.gnunet.'. 698 * Removes those ending in '.gnunet.'.
699 * 699 *
700 * @param cls unused 700 * @param cls unused
701 * @param section name of a section in the configuration 701 * @param section name of a section in the configuration
702 */ 702 */
@@ -711,7 +711,7 @@ remove_dns_sections (void *cls, const char *section)
711 711
712 712
713/** 713/**
714 * Given the list store and the data in it, update the 714 * Given the list store and the data in it, update the
715 * configuration file accordingly. 715 * configuration file accordingly.
716 * 716 *
717 * @param tm model to use 717 * @param tm model to use
diff --git a/src/setup/gnunet-setup-options.h b/src/setup/gnunet-setup-options.h
index 39a322d6..31727d30 100644
--- a/src/setup/gnunet-setup-options.h
+++ b/src/setup/gnunet-setup-options.h
@@ -50,7 +50,7 @@ typedef int (*GNUNET_SETUP_LoadFunction) (const void *cls, const char *section,
50/** 50/**
51 * Modify the configuration to contain the right value for 51 * Modify the configuration to contain the right value for
52 * the option based on the state of the widget. 52 * the option based on the state of the widget.
53 * 53 *
54 * @param cls closure 54 * @param cls closure
55 * @param section section with the value 55 * @param section section with the value
56 * @param option option name 56 * @param option option name
diff --git a/src/setup/gnunet-setup.c b/src/setup/gnunet-setup.c
index e83f354e..92f72589 100644
--- a/src/setup/gnunet-setup.c
+++ b/src/setup/gnunet-setup.c
@@ -93,7 +93,7 @@ help_click_callback (GtkWidget * widget, GdkEventButton * event,
93 93
94 94
95/** 95/**
96 * Change the visibility of widgets according to the 96 * Change the visibility of widgets according to the
97 * value and visibility specification given. 97 * value and visibility specification given.
98 * 98 *
99 * @param os option specification 99 * @param os option specification
@@ -265,15 +265,17 @@ load_options ()
265 } 265 }
266 i++; 266 i++;
267 } 267 }
268
269} 268}
270 269
271 270
272/** 271/**
273 * Callback invoked if the application is supposed to exit. 272 * Actual main method that sets up the configuration window.
273 *
274 * @param cls the main loop handle
275 * @param tc scheduler context
274 */ 276 */
275void 277static void
276GNUNET_SETUP_quit_cb (GObject * object, gpointer user_data) 278cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
277{ 279{
278 struct GNUNET_CONFIGURATION_Handle *cfgDefault; 280 struct GNUNET_CONFIGURATION_Handle *cfgDefault;
279 281
@@ -295,6 +297,17 @@ GNUNET_SETUP_quit_cb (GObject * object, gpointer user_data)
295 297
296 298
297/** 299/**
300 * Callback invoked if the application is supposed to exit.
301 */
302void
303GNUNET_SETUP_quit_cb (GObject * object, gpointer user_data)
304{
305 GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_IDLE,
306 &cleanup_task, NULL);
307}
308
309
310/**
298 * Actual main method that sets up the configuration window. 311 * Actual main method that sets up the configuration window.
299 * 312 *
300 * @param cls the main loop handle 313 * @param cls the main loop handle
@@ -303,9 +316,9 @@ GNUNET_SETUP_quit_cb (GObject * object, gpointer user_data)
303static void 316static void
304run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 317run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
305{ 318{
306 ml = cls;
307 GtkWidget *main_window; 319 GtkWidget *main_window;
308 320
321 ml = cls;
309 cfg = GNUNET_CONFIGURATION_create (); 322 cfg = GNUNET_CONFIGURATION_create ();
310 (void) GNUNET_CONFIGURATION_load (cfg, cfgName); 323 (void) GNUNET_CONFIGURATION_load (cfg, cfgName);
311 main_window = GTK_WIDGET (GNUNET_SETUP_get_object ("GNUNET_setup_dialog")); 324 main_window = GTK_WIDGET (GNUNET_SETUP_get_object ("GNUNET_setup_dialog"));