diff options
Diffstat (limited to 'src/plugins/daemon/daemon.c')
-rw-r--r-- | src/plugins/daemon/daemon.c | 82 |
1 files changed, 76 insertions, 6 deletions
diff --git a/src/plugins/daemon/daemon.c b/src/plugins/daemon/daemon.c index cf8b4f43..178a4732 100644 --- a/src/plugins/daemon/daemon.c +++ b/src/plugins/daemon/daemon.c | |||
@@ -190,7 +190,7 @@ doUpdateMenus (void *arg) | |||
190 | canStart = (geteuid () == 0); | 190 | canStart = (geteuid () == 0); |
191 | else | 191 | else |
192 | canStart = 1; | 192 | canStart = 1; |
193 | } | 193 | } |
194 | #else | 194 | #else |
195 | canStart = 1; | 195 | canStart = 1; |
196 | #endif | 196 | #endif |
@@ -415,9 +415,26 @@ init_daemon (struct GNUNET_GE_Context *e, struct GNUNET_GC_Configuration *c) | |||
415 | ("Configuration file for GNUnet daemon `%s' does not exist! Run `gnunet-setup -d'.\n"), | 415 | ("Configuration file for GNUnet daemon `%s' does not exist! Run `gnunet-setup -d'.\n"), |
416 | daemon_config); | 416 | daemon_config); |
417 | } | 417 | } |
418 | |||
419 | #ifndef WITH_LIBGKSU2 | ||
420 | GtkWidget *startDaemonConfWizard; | ||
421 | GtkWidget *startDaemonConfTool; | ||
422 | |||
423 | startDaemonConfWizard | ||
424 | = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), | ||
425 | "startDaemonConfWizard"); | ||
426 | startDaemonConfTool | ||
427 | = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), | ||
428 | "startDaemonConfTool"); | ||
429 | if (0 != ACCESS (daemon_config, W_OK)) | ||
430 | { | ||
431 | gtk_widget_set_sensitive (startDaemonConfWizard, FALSE); | ||
432 | gtk_widget_set_sensitive (startDaemonConfTool, FALSE); | ||
433 | } | ||
434 | #endif | ||
418 | GNUNET_free (daemon_config); | 435 | GNUNET_free (daemon_config); |
419 | 436 | ||
420 | cron = GNUNET_GTK_get_cron_manager (); | 437 | cron = GNUNET_GTK_get_cron_manager (); |
421 | GNUNET_cron_add_job (cron, &cronCheckDaemon, 0, 15 * GNUNET_CRON_SECONDS, | 438 | GNUNET_cron_add_job (cron, &cronCheckDaemon, 0, 15 * GNUNET_CRON_SECONDS, |
422 | NULL); | 439 | NULL); |
423 | GNUNET_cron_add_job (cron, &updateAppModel, 5 * GNUNET_CRON_MINUTES, | 440 | GNUNET_cron_add_job (cron, &updateAppModel, 5 * GNUNET_CRON_MINUTES, |
@@ -437,24 +454,77 @@ done_daemon () | |||
437 | "applicationList"); | 454 | "applicationList"); |
438 | gtk_tree_view_set_model (GTK_TREE_VIEW (w), NULL); | 455 | gtk_tree_view_set_model (GTK_TREE_VIEW (w), NULL); |
439 | 456 | ||
457 | w = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "applicationList"); | ||
458 | gtk_tree_view_set_model (GTK_TREE_VIEW (w), NULL); | ||
459 | |||
440 | } | 460 | } |
441 | 461 | ||
442 | /** | 462 | /** |
443 | * Launch 'gnunet-setup -d wizard-gtk' with needed rights | 463 | * Launch 'gnunet-setup -d wizard-gtk' with needed rights |
444 | */ | 464 | */ |
445 | void | 465 | void |
446 | on_startDaemonConfWizard_clicked_daemon (GtkWidget * widget, gpointer data) | 466 | on_startDaemonConfWizard_clicked_daemon (GtkWidget *widget, gpointer data) |
447 | { | 467 | { |
448 | GNUNET_GTK_run_gnunet_setup (TRUE); | 468 | GtkWidget *filechooserbutton; |
469 | char *conffile; | ||
470 | |||
471 | filechooserbutton | ||
472 | = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), | ||
473 | "gnunetdconfigFileChooserButton"); | ||
474 | conffile = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER(filechooserbutton)); | ||
475 | GNUNET_GTK_run_gnunet_setup (conffile, TRUE); | ||
476 | GNUNET_free (conffile); | ||
449 | } | 477 | } |
450 | 478 | ||
451 | /** | 479 | /** |
452 | * Launch 'gnunet-setup -d gconfig' with needed rights | 480 | * Launch 'gnunet-setup -d gconfig' with needed rights |
453 | */ | 481 | */ |
454 | void | 482 | void |
455 | on_startDaemonConfTool_clicked_daemon (GtkWidget * widget, gpointer data) | 483 | on_startDaemonConfTool_clicked_daemon (GtkWidget *widget, gpointer data) |
456 | { | 484 | { |
457 | GNUNET_GTK_run_gnunet_setup (FALSE); | 485 | GtkWidget *filechooserbutton; |
486 | char *conffile; | ||
487 | |||
488 | filechooserbutton | ||
489 | = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), | ||
490 | "gnunetdconfigFileChooserButton"); | ||
491 | conffile = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER(filechooserbutton)); | ||
492 | GNUNET_GTK_run_gnunet_setup (conffile, FALSE); | ||
493 | GNUNET_free (conffile); | ||
494 | } | ||
495 | |||
496 | /** | ||
497 | * Update sensitivity of daemon configuration buttons | ||
498 | */ | ||
499 | void | ||
500 | on_gnunetdconfigfile_set_daemon (GtkWidget *filechooserbutton, | ||
501 | gpointer data) | ||
502 | { | ||
503 | #ifndef WITH_LIBGKSU2 | ||
504 | GtkWidget *startDaemonConfWizard; | ||
505 | GtkWidget *startDaemonConfTool; | ||
506 | char *conffile; | ||
507 | |||
508 | startDaemonConfWizard | ||
509 | = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), | ||
510 | "startDaemonConfWizard"); | ||
511 | startDaemonConfTool | ||
512 | = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), | ||
513 | "startDaemonConfTool"); | ||
514 | conffile = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER(filechooserbutton)); | ||
515 | if (0 == ACCESS (conffile, W_OK)) | ||
516 | { | ||
517 | gtk_widget_set_sensitive (startDaemonConfWizard, TRUE); | ||
518 | gtk_widget_set_sensitive (startDaemonConfTool, TRUE); | ||
519 | } | ||
520 | else | ||
521 | { | ||
522 | gtk_widget_set_sensitive (startDaemonConfWizard, FALSE); | ||
523 | gtk_widget_set_sensitive (startDaemonConfTool, FALSE); | ||
524 | } | ||
525 | GNUNET_free_non_null (conffile); | ||
526 | #endif | ||
527 | return; | ||
458 | } | 528 | } |
459 | 529 | ||
460 | /* end of daemon.c */ | 530 | /* end of daemon.c */ |