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.c73
1 files changed, 43 insertions, 30 deletions
diff --git a/src/common/helper.c b/src/common/helper.c
index 46d99c71..0abe2f06 100644
--- a/src/common/helper.c
+++ b/src/common/helper.c
@@ -191,7 +191,9 @@ connector (const gchar * handler_name,
191 method = NULL; 191 method = NULL;
192 while (plug != NULL) 192 while (plug != NULL)
193 { 193 {
194 method = GNUNET_plugin_resolve_function (plug->library, handler_name, GNUNET_NO); 194 method =
195 GNUNET_plugin_resolve_function (plug->library, handler_name,
196 GNUNET_NO);
195 if (method != NULL) 197 if (method != NULL)
196 break; 198 break;
197 plug = plug->next; 199 plug = plug->next;
@@ -205,8 +207,9 @@ connector (const gchar * handler_name,
205 (TRUE != g_module_symbol (module, handler_name, &method))) 207 (TRUE != g_module_symbol (module, handler_name, &method)))
206 { 208 {
207 GNUNET_GELOG (ectx, 209 GNUNET_GELOG (ectx,
208 GNUNET_GEWARNING | GNUNET_GEDEVELOPER | GNUNET_GEIMMEDIATE, 210 GNUNET_GEWARNING | GNUNET_GEDEVELOPER |
209 _("Failed to find handler for `%s'\n"), handler_name); 211 GNUNET_GEIMMEDIATE,
212 _("Failed to find handler for `%s'\n"), handler_name);
210 g_module_close (module); 213 g_module_close (module);
211 return; 214 return;
212 } 215 }
@@ -299,7 +302,8 @@ unloadPlugin (void *p)
299 302
300void 303void
301GNUNET_GTK_initialize_common_library (struct GNUNET_GEContext *e, 304GNUNET_GTK_initialize_common_library (struct GNUNET_GEContext *e,
302 struct GNUNET_GC_Configuration *c, void *callback) 305 struct GNUNET_GC_Configuration *c,
306 void *callback)
303{ 307{
304 char *load; 308 char *load;
305 char *path; 309 char *path;
@@ -316,7 +320,8 @@ GNUNET_GTK_initialize_common_library (struct GNUNET_GEContext *e,
316 /* load the interface */ 320 /* load the interface */
317 path = GNUNET_get_installation_path (GNUNET_IPK_DATADIR); 321 path = GNUNET_get_installation_path (GNUNET_IPK_DATADIR);
318 filename = 322 filename =
319 GNUNET_malloc (strlen (path) + strlen ("/../gnunet-gtk/gnunet-gtk.glade") + 2); 323 GNUNET_malloc (strlen (path) +
324 strlen ("/../gnunet-gtk/gnunet-gtk.glade") + 2);
320 strcpy (filename, path); 325 strcpy (filename, path);
321 GNUNET_free (path); 326 GNUNET_free (path);
322 strcat (filename, "/../gnunet-gtk/gnunet-gtk.glade"); 327 strcat (filename, "/../gnunet-gtk/gnunet-gtk.glade");
@@ -331,13 +336,14 @@ GNUNET_GTK_initialize_common_library (struct GNUNET_GEContext *e,
331 mainXML = glade_xml_new (gladeFile, "mainWindow", PACKAGNUNET_GENAME); 336 mainXML = glade_xml_new (gladeFile, "mainWindow", PACKAGNUNET_GENAME);
332 if (mainXML == NULL) 337 if (mainXML == NULL)
333 GNUNET_GEDIE_STRERROR_FILE (ectx, 338 GNUNET_GEDIE_STRERROR_FILE (ectx,
334 GNUNET_GEFATAL | GNUNET_GEUSER | GNUNET_GEIMMEDIATE, 339 GNUNET_GEFATAL | GNUNET_GEUSER |
335 "glade_xml_new", gladeFile); 340 GNUNET_GEIMMEDIATE, "glade_xml_new",
341 gladeFile);
336 /* load the plugins */ 342 /* load the plugins */
337 GNUNET_GC_get_configuration_value_string (cfg, 343 GNUNET_GC_get_configuration_value_string (cfg,
338 "GNUNET-GTK", 344 "GNUNET-GTK",
339 "PLUGINS", 345 "PLUGINS",
340 "about daemon fs stats", &load); 346 "about daemon fs stats", &load);
341 loadPlugins (load); 347 loadPlugins (load);
342 GNUNET_free (load); 348 GNUNET_free (load);
343 GNUNET_GTK_connect_glade_with_plugins (mainXML); 349 GNUNET_GTK_connect_glade_with_plugins (mainXML);
@@ -422,7 +428,9 @@ GNUNET_GTK_run_with_save_calls (GNUNET_ThreadMainFunction cb, void *arg)
422 cls.arg = arg; 428 cls.arg = arg;
423 doneThread = GNUNET_thread_create (&shutdownCode, &cls, 64 * 1024); 429 doneThread = GNUNET_thread_create (&shutdownCode, &cls, 64 * 1024);
424 if (doneThread == NULL) 430 if (doneThread == NULL)
425 GNUNET_GEDIE_STRERROR (ectx, GNUNET_GEFATAL | GNUNET_GEADMIN | GNUNET_GEBULK, "pthread_create"); 431 GNUNET_GEDIE_STRERROR (ectx,
432 GNUNET_GEFATAL | GNUNET_GEADMIN | GNUNET_GEBULK,
433 "pthread_create");
426 if (!GNUNET_thread_test_self (mainThread)) 434 if (!GNUNET_thread_test_self (mainThread))
427 { 435 {
428 /* another thread will run the save calls */ 436 /* another thread will run the save calls */
@@ -435,7 +443,7 @@ GNUNET_GTK_run_with_save_calls (GNUNET_ThreadMainFunction cb, void *arg)
435 GNUNET_mutex_lock (sclock); 443 GNUNET_mutex_lock (sclock);
436 if (pscCount > 0) 444 if (pscCount > 0)
437 { 445 {
438 i = GNUNET_random_u32(GNUNET_RANDOM_QUALITY_WEAK, pscCount); 446 i = GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, pscCount);
439 if (TRUE == g_idle_remove_by_data (psc[i])) 447 if (TRUE == g_idle_remove_by_data (psc[i]))
440 saveCallWrapper (psc[i]); 448 saveCallWrapper (psc[i]);
441 } 449 }
@@ -444,7 +452,8 @@ GNUNET_GTK_run_with_save_calls (GNUNET_ThreadMainFunction cb, void *arg)
444 i = -1; 452 i = -1;
445 } 453 }
446 GNUNET_mutex_unlock (sclock); 454 GNUNET_mutex_unlock (sclock);
447 if ((i == -1) && (GNUNET_OK != GNUNET_semaphore_down (cls.sig, GNUNET_NO))) 455 if ((i == -1)
456 && (GNUNET_OK != GNUNET_semaphore_down (cls.sig, GNUNET_NO)))
448 { 457 {
449 GNUNET_thread_sleep (50 * GNUNET_CRON_MILLISECONDS); 458 GNUNET_thread_sleep (50 * GNUNET_CRON_MILLISECONDS);
450 } 459 }
@@ -480,13 +489,15 @@ GNUNET_GTK_notify (int type, const char *message, ...)
480 { 489 {
481 once = 1; 490 once = 1;
482 GNUNET_GELOG (ectx, 491 GNUNET_GELOG (ectx,
483 GNUNET_GEWARNING | GNUNET_GEBULK | GNUNET_GEUSER | GNUNET_GEADMIN, 492 GNUNET_GEWARNING | GNUNET_GEBULK | GNUNET_GEUSER |
484 _("Could not initialize libnotify\n")); 493 GNUNET_GEADMIN,
494 _("Could not initialize libnotify\n"));
485 return; 495 return;
486 } 496 }
487 } 497 }
488 498
489 root = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "mainWindow"); 499 root =
500 glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "mainWindow");
490 if (gtk_window_is_active (GTK_WINDOW (root)) == FALSE) 501 if (gtk_window_is_active (GTK_WINDOW (root)) == FALSE)
491 { 502 {
492 if (type == GNUNET_GTK_NOTIFY_LEVEL_LOW) 503 if (type == GNUNET_GTK_NOTIFY_LEVEL_LOW)
@@ -514,8 +525,9 @@ GNUNET_GTK_notify (int type, const char *message, ...)
514 { 525 {
515 once = 1; 526 once = 1;
516 GNUNET_GELOG (ectx, 527 GNUNET_GELOG (ectx,
517 GNUNET_GEWARNING | GNUNET_GEUSER | GNUNET_GEADMIN | GNUNET_GEBULK, 528 GNUNET_GEWARNING | GNUNET_GEUSER | GNUNET_GEADMIN |
518 _("Could not send notification via libnotify\n")); 529 GNUNET_GEBULK,
530 _("Could not send notification via libnotify\n"));
519 } 531 }
520 g_object_unref (G_OBJECT (libnotify)); 532 g_object_unref (G_OBJECT (libnotify));
521 notify_uninit (); 533 notify_uninit ();
@@ -555,7 +567,8 @@ GNUNET_GTK_validate_utf8 (char *msg)
555*/ 567*/
556void 568void
557GNUNET_GTK_save_main_window_state (GtkWidget * main_window, 569GNUNET_GTK_save_main_window_state (GtkWidget * main_window,
558 GdkEventWindowState * event, gpointer user_data) 570 GdkEventWindowState * event,
571 gpointer user_data)
559{ 572{
560 main_window_state = (*event).new_window_state; 573 main_window_state = (*event).new_window_state;
561 return; 574 return;
@@ -594,7 +607,7 @@ GNUNET_GTK_run_gnunet_setup (gboolean run_wizard)
594 { 607 {
595 error_message = 608 error_message =
596 GNUNET_strdup (_ 609 GNUNET_strdup (_
597 ("GKSu encountered an unknown error running the configuration tool (gnunet-setup).")); 610 ("GKSu encountered an unknown error running the configuration tool (gnunet-setup)."));
598 } 611 }
599 else if (code && gerror) 612 else if (code && gerror)
600 { 613 {
@@ -613,18 +626,18 @@ GNUNET_GTK_run_gnunet_setup (gboolean run_wizard)
613#else 626#else
614 error_message = 627 error_message =
615 GNUNET_strdup (_ 628 GNUNET_strdup (_
616 ("GKSu support is not enabled, impossible to get the needed rights. You should build gnunet-gtk with the --enable-libgksu2 option, or get the right binary package. Note you can still start the configuration tool (gnunet-setup) manually.")); 629 ("GKSu support is not enabled, impossible to get the needed rights. You should build gnunet-gtk with the --enable-libgksu2 option, or get the right binary package. Note you can still start the configuration tool (gnunet-setup) manually."));
617 code = TRUE; 630 code = TRUE;
618#endif 631#endif
619 mainWindow = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "mainWindow"); 632 mainWindow =
620 messageDialog = gtk_message_dialog_new (GTK_WINDOW (mainWindow), 633 glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "mainWindow");
621 GTK_DIALOG_MODAL | 634 messageDialog =
622 GTK_DIALOG_DESTROY_WITH_PARENT, 635 gtk_message_dialog_new (GTK_WINDOW (mainWindow),
623 GTK_MESSAGNUNET_GEWARNING, 636 GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
624 GTK_BUTTONS_CLOSE, 637 GTK_MESSAGNUNET_GEWARNING, GTK_BUTTONS_CLOSE,
625 _ 638 _
626 ("Failed to run the configuration tool (gnunet-setup): %s"), 639 ("Failed to run the configuration tool (gnunet-setup): %s"),
627 error_message); 640 error_message);
628 gtk_dialog_run (GTK_DIALOG (messageDialog)); 641 gtk_dialog_run (GTK_DIALOG (messageDialog));
629 gtk_widget_destroy (messageDialog); 642 gtk_widget_destroy (messageDialog);
630 GNUNET_free (error_message); 643 GNUNET_free (error_message);