aboutsummaryrefslogtreecommitdiff
path: root/src/common/helper.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/helper.c')
-rw-r--r--src/common/helper.c45
1 files changed, 37 insertions, 8 deletions
diff --git a/src/common/helper.c b/src/common/helper.c
index e4f71101..b98af981 100644
--- a/src/common/helper.c
+++ b/src/common/helper.c
@@ -26,6 +26,7 @@
26 26
27#include "platform.h" 27#include "platform.h"
28#include "gnunetgtk_common.h" 28#include "gnunetgtk_common.h"
29#include <glib.h>
29 30
30#define HELPER_DEBUG NO 31#define HELPER_DEBUG NO
31 32
@@ -33,6 +34,12 @@
33#include <libnotify/notify.h> 34#include <libnotify/notify.h>
34#endif 35#endif
35 36
37#ifdef WITH_LIBGKSU2
38/*#include <libgksu/libgksu.h>
39* commented because support is broken in Debian,
40* and these headers are not really useful for us */
41#endif
42
36typedef struct { 43typedef struct {
37 Semaphore * sem; 44 Semaphore * sem;
38 void * args; 45 void * args;
@@ -613,18 +620,40 @@ GdkWindowState getMainWindowState()
613* Start gnunet-setup, asking for a password if needed 620* Start gnunet-setup, asking for a password if needed
614*/ 621*/
615gboolean startGNUnetSetup (gboolean run_wizard) { 622gboolean startGNUnetSetup (gboolean run_wizard) {
616#ifdef HAVE_LIBGKSU2 623 int code;
617 if(gnunetsetup_mode) { 624#ifdef WITH_LIBGKSU2
618 gksu_run("gnunet-setup -d wizard-gtk", NULL); } 625 GError *gerror = NULL;
626 char *error_message;
627 if(run_wizard) {
628 code = gksu_run("gnunet-setup -d wizard-gtk", &gerror); }
619 else { 629 else {
620 gksu_run("gnunet-setup -d", NULL); } 630 code = gksu_run("gnunet-setup -d", &gerror); }
621 return TRUE; 631 if(code && !gerror) {
622#elif WINDOWS 632 error_message = STRDUP("GKSu encountered an unknown error running the configuration tool (gnunet-setup)."); }
623/* FIXME: run gnunet-setup, assuming we can have the needed rights */ 633 else if(code && gerror) {
634 error_message = g_strdup_printf("GKSu returned:\n%s", gerror->message);
635 g_error_free(gerror); }
636 else {
637 error_message = NULL; }
638#elif defined(WINDOWS)
639/* FIXME: run gnunet-setup, assuming we can get the needed rights */
640 error_message = STRDUP("Not implemented yet !");
624 return TRUE; 641 return TRUE;
625#else 642#else
626 return FALSE; 643 error_message = STRDUP(_("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."));
644 return TRUE;
627#endif 645#endif
646 GtkWidget *mainWindow, *messageDialog;
647 mainWindow = glade_xml_get_widget(getMainXML(), "mainWindow");
648 messageDialog = gtk_message_dialog_new (GTK_WINDOW(mainWindow),
649 GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
650 GTK_MESSAGE_WARNING, GTK_BUTTONS_CLOSE,
651 _("Failed to run the configuration wizard: %s"),
652 error_message);
653 gtk_dialog_run(GTK_DIALOG(messageDialog));
654 gtk_widget_destroy (messageDialog);
655 FREE(error_message);
656 return code;
628} 657}
629 658
630/* end of helper.c */ 659/* end of helper.c */