aboutsummaryrefslogtreecommitdiff
path: root/src/common/helper.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/helper.c')
-rw-r--r--src/common/helper.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/common/helper.c b/src/common/helper.c
index c2d9a971..f323658e 100644
--- a/src/common/helper.c
+++ b/src/common/helper.c
@@ -53,7 +53,7 @@ static GtkWidget * infoWindow;
53static GtkWidget * infoWindowTextView; 53static GtkWidget * infoWindowTextView;
54 54
55/** 55/**
56 * the main thread 56 * the main thread
57 */ 57 */
58static PTHREAD_T mainThread; 58static PTHREAD_T mainThread;
59 59
@@ -92,7 +92,7 @@ static gboolean saveCallWrapper(gpointer data) {
92 } 92 }
93 93
94 call->func(call->args); 94 call->func(call->args);
95 if (call->sem != NULL) 95 if (call->sem != NULL)
96 SEMAPHORE_UP(call->sem); 96 SEMAPHORE_UP(call->sem);
97 return FALSE; 97 return FALSE;
98} 98}
@@ -102,7 +102,7 @@ static gboolean saveCallWrapper(gpointer data) {
102 * Since GTK doesn't work with multi-threaded applications under Windows, 102 * Since GTK doesn't work with multi-threaded applications under Windows,
103 * all GTK operations have to be done in the main thread 103 * all GTK operations have to be done in the main thread
104 */ 104 */
105void gtkSaveCall(SimpleCallback func, 105void gtkSaveCall(SimpleCallback func,
106 void * args) { 106 void * args) {
107 SaveCall call; 107 SaveCall call;
108 108
@@ -146,7 +146,7 @@ int gtkRunSomeSaveCalls() {
146 /* sleep here is somewhat important, first of 146 /* sleep here is somewhat important, first of
147 all, after completion we need to give the 147 all, after completion we need to give the
148 semaphore-mechanism time to remove the save-call 148 semaphore-mechanism time to remove the save-call
149 from the list to avoid running it twice; 149 from the list to avoid running it twice;
150 also, this function might be called in a tight 150 also, this function might be called in a tight
151 loop (see search.c), so we should give the 151 loop (see search.c), so we should give the
152 other threads some time to run. */ 152 other threads some time to run. */
@@ -155,7 +155,7 @@ int gtkRunSomeSaveCalls() {
155} 155}
156 156
157/** 157/**
158 * Callback for handling "delete_event": close the window 158 * Callback for handling "delete_event": close the window
159 */ 159 */
160gint on_statusWindow_delete_event(GtkWidget * widget, 160gint on_statusWindow_delete_event(GtkWidget * widget,
161 GdkEvent * event, 161 GdkEvent * event,
@@ -186,11 +186,11 @@ static void doInfoMessage(void * args) {
186 gtk_text_buffer_get_iter_at_offset(buffer, &iter, -1); 186 gtk_text_buffer_get_iter_at_offset(buffer, &iter, -1);
187 gtk_text_buffer_insert(buffer, 187 gtk_text_buffer_insert(buffer,
188 &iter, 188 &iter,
189 info->note, 189 info->note,
190 -1); 190 -1);
191} 191}
192 192
193/** 193/**
194 * Appends a message to the info window 194 * Appends a message to the info window
195 * 195 *
196 * @param doPopup do we open the window, YES or NO 196 * @param doPopup do we open the window, YES or NO
@@ -205,7 +205,7 @@ void infoMessage(int doPopup,
205 info.note = g_strdup_vprintf(format, args); 205 info.note = g_strdup_vprintf(format, args);
206 va_end(args); 206 va_end(args);
207 info.doPopup = doPopup; 207 info.doPopup = doPopup;
208 gtkSaveCall(&doInfoMessage, 208 gtkSaveCall(&doInfoMessage,
209 &info); 209 &info);
210 g_free(info.note); 210 g_free(info.note);
211} 211}
@@ -229,7 +229,7 @@ static void saveAddLogEntry(void * args) {
229 (const char*) args); 229 (const char*) args);
230} 230}
231 231
232/** 232/**
233 * Appends a log entry to the info window 233 * Appends a log entry to the info window
234 * 234 *
235 * @param txt the log entry 235 * @param txt the log entry
@@ -239,7 +239,7 @@ void addLogEntry(const char * txt,
239 ...) { 239 ...) {
240 va_list args; 240 va_list args;
241 gchar * note; 241 gchar * note;
242 242
243 va_start(args, txt); 243 va_start(args, txt);
244 note = g_strdup_vprintf(txt, args); 244 note = g_strdup_vprintf(txt, args);
245 va_end(args); 245 va_end(args);
@@ -397,12 +397,12 @@ void initGNUnetGTKCommon(void * callback) {
397 mainXML = glade_xml_new(gladeFile, 397 mainXML = glade_xml_new(gladeFile,
398 "mainWindow", 398 "mainWindow",
399 PACKAGE_NAME); 399 PACKAGE_NAME);
400 if (mainXML == NULL) 400 if (mainXML == NULL)
401 errexit(_("Failed to open `%s'.\n"), 401 errexit(_("Failed to open `%s'.\n"),
402 gladeFile); 402 gladeFile);
403 statusXML 403 statusXML
404 = glade_xml_new(getGladeFileName(), 404 = glade_xml_new(getGladeFileName(),
405 "statusWindow", 405 "statusWindow",
406 PACKAGE_NAME); 406 PACKAGE_NAME);
407 infoWindow 407 infoWindow
408 = glade_xml_get_widget(statusXML, 408 = glade_xml_get_widget(statusXML,
@@ -430,10 +430,10 @@ void shutdownPlugins() {
430 Plugin * next; 430 Plugin * next;
431 431
432 next = plugin->next; 432 next = plugin->next;
433 unloadPlugin(plugin); 433 unloadPlugin(plugin);
434 plugin = next; 434 plugin = next;
435 } 435 }
436 436
437 gtk_widget_destroy(infoWindow); 437 gtk_widget_destroy(infoWindow);
438 infoWindow = NULL; 438 infoWindow = NULL;
439 UNREF(statusXML); 439 UNREF(statusXML);
@@ -445,15 +445,15 @@ void shutdownPlugins() {
445 saveCallsUp = NO; 445 saveCallsUp = NO;
446 PTHREAD_REL_SELF(&mainThread); 446 PTHREAD_REL_SELF(&mainThread);
447 MUTEX_LOCK(&sclock); 447 MUTEX_LOCK(&sclock);
448 for (i=0;i<pscCount;i++) 448 for (i=0;i<pscCount;i++)
449 psc[i]->func(psc[i]); 449 psc[i]->func(psc[i]);
450 i = pscCount; 450 i = pscCount;
451 MUTEX_UNLOCK(&sclock); 451 MUTEX_UNLOCK(&sclock);
452 /* wait until all PSC-jobs have left 452 /* wait until all PSC-jobs have left
453 the gtkSaveCall method before destroying 453 the gtkSaveCall method before destroying
454 the mutex! */ 454 the mutex! */
455 while (i != 0) { 455 while (i != 0) {
456 gnunet_util_sleep(50 * cronMILLIS); 456 gnunet_util_sleep(50 * cronMILLIS);
457 MUTEX_LOCK(&sclock); 457 MUTEX_LOCK(&sclock);
458 i = pscCount; 458 i = pscCount;
459 MUTEX_UNLOCK(&sclock); 459 MUTEX_UNLOCK(&sclock);
@@ -484,7 +484,7 @@ void run_with_save_calls(PThreadMain cb,
484 PTHREAD_T doneThread; 484 PTHREAD_T doneThread;
485 void * unused; 485 void * unused;
486 struct rwsc_closure cls; 486 struct rwsc_closure cls;
487 487
488 cls.sig = SEMAPHORE_NEW(0); 488 cls.sig = SEMAPHORE_NEW(0);
489 cls.realMain = cb; 489 cls.realMain = cb;
490 cls.arg = arg; 490 cls.arg = arg;