aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c47
1 files changed, 22 insertions, 25 deletions
diff --git a/src/main.c b/src/main.c
index b4325e81..14525733 100644
--- a/src/main.c
+++ b/src/main.c
@@ -27,30 +27,18 @@
27#include "config.h" 27#include "config.h"
28#include "gettext.h" 28#include "gettext.h"
29 29
30#include <gtk/gtk.h>
31#include <glade/glade.h>
32
33#include <GNUnet/gnunet_util.h> 30#include <GNUnet/gnunet_util.h>
34#include <GNUnet/gnunet_ecrs_lib.h>
35#include <GNUnet/gnunet_fsui_lib.h>
36 31
37#include "main.h" 32#include "main.h"
38 33#include "fs.h"
39/** 34#include "daemon.h"
40 * FSUI event handler. 35#include "helper.h"
41 */
42static void eventProcessor(void * cls,
43 const FSUI_Event * event) {
44 printf("FSUI event received!\n");
45}
46 36
47/** 37/**
48 * Prints the usage information for this command if the user errs. 38 * Prints the usage information for this command if the user errs.
49 */ 39 */
50static void printhelp() { 40static void printhelp() {
51 static Help help[] = { 41 static Help help[] = {
52 { 'a', "anonymity", "LEVEL",
53 gettext_noop("set the desired LEVEL of receiver-anonymity") },
54 HELP_CONFIG, 42 HELP_CONFIG,
55 HELP_HELP, 43 HELP_HELP,
56 HELP_HOSTNAME, 44 HELP_HOSTNAME,
@@ -109,33 +97,42 @@ static int parseOptions(int argc,
109} 97}
110 98
111GladeXML * mainXML; 99GladeXML * mainXML;
112struct FSUI_Context * ctx;
113 100
114int main(int argc, 101int main(int argc,
115 char *argv[]) { 102 char *argv[]) {
116 103
104 g_thread_init(NULL);
117 gtk_init(&argc, &argv); 105 gtk_init(&argc, &argv);
118 if (SYSERR == initUtil(argc, 106 if (SYSERR == initUtil(argc,
119 argv, 107 argv,
120 &parseOptions)) 108 &parseOptions))
121 return 0; 109 return 0;
122 110 startCron();
111 gtkInitSaveCalls();
123 /* load the interface */ 112 /* load the interface */
124 mainXML = glade_xml_new(GLADE_FILE, 113 mainXML = glade_xml_new(GLADE_FILE,
125 "mainWindow", 114 "mainWindow",
126 NULL); 115 NULL);
127 /* connect the signals in the interface */ 116 /* connect the signals in the interface */
117 setCustomLogProc(&addLogEntry);
128 glade_xml_signal_autoconnect(mainXML); 118 glade_xml_signal_autoconnect(mainXML);
129 119 gtk_fs_init();
130 /* FSUI initialization here! */ 120 addCronJob(&cronCheckDaemon,
131 ctx = FSUI_start("gnunet-gtk", 121 0,
132 YES, 122 15 * cronSECONDS,
133 &eventProcessor, 123 NULL);
134 NULL);
135
136 /* start the event loop */ 124 /* start the event loop */
125 gdk_threads_enter();
137 gtk_main(); 126 gtk_main();
138 FSUI_stop(ctx); 127 gdk_threads_leave();
128 setCustomLogProc(NULL);
129 gtkDoneSaveCalls();
130 stopCron();
131 delCronJob(&cronCheckDaemon,
132 15 * cronSECONDS,
133 NULL);
134 gtk_fs_done();
135 g_object_unref(mainXML);
139 doneUtil(); 136 doneUtil();
140 137
141 return 0; 138 return 0;