aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/helper.c73
-rw-r--r--src/common/iterators.c7
-rw-r--r--src/common/logging.c20
3 files changed, 59 insertions, 41 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);
diff --git a/src/common/iterators.c b/src/common/iterators.c
index 481e2a69..3eaf87ad 100644
--- a/src/common/iterators.c
+++ b/src/common/iterators.c
@@ -35,8 +35,8 @@
35 */ 35 */
36void 36void
37GNUNET_GTK_tree_selection_selected_foreach (GtkTreeSelection * selection, 37GNUNET_GTK_tree_selection_selected_foreach (GtkTreeSelection * selection,
38 GtkTreeSelectionForeachFunc func, 38 GtkTreeSelectionForeachFunc func,
39 gpointer data) 39 gpointer data)
40{ 40{
41 unsigned int i; 41 unsigned int i;
42 unsigned int size; 42 unsigned int size;
@@ -95,7 +95,8 @@ collectAllRows (GtkTreeModel * model,
95 */ 95 */
96void 96void
97GNUNET_GTK_tree_model_foreach (GtkTreeModel * model, 97GNUNET_GTK_tree_model_foreach (GtkTreeModel * model,
98 GtkTreeSelectionForeachFunc func, gpointer data) 98 GtkTreeSelectionForeachFunc func,
99 gpointer data)
99{ 100{
100 int i; 101 int i;
101 GtkTreePath *path; 102 GtkTreePath *path;
diff --git a/src/common/logging.c b/src/common/logging.c
index a749536d..aef6fa46 100644
--- a/src/common/logging.c
+++ b/src/common/logging.c
@@ -44,7 +44,9 @@ init ()
44 if (statusXML != NULL) 44 if (statusXML != NULL)
45 return; 45 return;
46 statusXML 46 statusXML
47 = glade_xml_new (GNUNET_GTK_get_glade_filename (), "statusWindow", PACKAGNUNET_GENAME); 47 =
48 glade_xml_new (GNUNET_GTK_get_glade_filename (), "statusWindow",
49 PACKAGNUNET_GENAME);
48 infoWindow = glade_xml_get_widget (statusXML, "statusWindow"); 50 infoWindow = glade_xml_get_widget (statusXML, "statusWindow");
49 infoWindowTextView 51 infoWindowTextView
50 = glade_xml_get_widget (statusXML, "messageWindowTextView"); 52 = glade_xml_get_widget (statusXML, "messageWindowTextView");
@@ -126,22 +128,23 @@ saveAddLogEntry (void *args)
126 static GtkWidget *s = NULL; 128 static GtkWidget *s = NULL;
127 static int once = 1; 129 static int once = 1;
128 static guint id; 130 static guint id;
129 char * val; 131 char *val;
130 132
131 init (); 133 init ();
132 if (once) 134 if (once)
133 { 135 {
134 once = 0; 136 once = 0;
135 s = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "statusbar"); 137 s =
138 glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "statusbar");
136 id = gtk_statusbar_get_context_id (GTK_STATUSBAR (s), "LOG"); 139 id = gtk_statusbar_get_context_id (GTK_STATUSBAR (s), "LOG");
137 } 140 }
138 else 141 else
139 gtk_statusbar_pop (GTK_STATUSBAR (s), id); 142 gtk_statusbar_pop (GTK_STATUSBAR (s), id);
140 val = GNUNET_strdup((const char*) args); 143 val = GNUNET_strdup ((const char *) args);
141 if (strstr(val, "\n") != NULL) 144 if (strstr (val, "\n") != NULL)
142 strstr(val, "\n")[0] = '\0'; 145 strstr (val, "\n")[0] = '\0';
143 gtk_statusbar_push (GTK_STATUSBAR (s), id, val); 146 gtk_statusbar_push (GTK_STATUSBAR (s), id, val);
144 GNUNET_free(val); 147 GNUNET_free (val);
145 return NULL; 148 return NULL;
146} 149}
147 150
@@ -183,7 +186,8 @@ GNUNET_GTK_create_gtk_logger (GNUNET_GEKIND mask)
183 struct GNUNET_GEContext *myLog; 186 struct GNUNET_GEContext *myLog;
184 187
185 myLog = GNUNET_GEcreate_context_callback (mask, 188 myLog = GNUNET_GEcreate_context_callback (mask,
186 &ge_gtk_log_handler, NULL, NULL, NULL); 189 &ge_gtk_log_handler, NULL, NULL,
190 NULL);
187 return myLog; 191 return myLog;
188} 192}
189 193