aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoon <moon@140774ce-b5e7-0310-ab8b-a85725594a96>2007-12-18 21:59:57 +0000
committerMoon <moon@140774ce-b5e7-0310-ab8b-a85725594a96>2007-12-18 21:59:57 +0000
commitcc47430125be94ac89cf66f2c2bbfbf6132d13fc (patch)
treeb4a99ddab0b8b7a4a5ab83bb984da3dba979a2da
parent87257642fe198819506230dcd1b796c8ddf17fc7 (diff)
downloadgnunet-gtk-cc47430125be94ac89cf66f2c2bbfbf6132d13fc.tar.gz
gnunet-gtk-cc47430125be94ac89cf66f2c2bbfbf6132d13fc.zip
update libgksu2 support and allow direct configuration when config file
is writable by current user (use --with-libgksu2)
-rw-r--r--gnunet-gtk.glade137
-rw-r--r--src/common/helper.c118
-rw-r--r--src/include/gnunetgtk_common.h4
-rw-r--r--src/plugins/daemon/daemon.c82
4 files changed, 183 insertions, 158 deletions
diff --git a/gnunet-gtk.glade b/gnunet-gtk.glade
index 5ef0d33d..f2f6e7d6 100644
--- a/gnunet-gtk.glade
+++ b/gnunet-gtk.glade
@@ -269,6 +269,7 @@ This release fixes downloads of files from directories. The previous version ha
269 269
270 <child> 270 <child>
271 <widget class="GtkVBox" id="vbox2"> 271 <widget class="GtkVBox" id="vbox2">
272 <property name="border_width">5</property>
272 <property name="visible">True</property> 273 <property name="visible">True</property>
273 <property name="homogeneous">False</property> 274 <property name="homogeneous">False</property>
274 <property name="spacing">0</property> 275 <property name="spacing">0</property>
@@ -333,7 +334,7 @@ This release fixes downloads of files from directories. The previous version ha
333 <child> 334 <child>
334 <widget class="GtkLabel" id="startButton"> 335 <widget class="GtkLabel" id="startButton">
335 <property name="visible">True</property> 336 <property name="visible">True</property>
336 <property name="label" translatable="yes">start gnunet_d</property> 337 <property name="label" translatable="yes">Start gnunet_d</property>
337 <property name="use_underline">True</property> 338 <property name="use_underline">True</property>
338 <property name="use_markup">False</property> 339 <property name="use_markup">False</property>
339 <property name="justify">GTK_JUSTIFY_RIGHT</property> 340 <property name="justify">GTK_JUSTIFY_RIGHT</property>
@@ -413,7 +414,7 @@ This release fixes downloads of files from directories. The previous version ha
413 <child> 414 <child>
414 <widget class="GtkLabel" id="label64"> 415 <widget class="GtkLabel" id="label64">
415 <property name="visible">True</property> 416 <property name="visible">True</property>
416 <property name="label" translatable="yes">sto_p gnunetd</property> 417 <property name="label" translatable="yes">Sto_p gnunetd</property>
417 <property name="use_underline">True</property> 418 <property name="use_underline">True</property>
418 <property name="use_markup">False</property> 419 <property name="use_markup">False</property>
419 <property name="justify">GTK_JUSTIFY_LEFT</property> 420 <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -503,7 +504,7 @@ This release fixes downloads of files from directories. The previous version ha
503 <child> 504 <child>
504 <widget class="GtkLabel" id="gnunetdControlLabel"> 505 <widget class="GtkLabel" id="gnunetdControlLabel">
505 <property name="visible">True</property> 506 <property name="visible">True</property>
506 <property name="label" translatable="yes">&lt;b&gt;GNUnet daemon control&lt;/b&gt;</property> 507 <property name="label" translatable="yes">&lt;b&gt;GNUnet Daemon Control&lt;/b&gt;</property>
507 <property name="use_underline">False</property> 508 <property name="use_underline">False</property>
508 <property name="use_markup">True</property> 509 <property name="use_markup">True</property>
509 <property name="justify">GTK_JUSTIFY_LEFT</property> 510 <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -531,72 +532,6 @@ This release fixes downloads of files from directories. The previous version ha
531 </child> 532 </child>
532 533
533 <child> 534 <child>
534 <widget class="GtkHBox" id="hbox67">
535 <property name="visible">True</property>
536 <property name="homogeneous">False</property>
537 <property name="spacing">0</property>
538
539 <child>
540 <widget class="GtkLabel" id="label152">
541 <property name="visible">True</property>
542 <property name="label" translatable="yes">_configuration file that should be used when starting gnunetd:</property>
543 <property name="use_underline">True</property>
544 <property name="use_markup">False</property>
545 <property name="justify">GTK_JUSTIFY_LEFT</property>
546 <property name="wrap">False</property>
547 <property name="selectable">False</property>
548 <property name="xalign">0.5</property>
549 <property name="yalign">0.5</property>
550 <property name="xpad">5</property>
551 <property name="ypad">0</property>
552 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
553 <property name="width_chars">-1</property>
554 <property name="single_line_mode">False</property>
555 <property name="angle">0</property>
556 </widget>
557 <packing>
558 <property name="padding">0</property>
559 <property name="expand">False</property>
560 <property name="fill">False</property>
561 </packing>
562 </child>
563
564 <child>
565 <widget class="GtkFileChooserButton" id="gnunetdconfigFileChooserButton">
566 <property name="visible">True</property>
567 <property name="title" translatable="yes">Select gnunetd configuration File</property>
568 <property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
569 <property name="local_only">True</property>
570 <property name="show_hidden">True</property>
571 <property name="do_overwrite_confirmation">False</property>
572 <property name="width_chars">-1</property>
573 </widget>
574 <packing>
575 <property name="padding">0</property>
576 <property name="expand">True</property>
577 <property name="fill">True</property>
578 </packing>
579 </child>
580 </widget>
581 <packing>
582 <property name="padding">0</property>
583 <property name="expand">False</property>
584 <property name="fill">True</property>
585 </packing>
586 </child>
587
588 <child>
589 <widget class="GtkHSeparator" id="hseparator1">
590 <property name="visible">True</property>
591 </widget>
592 <packing>
593 <property name="padding">0</property>
594 <property name="expand">False</property>
595 <property name="fill">False</property>
596 </packing>
597 </child>
598
599 <child>
600 <widget class="GtkFrame" id="frame1"> 535 <widget class="GtkFrame" id="frame1">
601 <property name="visible">True</property> 536 <property name="visible">True</property>
602 <property name="label_xalign">0</property> 537 <property name="label_xalign">0</property>
@@ -659,17 +594,8 @@ This release fixes downloads of files from directories. The previous version ha
659 </child> 594 </child>
660 595
661 <child> 596 <child>
662 <widget class="GtkHSeparator" id="hseparator2">
663 </widget>
664 <packing>
665 <property name="padding">0</property>
666 <property name="expand">True</property>
667 <property name="fill">False</property>
668 </packing>
669 </child>
670
671 <child>
672 <widget class="GtkFrame" id="daemonConfigFrame"> 597 <widget class="GtkFrame" id="daemonConfigFrame">
598 <property name="visible">True</property>
673 <property name="label_xalign">0</property> 599 <property name="label_xalign">0</property>
674 <property name="label_yalign">0.5</property> 600 <property name="label_yalign">0.5</property>
675 <property name="shadow_type">GTK_SHADOW_NONE</property> 601 <property name="shadow_type">GTK_SHADOW_NONE</property>
@@ -846,7 +772,7 @@ This release fixes downloads of files from directories. The previous version ha
846 <child> 772 <child>
847 <widget class="GtkLabel" id="daemonConfigLabel"> 773 <widget class="GtkLabel" id="daemonConfigLabel">
848 <property name="visible">True</property> 774 <property name="visible">True</property>
849 <property name="label" translatable="yes">&lt;b&gt;GNUnet configuration&lt;/b&gt;</property> 775 <property name="label" translatable="yes">&lt;b&gt;GNUnet Daemon Configuration&lt;/b&gt;</property>
850 <property name="use_underline">False</property> 776 <property name="use_underline">False</property>
851 <property name="use_markup">True</property> 777 <property name="use_markup">True</property>
852 <property name="justify">GTK_JUSTIFY_LEFT</property> 778 <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -874,46 +800,51 @@ This release fixes downloads of files from directories. The previous version ha
874 </child> 800 </child>
875 801
876 <child> 802 <child>
877 <widget class="GtkHBox" id="hbox68"> 803 <widget class="GtkHBox" id="hbox67">
804 <property name="visible">True</property>
878 <property name="homogeneous">False</property> 805 <property name="homogeneous">False</property>
879 <property name="spacing">0</property> 806 <property name="spacing">0</property>
880 807
881 <child> 808 <child>
882 <widget class="GtkRadioButton" id="configureClientRadioButton"> 809 <widget class="GtkLabel" id="label152">
883 <property name="visible">True</property> 810 <property name="visible">True</property>
884 <property name="can_focus">True</property> 811 <property name="label" translatable="yes">_Configuration file used for gnunetd :</property>
885 <property name="label" translatable="yes">C_onfigure client</property>
886 <property name="use_underline">True</property> 812 <property name="use_underline">True</property>
887 <property name="relief">GTK_RELIEF_NORMAL</property> 813 <property name="use_markup">False</property>
888 <property name="focus_on_click">True</property> 814 <property name="justify">GTK_JUSTIFY_LEFT</property>
889 <property name="active">True</property> 815 <property name="wrap">False</property>
890 <property name="inconsistent">False</property> 816 <property name="selectable">False</property>
891 <property name="draw_indicator">True</property> 817 <property name="xalign">0.5</property>
818 <property name="yalign">0.5</property>
819 <property name="xpad">5</property>
820 <property name="ypad">0</property>
821 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
822 <property name="width_chars">-1</property>
823 <property name="single_line_mode">False</property>
824 <property name="angle">0</property>
892 </widget> 825 </widget>
893 <packing> 826 <packing>
894 <property name="padding">0</property> 827 <property name="padding">0</property>
895 <property name="expand">True</property> 828 <property name="expand">False</property>
896 <property name="fill">False</property> 829 <property name="fill">False</property>
897 </packing> 830 </packing>
898 </child> 831 </child>
899 832
900 <child> 833 <child>
901 <widget class="GtkRadioButton" id="configureDaemonRadioButton"> 834 <widget class="GtkFileChooserButton" id="gnunetdconfigFileChooserButton">
902 <property name="visible">True</property> 835 <property name="visible">True</property>
903 <property name="can_focus">True</property> 836 <property name="title" translatable="yes">Select gnunetd configuration File</property>
904 <property name="label" translatable="yes">Configure da_emon</property> 837 <property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
905 <property name="use_underline">True</property> 838 <property name="local_only">True</property>
906 <property name="relief">GTK_RELIEF_NORMAL</property> 839 <property name="show_hidden">True</property>
907 <property name="focus_on_click">True</property> 840 <property name="do_overwrite_confirmation">False</property>
908 <property name="active">False</property> 841 <property name="width_chars">-1</property>
909 <property name="inconsistent">False</property> 842 <signal name="file_set" handler="on_gnunetdconfigfile_set_" last_modification_time="Sun, 16 Dec 2007 22:59:54 GMT"/>
910 <property name="draw_indicator">True</property>
911 <property name="group">configureClientRadioButton</property>
912 </widget> 843 </widget>
913 <packing> 844 <packing>
914 <property name="padding">0</property> 845 <property name="padding">0</property>
915 <property name="expand">True</property> 846 <property name="expand">True</property>
916 <property name="fill">False</property> 847 <property name="fill">True</property>
917 </packing> 848 </packing>
918 </child> 849 </child>
919 </widget> 850 </widget>
@@ -5349,6 +5280,7 @@ Press ENTER to add the data.</atkproperty>
5349</widget> 5280</widget>
5350 5281
5351<widget class="GtkAboutDialog" id="aboutDialog"> 5282<widget class="GtkAboutDialog" id="aboutDialog">
5283 <property name="border_width">5</property>
5352 <property agent="glademm" name="cxx_visibility">public</property> 5284 <property agent="glademm" name="cxx_visibility">public</property>
5353 <property name="visible">True</property> 5285 <property name="visible">True</property>
5354 <property name="tooltip" translatable="yes">The gnunet-gtk about dialog</property> 5286 <property name="tooltip" translatable="yes">The gnunet-gtk about dialog</property>
@@ -5692,6 +5624,7 @@ Daniel Nylander &lt;po@danielnylander.se&gt;
5692</widget> 5624</widget>
5693 5625
5694<widget class="GtkFileChooserDialog" id="uploadfilechooserdialog"> 5626<widget class="GtkFileChooserDialog" id="uploadfilechooserdialog">
5627 <property name="border_width">5</property>
5695 <property agent="glademm" name="cxx_visibility">public</property> 5628 <property agent="glademm" name="cxx_visibility">public</property>
5696 <property name="visible">True</property> 5629 <property name="visible">True</property>
5697 <property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property> 5630 <property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
@@ -7608,6 +7541,7 @@ Daniel Nylander &lt;po@danielnylander.se&gt;
7608</widget> 7541</widget>
7609 7542
7610<widget class="GtkFileChooserDialog" id="openDirectoryFileDialog"> 7543<widget class="GtkFileChooserDialog" id="openDirectoryFileDialog">
7544 <property name="border_width">5</property>
7611 <property name="visible">True</property> 7545 <property name="visible">True</property>
7612 <property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property> 7546 <property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
7613 <property name="local_only">True</property> 7547 <property name="local_only">True</property>
@@ -7782,6 +7716,7 @@ Daniel Nylander &lt;po@danielnylander.se&gt;
7782</widget> 7716</widget>
7783 7717
7784<widget class="GtkFileChooserDialog" id="directorySaveDialog"> 7718<widget class="GtkFileChooserDialog" id="directorySaveDialog">
7719 <property name="border_width">5</property>
7785 <property name="visible">True</property> 7720 <property name="visible">True</property>
7786 <property name="action">GTK_FILE_CHOOSER_ACTION_SAVE</property> 7721 <property name="action">GTK_FILE_CHOOSER_ACTION_SAVE</property>
7787 <property name="local_only">True</property> 7722 <property name="local_only">True</property>
diff --git a/src/common/helper.c b/src/common/helper.c
index e022b1cc..413795ce 100644
--- a/src/common/helper.c
+++ b/src/common/helper.c
@@ -38,9 +38,9 @@
38#endif 38#endif
39 39
40#ifdef WITH_LIBGKSU2 40#ifdef WITH_LIBGKSU2
41/*#include <libgksu/libgksu.h> 41/* Not used because libgksu2 headers have broken depends in Debian
42* commented because support is broken in Debian, 42And this is not really needed
43* and these headers are not really useful for us */ 43#include <libgksu/libgksu.h> */
44#endif 44#endif
45 45
46typedef struct 46typedef struct
@@ -516,7 +516,7 @@ GNUNET_GTK_notify (int type, const char *message, ...)
516 va_end (arg); 516 va_end (arg);
517 libnotify = notify_notification_new ("gnunet-gtk", 517 libnotify = notify_notification_new ("gnunet-gtk",
518 msg, 518 msg,
519 PACKAGNUNET_GE_DATA 519 PACKAGE_DATA
520 "/gnunet-gtk/gnunet-gtk-notify.png", 520 "/gnunet-gtk/gnunet-gtk-notify.png",
521 NULL); 521 NULL);
522 GNUNET_free (msg); 522 GNUNET_free (msg);
@@ -588,61 +588,79 @@ GNUNET_GTK_get_main_window_state ()
588 * Start gnunet-setup, asking for a password if needed 588 * Start gnunet-setup, asking for a password if needed
589 */ 589 */
590gboolean 590gboolean
591GNUNET_GTK_run_gnunet_setup (gboolean run_wizard) 591GNUNET_GTK_run_gnunet_setup (gchar *conffile, gboolean run_wizard)
592{ 592{
593 GtkWidget *mainWindow; 593 GtkWidget *mainWindow;
594 GtkWidget *messageDialog; 594 GtkWidget *messageDialog;
595 int code;
596 char *error_message;
597#ifdef WITH_LIBGKSU2
598 GError *gerror = NULL; 595 GError *gerror = NULL;
599 if (run_wizard) 596 char *error_message = NULL;
600 { 597
601 code = gksu_run ("gnunet-setup -d wizard-gtk", &gerror); 598 if (0 == ACCESS(conffile, W_OK))
602 }
603 else
604 {
605 code = gksu_run ("gnunet-setup -d", &gerror);
606 }
607 if (code && !gerror)
608 {
609 error_message =
610 GNUNET_strdup (_
611 ("GKSu encountered an unknown error running the configuration tool (gnunet-setup)."));
612 }
613 else if (code && gerror)
614 { 599 {
615 error_message = g_strdup_printf (_("GKSu returned:\n%s"), 600 if (run_wizard)
616 gerror->message); 601 {
617 g_error_free (gerror); 602 char *argv[]
603 = {"gnunet-setup", "-d", "wizard-gtk", "-c", conffile, NULL};
604 g_spawn_async (NULL, argv, NULL,
605 G_SPAWN_SEARCH_PATH|G_SPAWN_CHILD_INHERITS_STDIN,
606 NULL, NULL, NULL, &gerror);
607 }
608 else
609 {
610 char *argv[]
611 = {"gnunet-setup", "-d", "gconfig", "-c", conffile, NULL};
612 g_spawn_async (NULL, argv, NULL,
613 G_SPAWN_SEARCH_PATH|G_SPAWN_CHILD_INHERITS_STDIN,
614 NULL, NULL, NULL, &gerror);
615 }
616 if (gerror)
617 {
618 error_message = GNUNET_strdup(gerror->message);
619 g_error_free (gerror);
620 }
618 } 621 }
619 else 622 else
620 { 623#ifndef WITH_LIBGKSU2
621 error_message = NULL; 624 {
622 } 625 error_message = GNUNET_strdup(_("You don't have rights to write to the provided configuration file."));
623#elif defined(WINDOWS) 626 }
624/* FIXME: run gnunet-setup, assuming we can get the needed rights */
625 error_message = GNUNET_strdup (_("Not implemented yet!"));
626 code = TRUE;
627#else 627#else
628 error_message = 628 {
629 GNUNET_strdup (_ 629 char *commandline;
630 ("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.")); 630
631 code = TRUE; 631 if (run_wizard)
632 {
633 commandline = g_strconcat ("gnunet-setup -d wizard-gtk -c ", conffile, NULL);
634 gksu_run (commandline, &gerror);
635 }
636 else
637 {
638 commandline = g_strconcat ("gnunet-setup -d gconfig -c ", conffile, NULL);
639 gksu_run (commandline, &gerror);
640 }
641 GNUNET_free (commandline);
642 if (gerror)
643 {
644 error_message = GNUNET_strdup(gerror->message);
645 g_error_free (gerror);
646 }
647 }
632#endif 648#endif
633 mainWindow = 649 if(error_message) {
634 glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "mainWindow"); 650 mainWindow = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "mainWindow");
635 messageDialog = 651 messageDialog = gtk_message_dialog_new (GTK_WINDOW (mainWindow),
636 gtk_message_dialog_new (GTK_WINDOW (mainWindow), 652 GTK_DIALOG_MODAL |
637 GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, 653 GTK_DIALOG_DESTROY_WITH_PARENT,
638 GTK_MESSAGE_WARNING, GTK_BUTTONS_CLOSE, 654 GTK_MESSAGE_WARNING,
639 _ 655 GTK_BUTTONS_CLOSE,
640 ("Failed to run the configuration tool (gnunet-setup): %s"), 656 _("Failed to run the configuration tool (gnunet-setup): %s"),
641 error_message); 657 error_message);
642 gtk_dialog_run (GTK_DIALOG (messageDialog)); 658 gtk_dialog_run (GTK_DIALOG (messageDialog));
643 gtk_widget_destroy (messageDialog); 659 gtk_widget_destroy (messageDialog);
644 GNUNET_free (error_message); 660 GNUNET_free (error_message);
645 return code; 661 return FALSE;
662 }
663 return TRUE;
646} 664}
647 665
648/* end of helper.c */ 666/* end of helper.c */
diff --git a/src/include/gnunetgtk_common.h b/src/include/gnunetgtk_common.h
index 060ad102..da60ad32 100644
--- a/src/include/gnunetgtk_common.h
+++ b/src/include/gnunetgtk_common.h
@@ -43,6 +43,7 @@
43#define GNUNET_GTK_DEBUG_END() 43#define GNUNET_GTK_DEBUG_END()
44#endif 44#endif
45 45
46
46void GNUNET_GTK_initialize_common_library (struct GNUNET_GE_Context *ectx, 47void GNUNET_GTK_initialize_common_library (struct GNUNET_GE_Context *ectx,
47 struct GNUNET_GC_Configuration 48 struct GNUNET_GC_Configuration
48 *cfg, void *callback); 49 *cfg, void *callback);
@@ -134,10 +135,11 @@ void GNUNET_GTK_main_quit (void);
134 135
135/** 136/**
136* Start gnunet-setup, asking for a password if needed 137* Start gnunet-setup, asking for a password if needed
138* @param conffile path to the gnunetd configuration file
137* @param run_wizard TRUE to run the wizard, FALSE to run the complete tool 139* @param run_wizard TRUE to run the wizard, FALSE to run the complete tool
138* @returns FALSE if gnunet-setup was run, TRUE else 140* @returns FALSE if gnunet-setup was run, TRUE else
139*/ 141*/
140gboolean GNUNET_GTK_run_gnunet_setup (gboolean run_wizard); 142gboolean GNUNET_GTK_run_gnunet_setup (char *conffile, gboolean run_wizard);
141 143
142/** 144/**
143 * Identical to "gtk_tree_selection_selected_foreach", 145 * Identical to "gtk_tree_selection_selected_foreach",
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*/
445void 465void
446on_startDaemonConfWizard_clicked_daemon (GtkWidget * widget, gpointer data) 466on_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*/
454void 482void
455on_startDaemonConfTool_clicked_daemon (GtkWidget * widget, gpointer data) 483on_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*/
499void
500on_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 */