aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/daemon/daemon.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2007-11-25 12:05:41 +0000
committerChristian Grothoff <christian@grothoff.org>2007-11-25 12:05:41 +0000
commitb7a0119555b0539e5c158e57b453176395ab878f (patch)
tree50a5b208eb3fccf587504489ebd58c7f804771f1 /src/plugins/daemon/daemon.c
parentbd0a5e5232d45c4462b4ad77b3a418440e8316d7 (diff)
downloadgnunet-gtk-b7a0119555b0539e5c158e57b453176395ab878f.tar.gz
gnunet-gtk-b7a0119555b0539e5c158e57b453176395ab878f.zip
2nd round of renaming
Diffstat (limited to 'src/plugins/daemon/daemon.c')
-rw-r--r--src/plugins/daemon/daemon.c74
1 files changed, 37 insertions, 37 deletions
diff --git a/src/plugins/daemon/daemon.c b/src/plugins/daemon/daemon.c
index d96a4409..537f19c5 100644
--- a/src/plugins/daemon/daemon.c
+++ b/src/plugins/daemon/daemon.c
@@ -33,9 +33,9 @@
33 33
34static struct GNUNET_CronManager *cron; 34static struct GNUNET_CronManager *cron;
35 35
36static struct GE_Context *ectx; 36static struct GNUNET_GEContext *ectx;
37 37
38static struct GC_Configuration *cfg; 38static struct GNUNET_GC_Configuration *cfg;
39 39
40/** 40/**
41 * cron job that periodically updates the model for the 41 * cron job that periodically updates the model for the
@@ -91,7 +91,7 @@ updateAppModelSafe (void *unused)
91 while (next != NULL); 91 while (next != NULL);
92 GNUNET_free (apps); 92 GNUNET_free (apps);
93 } 93 }
94 w = glade_xml_get_widget (getMainXML (), "applicationList"); 94 w = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "applicationList");
95 gtk_tree_view_set_model (GTK_TREE_VIEW (w), GTK_TREE_MODEL (model)); 95 gtk_tree_view_set_model (GTK_TREE_VIEW (w), GTK_TREE_MODEL (model));
96 gtk_tree_selection_set_mode (gtk_tree_view_get_selection 96 gtk_tree_selection_set_mode (gtk_tree_view_get_selection
97 (GTK_TREE_VIEW (w)), GTK_SELECTION_NONE); 97 (GTK_TREE_VIEW (w)), GTK_SELECTION_NONE);
@@ -103,7 +103,7 @@ updateAppModelSafe (void *unused)
103static void 103static void
104updateAppModel (void *dummy) 104updateAppModel (void *dummy)
105{ 105{
106 gtkSaveCall (&updateAppModelSafe, NULL); 106 GNUNET_GTK_save_call (&updateAppModelSafe, NULL);
107} 107}
108 108
109 109
@@ -121,7 +121,7 @@ doUpdateMenus (void *arg)
121 static int isLocal; 121 static int isLocal;
122 char *host; 122 char *host;
123 int canStart; 123 int canStart;
124 struct GC_Configuration *dcfg; 124 struct GNUNET_GC_Configuration *dcfg;
125 char *fn; 125 char *fn;
126 char *user; 126 char *user;
127 struct passwd *pws; 127 struct passwd *pws;
@@ -129,16 +129,16 @@ doUpdateMenus (void *arg)
129 if (once) 129 if (once)
130 { 130 {
131 once = 0; 131 once = 0;
132 killEntry = glade_xml_get_widget (getMainXML (), "stopDaemon"); 132 killEntry = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "stopDaemon");
133 launchEntry = glade_xml_get_widget (getMainXML (), "startDaemon"); 133 launchEntry = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "startDaemon");
134 statsEntryYes = glade_xml_get_widget (getMainXML (), "statusPixmapYes"); 134 statsEntryYes = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "statusPixmapYes");
135 statsEntryNo = glade_xml_get_widget (getMainXML (), "statusPixmapNo"); 135 statsEntryNo = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "statusPixmapNo");
136 statsEntryError 136 statsEntryError
137 = glade_xml_get_widget (getMainXML (), "statusPixmapError"); 137 = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "statusPixmapError");
138 chooser 138 chooser
139 = glade_xml_get_widget (getMainXML (), 139 = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),
140 "gnunetdconfigFileChooserButton"); 140 "gnunetdconfigFileChooserButton");
141 GC_get_configuration_value_string (cfg, 141 GNUNET_GC_get_configuration_value_string (cfg,
142 "NETWORK", 142 "NETWORK",
143 "HOST", "localhost", &host); 143 "HOST", "localhost", &host);
144 if (strcmp (host, "localhost") == 0) 144 if (strcmp (host, "localhost") == 0)
@@ -157,12 +157,12 @@ doUpdateMenus (void *arg)
157 { 157 {
158 if (GNUNET_disk_file_test (ectx, fn) == GNUNET_YES) 158 if (GNUNET_disk_file_test (ectx, fn) == GNUNET_YES)
159 { 159 {
160 dcfg = GC_create (); 160 dcfg = GNUNET_GC_create ();
161 canStart = 1; 161 canStart = 1;
162 if (0 != GC_parse_configuration (dcfg, fn)) 162 if (0 != GNUNET_GC_parse_configuration (dcfg, fn))
163 canStart = 0; 163 canStart = 0;
164 user = NULL; 164 user = NULL;
165 GC_get_configuration_value_string (dcfg, 165 GNUNET_GC_get_configuration_value_string (dcfg,
166 "GNUNETD", 166 "GNUNETD",
167 "USER", "", &user); 167 "USER", "", &user);
168 if (strlen (user) > 0) 168 if (strlen (user) > 0)
@@ -184,7 +184,7 @@ doUpdateMenus (void *arg)
184#endif 184#endif
185 } 185 }
186 GNUNET_free (user); 186 GNUNET_free (user);
187 GC_free (dcfg); 187 GNUNET_GC_free (dcfg);
188 } 188 }
189 g_free (fn); 189 g_free (fn);
190 } 190 }
@@ -223,7 +223,7 @@ cronCheckDaemon (void *dummy)
223 ret = 1; 223 ret = 1;
224 else 224 else
225 ret = 0; 225 ret = 0;
226 gtkSaveCall (&doUpdateMenus, &ret); 226 GNUNET_GTK_save_call (&doUpdateMenus, &ret);
227} 227}
228 228
229 229
@@ -237,7 +237,7 @@ on_startDaemon_clicked_daemon (GtkWidget * widget, gpointer data)
237 GtkWidget *chooser; 237 GtkWidget *chooser;
238 char *fn; 238 char *fn;
239 239
240 launchEntry = glade_xml_get_widget (getMainXML (), "startDaemon"); 240 launchEntry = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "startDaemon");
241 gtk_widget_set_sensitive (launchEntry, FALSE); 241 gtk_widget_set_sensitive (launchEntry, FALSE);
242 if (GNUNET_OK == GNUNET_test_daemon_running (ectx, cfg)) 242 if (GNUNET_OK == GNUNET_test_daemon_running (ectx, cfg))
243 { 243 {
@@ -246,19 +246,19 @@ on_startDaemon_clicked_daemon (GtkWidget * widget, gpointer data)
246 } 246 }
247 else 247 else
248 { 248 {
249 addLogEntry (_("Launching gnunetd...")); 249 GNUNET_GTK_add_log_entry (_("Launching gnunetd..."));
250 chooser 250 chooser
251 = glade_xml_get_widget (getMainXML (), 251 = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),
252 "gnunetdconfigFileChooserButton"); 252 "gnunetdconfigFileChooserButton");
253 fn = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser)); 253 fn = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser));
254 GE_BREAK (ectx, fn != NULL); 254 GNUNET_GEBREAK (ectx, fn != NULL);
255 if (GNUNET_SYSERR != GNUNET_daemon_start (ectx, cfg, fn, GNUNET_YES)) 255 if (GNUNET_SYSERR != GNUNET_daemon_start (ectx, cfg, fn, GNUNET_YES))
256 { 256 {
257 addLogEntry (_("Launched gnunetd")); 257 GNUNET_GTK_add_log_entry (_("Launched gnunetd"));
258 } 258 }
259 else 259 else
260 { 260 {
261 addLogEntry (_("Launching gnunetd failed")); 261 GNUNET_GTK_add_log_entry (_("Launching gnunetd failed"));
262 } 262 }
263 if (fn != NULL) 263 if (fn != NULL)
264 g_free (fn); 264 g_free (fn);
@@ -274,7 +274,7 @@ on_stopDaemon_clicked_daemon (GtkWidget * widget, gpointer data)
274 GtkWidget *killEntry = NULL; 274 GtkWidget *killEntry = NULL;
275 struct GNUNET_ClientServerConnection *sock; 275 struct GNUNET_ClientServerConnection *sock;
276 276
277 killEntry = glade_xml_get_widget (getMainXML (), "stopDaemon"); 277 killEntry = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "stopDaemon");
278 gtk_widget_set_sensitive (killEntry, FALSE); 278 gtk_widget_set_sensitive (killEntry, FALSE);
279 279
280 if (GNUNET_OK == GNUNET_test_daemon_running (ectx, cfg)) 280 if (GNUNET_OK == GNUNET_test_daemon_running (ectx, cfg))
@@ -287,14 +287,14 @@ on_stopDaemon_clicked_daemon (GtkWidget * widget, gpointer data)
287 dialog = gtk_message_dialog_new 287 dialog = gtk_message_dialog_new
288 (NULL, 288 (NULL,
289 GTK_DIALOG_MODAL, 289 GTK_DIALOG_MODAL,
290 GTK_MESSAGE_ERROR, 290 GTK_MESSAGNUNET_GEERROR,
291 GTK_BUTTONS_CLOSE, _("Error requesting shutdown of gnunetd.")); 291 GTK_BUTTONS_CLOSE, _("Error requesting shutdown of gnunetd."));
292 gtk_dialog_run (GTK_DIALOG (dialog)); 292 gtk_dialog_run (GTK_DIALOG (dialog));
293 gtk_widget_destroy (dialog); 293 gtk_widget_destroy (dialog);
294 } 294 }
295 else 295 else
296 { 296 {
297 addLogEntry (_("Terminating gnunetd...")); 297 GNUNET_GTK_add_log_entry (_("Terminating gnunetd..."));
298 } 298 }
299 GNUNET_client_connection_destroy (sock); 299 GNUNET_client_connection_destroy (sock);
300 } 300 }
@@ -302,7 +302,7 @@ on_stopDaemon_clicked_daemon (GtkWidget * widget, gpointer data)
302} 302}
303 303
304void 304void
305init_daemon (struct GE_Context *e, struct GC_Configuration *c) 305init_daemon (struct GNUNET_GEContext *e, struct GNUNET_GC_Configuration *c)
306{ 306{
307 GtkWidget *tab; 307 GtkWidget *tab;
308 GtkWidget *apps; 308 GtkWidget *apps;
@@ -313,7 +313,7 @@ init_daemon (struct GE_Context *e, struct GC_Configuration *c)
313 313
314 ectx = e; 314 ectx = e;
315 cfg = c; 315 cfg = c;
316 apps = glade_xml_get_widget (getMainXML (), "applicationList"); 316 apps = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "applicationList");
317 model = gtk_list_store_new (1, G_TYPE_STRING); 317 model = gtk_list_store_new (1, G_TYPE_STRING);
318 gtk_tree_view_set_model (GTK_TREE_VIEW (apps), GTK_TREE_MODEL (model)); 318 gtk_tree_view_set_model (GTK_TREE_VIEW (apps), GTK_TREE_MODEL (model));
319 renderer = gtk_cell_renderer_text_new (); 319 renderer = gtk_cell_renderer_text_new ();
@@ -333,31 +333,31 @@ init_daemon (struct GE_Context *e, struct GC_Configuration *c)
333 gtk_tree_view_column_set_resizable (gtk_tree_view_get_column 333 gtk_tree_view_column_set_resizable (gtk_tree_view_get_column
334 (GTK_TREE_VIEW (apps), col - 1), TRUE); 334 (GTK_TREE_VIEW (apps), col - 1), TRUE);
335 335
336 tab = glade_xml_get_widget (getMainXML (), "daemonScrolledWindow"); 336 tab = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "daemonScrolledWindow");
337 gtk_widget_show (tab); 337 gtk_widget_show (tab);
338 daemon_config = NULL; 338 daemon_config = NULL;
339 GC_get_configuration_value_filename (cfg, 339 GNUNET_GC_get_configuration_value_filename (cfg,
340 "DAEMON", 340 "DAEMON",
341 "CONFIGFILE", 341 "CONFIGFILE",
342 DEFAULT_DAEMON_CONFIG_FILE, 342 GNUNET_DEFAULT_DAEMON_CONFIG_FILE,
343 &daemon_config); 343 &daemon_config);
344 if (GNUNET_YES == GNUNET_disk_file_test (NULL, daemon_config)) 344 if (GNUNET_YES == GNUNET_disk_file_test (NULL, daemon_config))
345 { 345 {
346 gtk_file_chooser_set_filename (GTK_FILE_CHOOSER 346 gtk_file_chooser_set_filename (GTK_FILE_CHOOSER
347 (glade_xml_get_widget 347 (glade_xml_get_widget
348 (getMainXML (), 348 (GNUNET_GTK_get_main_glade_XML (),
349 "gnunetdconfigFileChooserButton")), 349 "gnunetdconfigFileChooserButton")),
350 daemon_config); 350 daemon_config);
351 } 351 }
352 else 352 else
353 { 353 {
354 addLogEntry (_ 354 GNUNET_GTK_add_log_entry (_
355 ("Configuration file for GNUnet daemon `%s' does not exist! Run `gnunet-setup -d'."), 355 ("Configuration file for GNUnet daemon `%s' does not exist! Run `gnunet-setup -d'."),
356 daemon_config); 356 daemon_config);
357 } 357 }
358 GNUNET_free (daemon_config); 358 GNUNET_free (daemon_config);
359 359
360 cron = gnunet_gtk_get_cron (); 360 cron = GNUNET_GTK_get_cron_manager ();
361 GNUNET_cron_add_job (cron, &cronCheckDaemon, 0, 15 * GNUNET_CRON_SECONDS, NULL); 361 GNUNET_cron_add_job (cron, &cronCheckDaemon, 0, 15 * GNUNET_CRON_SECONDS, NULL);
362 GNUNET_cron_add_job (cron, 362 GNUNET_cron_add_job (cron,
363 &updateAppModel, 5 * GNUNET_CRON_MINUTES, 5 * GNUNET_CRON_MINUTES, NULL); 363 &updateAppModel, 5 * GNUNET_CRON_MINUTES, 5 * GNUNET_CRON_MINUTES, NULL);
@@ -370,7 +370,7 @@ done_daemon ()
370 370
371 GNUNET_cron_del_job (cron, &cronCheckDaemon, 15 * GNUNET_CRON_SECONDS, NULL); 371 GNUNET_cron_del_job (cron, &cronCheckDaemon, 15 * GNUNET_CRON_SECONDS, NULL);
372 GNUNET_cron_del_job (cron, &updateAppModel, 5 * GNUNET_CRON_MINUTES, NULL); 372 GNUNET_cron_del_job (cron, &updateAppModel, 5 * GNUNET_CRON_MINUTES, NULL);
373 w = glade_xml_get_widget (getMainXML (), "applicationList"); 373 w = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "applicationList");
374 gtk_tree_view_set_model (GTK_TREE_VIEW (w), NULL); 374 gtk_tree_view_set_model (GTK_TREE_VIEW (w), NULL);
375 375
376} 376}
@@ -381,7 +381,7 @@ done_daemon ()
381void 381void
382on_startDaemonConfWizard_clicked_daemon (GtkWidget * widget, gpointer data) 382on_startDaemonConfWizard_clicked_daemon (GtkWidget * widget, gpointer data)
383{ 383{
384 startGNUnetSetup (TRUE); 384 GNUNET_GTK_run_gnunet_setup (TRUE);
385} 385}
386 386
387/** 387/**
@@ -390,7 +390,7 @@ on_startDaemonConfWizard_clicked_daemon (GtkWidget * widget, gpointer data)
390void 390void
391on_startDaemonConfTool_clicked_daemon (GtkWidget * widget, gpointer data) 391on_startDaemonConfTool_clicked_daemon (GtkWidget * widget, gpointer data)
392{ 392{
393 startGNUnetSetup (FALSE); 393 GNUNET_GTK_run_gnunet_setup (FALSE);
394} 394}
395 395
396/* end of daemon.c */ 396/* end of daemon.c */