aboutsummaryrefslogtreecommitdiff
path: root/src/core/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/main.c')
-rw-r--r--src/core/main.c45
1 files changed, 24 insertions, 21 deletions
diff --git a/src/core/main.c b/src/core/main.c
index 01cb1b81..60f807aa 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -26,6 +26,8 @@
26 26
27#include "platform.h" 27#include "platform.h"
28#include "gnunetgtk_common.h" 28#include "gnunetgtk_common.h"
29#include <GNUnet/gnunet_directories.h>
30#include <GNUnet/gnunet_util_boot.h>
29#include "eggtrayicon.h" 31#include "eggtrayicon.h"
30 32
31#ifdef WINDOWS 33#ifdef WINDOWS
@@ -34,6 +36,7 @@
34static int debug_mode = NO; 36static int debug_mode = NO;
35#endif 37#endif
36 38
39static char * cfgFilename = DEFAULT_CLIENT_CONFIG_FILE;
37 40
38/** 41/**
39 * All gnunet-gtk command line options 42 * All gnunet-gtk command line options
@@ -54,25 +57,29 @@ static struct CommandLineOption gnunetgtkOptions[] = {
54}; 57};
55 58
56static void * shutdownCode(void * unused) { 59static void * shutdownCode(void * unused) {
57 stopCron();
58 shutdownPlugins(); 60 shutdownPlugins();
59 return NULL; 61 return NULL;
60} 62}
61 63
62void gnunet_gtk_main_quit() { 64void gnunet_gtk_main_quit() {
63 setCustomLogProc(NULL); 65 GE_setDefaultContext(NULL);
64 run_with_save_calls(&shutdownCode, 66 run_with_save_calls(&shutdownCode,
65 NULL); 67 NULL);
66 gtk_main_quit(); 68 gtk_main_quit();
67} 69}
68 70
71#if 0
69static void customLog(const char * msg) { 72static void customLog(const char * msg) {
70 addLogEntry("%s", msg); 73 addLogEntry("%s", msg);
71} 74}
75#endif
72 76
73int main(int argc, 77int main(int argc,
74 char *argv[]) { 78 char * argv[]) {
75 GtkWidget * root; 79 GtkWidget * root;
80 int i;
81 struct GE_Context * ectx;
82 struct GC_Configuration * cfg;
76 83
77#ifdef WINDOWS 84#ifdef WINDOWS
78 SetCursor(LoadCursor(NULL, IDC_APPSTARTING)); 85 SetCursor(LoadCursor(NULL, IDC_APPSTARTING));
@@ -80,22 +87,15 @@ int main(int argc,
80 87
81 g_thread_init(NULL); 88 g_thread_init(NULL);
82 gtk_init(&argc, &argv); 89 gtk_init(&argc, &argv);
83 ectx = GE_create_context_stderr(NO, 90 i = GNUNET_init(argc,
84 GE_WARNING | GE_ERROR | GE_FATAL | 91 (const char**) argv,
85 GE_USER | GE_ADMIN | GE_DEVELOPER | 92 "gnunet-gtk",
86 GE_IMMEDIATE | GE_BULK); 93 &cfgFilename,
87 GE_setDefaultContext(ectx); 94 gnunetgtkOptions,
88 cfg = GC_create_C_impl(); 95 &ectx,
89 GE_ASSERT(ectx, cfg != NULL); 96 &cfg);
90 i = gnunet_parse_options("gnunet-insert [OPTIONS] FILENAME", 97 if (i == -1) {
91 ectx, 98 GNUNET_fini(ectx, cfg);
92 cfg,
93 gnunetinsertOptions,
94 (unsigned int) argc,
95 argv);
96 if (i == SYSERR) {
97 GC_free(cfg);
98 GE_free_context(ectx);
99 return -1; 99 return -1;
100 } 100 }
101 101
@@ -110,7 +110,9 @@ int main(int argc,
110 bind_textdomain_codeset("GNUnet", "UTF-8"); 110 bind_textdomain_codeset("GNUnet", "UTF-8");
111 bind_textdomain_codeset("gnunet-gtk", "UTF-8"); 111 bind_textdomain_codeset("gnunet-gtk", "UTF-8");
112#endif 112#endif
113 initGNUnetGTKCommon(&gnunet_gtk_main_quit); 113 initGNUnetGTKCommon(ectx,
114 cfg,
115 &gnunet_gtk_main_quit);
114 root 116 root
115 = glade_xml_get_widget(getMainXML(), 117 = glade_xml_get_widget(getMainXML(),
116 "mainWindow"); 118 "mainWindow");
@@ -119,7 +121,7 @@ int main(int argc,
119 initTrayIcon(); 121 initTrayIcon();
120#endif 122#endif
121 gtk_widget_show(root); 123 gtk_widget_show(root);
122 setCustomLogProc(&customLog); 124 // GE_setDefaultContext(customLog);
123 /* start the event loop */ 125 /* start the event loop */
124 gdk_threads_enter(); 126 gdk_threads_enter();
125 127
@@ -130,6 +132,7 @@ int main(int argc,
130 gtk_main(); 132 gtk_main();
131 gdk_threads_leave(); 133 gdk_threads_leave();
132 doneGNUnetGTKCommon(); 134 doneGNUnetGTKCommon();
135 GNUNET_fini(ectx, cfg);
133 return 0; 136 return 0;
134} 137}
135 138