[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r7725 - in gnunet-gtk/src: common core include plugins/daem
From: |
gnunet |
Subject: |
[GNUnet-SVN] r7725 - in gnunet-gtk/src: common core include plugins/daemon |
Date: |
Sun, 28 Sep 2008 21:07:47 -0600 (MDT) |
Author: grothoff
Date: 2008-09-28 21:07:47 -0600 (Sun, 28 Sep 2008)
New Revision: 7725
Added:
gnunet-gtk/src/plugins/daemon/daemon.h
gnunet-gtk/src/plugins/daemon/setup.c
Modified:
gnunet-gtk/src/common/helper.c
gnunet-gtk/src/core/main.c
gnunet-gtk/src/include/gnunetgtk_common.h
gnunet-gtk/src/plugins/daemon/Makefile.am
gnunet-gtk/src/plugins/daemon/daemon.c
Log:
fixing #1367
Modified: gnunet-gtk/src/common/helper.c
===================================================================
--- gnunet-gtk/src/common/helper.c 2008-09-29 03:03:37 UTC (rev 7724)
+++ gnunet-gtk/src/common/helper.c 2008-09-29 03:07:47 UTC (rev 7725)
@@ -71,6 +71,8 @@
static char *gladeFile;
+static const char * ccfn;
+
static GdkWindowState main_window_state;
/**
@@ -328,14 +330,22 @@
return NULL;
}
+const char *GNUNET_GTK_get_client_config_filename ()
+{
+ return ccfn;
+}
+
+
void
-GNUNET_GTK_initialize_common_library (struct GNUNET_GC_Configuration *c,
+GNUNET_GTK_initialize_common_library (const char *ccfnarg,
+ struct GNUNET_GC_Configuration *c,
void *callback)
{
char *load;
char *path;
char *filename;
+ ccfn = ccfnarg;
cfg = c;
shutdown_function = callback;
sclock = GNUNET_mutex_create (GNUNET_YES);
@@ -830,92 +840,6 @@
return main_window_state;
}
-/**
- * Start gnunet-setup, asking for a password if needed
- */
-gboolean
-GNUNET_GTK_run_gnunet_setup (gchar * conffile, gboolean run_wizard)
-{
- GtkWidget *mainWindow;
- GtkWidget *messageDialog;
- GError *gerror = NULL;
- char *error_message = NULL;
-
- if (0 == ACCESS (conffile, W_OK))
- {
- if (run_wizard)
- {
- char *argv[]
- = { "gnunet-setup", "-d", "wizard-gtk", "-c", conffile, NULL };
- g_spawn_async (NULL, argv, NULL,
- G_SPAWN_SEARCH_PATH | G_SPAWN_CHILD_INHERITS_STDIN,
- NULL, NULL, NULL, &gerror);
- }
- else
- {
- char *argv[]
- = { "gnunet-setup", "-d", "gconfig", "-c", conffile, NULL };
- g_spawn_async (NULL, argv, NULL,
- G_SPAWN_SEARCH_PATH | G_SPAWN_CHILD_INHERITS_STDIN,
- NULL, NULL, NULL, &gerror);
- }
- if (gerror)
- {
- error_message = GNUNET_strdup (gerror->message);
- g_error_free (gerror);
- }
- }
- else
-#ifndef WITH_LIBGKSU2
- {
- error_message =
- GNUNET_strdup (_
- ("You don't have rights to write to the provided
configuration file."));
- }
-#else
- {
- char *commandline;
-
- if (run_wizard)
- {
- commandline =
- g_strconcat ("gnunet-setup -d wizard-gtk -c ", conffile, NULL);
- gksu_run (commandline, &gerror);
- }
- else
- {
- commandline =
- g_strconcat ("gnunet-setup -d gconfig -c ", conffile, NULL);
- gksu_run (commandline, &gerror);
- }
- GNUNET_free (commandline);
- if (gerror)
- {
- error_message = GNUNET_strdup (gerror->message);
- g_error_free (gerror);
- }
- }
-#endif
- if (error_message)
- {
- mainWindow =
- glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "mainWindow");
- messageDialog =
- gtk_message_dialog_new (GTK_WINDOW (mainWindow),
- GTK_DIALOG_MODAL |
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_WARNING, GTK_BUTTONS_CLOSE,
- _
- ("Failed to run the configuration tool
(gnunet-setup): %s"),
- error_message);
- gtk_dialog_run (GTK_DIALOG (messageDialog));
- gtk_widget_destroy (messageDialog);
- GNUNET_free (error_message);
- return FALSE;
- }
- return TRUE;
-}
-
GtkWidget *
GNUNET_GTK_extract_main_widget_from_window (GladeXML * xml,
const char *windowName)
Modified: gnunet-gtk/src/core/main.c
===================================================================
--- gnunet-gtk/src/core/main.c 2008-09-29 03:03:37 UTC (rev 7724)
+++ gnunet-gtk/src/core/main.c 2008-09-29 03:07:47 UTC (rev 7725)
@@ -126,7 +126,8 @@
bind_textdomain_codeset ("gnunet-gtk", "UTF-8");
#endif
setIconSearchPath ();
- GNUNET_GTK_initialize_common_library (cfg, &GNUNET_GTK_main_quit);
+ GNUNET_GTK_initialize_common_library (cfgFilename,
+ cfg, &GNUNET_GTK_main_quit);
/* configure GTK logging */
GNUNET_GC_get_configuration_value_string (cfg,
"LOGGING",
Modified: gnunet-gtk/src/include/gnunetgtk_common.h
===================================================================
--- gnunet-gtk/src/include/gnunetgtk_common.h 2008-09-29 03:03:37 UTC (rev
7724)
+++ gnunet-gtk/src/include/gnunetgtk_common.h 2008-09-29 03:07:47 UTC (rev
7725)
@@ -44,13 +44,16 @@
#endif
-void GNUNET_GTK_initialize_common_library (struct GNUNET_GC_Configuration
+void GNUNET_GTK_initialize_common_library (const char * ccfn,
+ struct GNUNET_GC_Configuration
*cfg, void *callback);
void GNUNET_GTK_shutdown_plugins (void);
void GNUNET_GTK_shutdown_common_library (void);
+const char *GNUNET_GTK_get_client_config_filename (void);
+
/**
* Get the name of the main glade file for gnunet-gtk.
*/
@@ -167,14 +170,6 @@
void GNUNET_GTK_main_quit (void);
/**
-* Start gnunet-setup, asking for a password if needed
-* @param conffile path to the gnunetd configuration file
-* @param run_wizard TRUE to run the wizard, FALSE to run the complete tool
-* @returns FALSE if gnunet-setup was run, TRUE else
-*/
-gboolean GNUNET_GTK_run_gnunet_setup (char *conffile, gboolean run_wizard);
-
-/**
* Identical to "gtk_tree_selection_selected_foreach",
* except that modifications of the underlying model
* during the iteration are tolerated.
Modified: gnunet-gtk/src/plugins/daemon/Makefile.am
===================================================================
--- gnunet-gtk/src/plugins/daemon/Makefile.am 2008-09-29 03:03:37 UTC (rev
7724)
+++ gnunet-gtk/src/plugins/daemon/Makefile.am 2008-09-29 03:07:47 UTC (rev
7725)
@@ -10,7 +10,8 @@
libgnunetgtkmodule_daemon.la
libgnunetgtkmodule_daemon_la_SOURCES = \
- daemon.c
+ daemon.c daemon.h \
+ setup.c
libgnunetgtkmodule_daemon_la_LIBADD = \
@GTK_LIBS@ @GNUNETGTK_LIBS@ \
$(top_builddir)/src/common/libgnunetgtk_common.la \
Modified: gnunet-gtk/src/plugins/daemon/daemon.c
===================================================================
--- gnunet-gtk/src/plugins/daemon/daemon.c 2008-09-29 03:03:37 UTC (rev
7724)
+++ gnunet-gtk/src/plugins/daemon/daemon.c 2008-09-29 03:07:47 UTC (rev
7725)
@@ -30,8 +30,8 @@
#include <GNUnet/gnunet_getoption_lib.h>
#include <GNUnet/gnunet_stats_lib.h>
#include <GNUnet/gnunet_util.h>
-#include <gtk/gtk.h>
#include <glib/gerror.h>
+#include "daemon.h"
#ifdef WITH_LIBGKSU2
/* Not used because libgksu2 headers have broken depends in Debian
@@ -125,8 +125,8 @@
}
-static void *
-doUpdateMenus (void *arg)
+void *
+daemon_doUpdateMenus (void *arg)
{
int ret = *(int *) arg;
static GtkWidget *killEntry = NULL;
@@ -138,7 +138,8 @@
char *host;
int canStart;
struct GNUNET_GC_Configuration *dcfg;
- char *fn;
+ const char *fn;
+ char * fnx;
char *user;
if (once)
@@ -154,7 +155,7 @@
"statusPixmap");
chooser =
glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),
- "gnunetdconfigFileChooserButton");
+ "configfilenameEntry");
GNUNET_GC_get_configuration_value_string (cfg, "NETWORK", "HOST",
"localhost", &host);
if (strncmp (host, "localhost", 9) == 0)
@@ -166,12 +167,14 @@
if (ret == 0)
{
canStart = 0;
- fn = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser));
+ fn = gtk_entry_get_text (GTK_ENTRY (chooser));
+ fnx = NULL;
if (NULL == fn)
GNUNET_GC_get_configuration_value_filename (cfg, "DAEMON",
"CONFIGFILE",
GNUNET_DEFAULT_DAEMON_CONFIG_FILE,
- &fn);
+ &fnx);
+ fn = fnx;
if (isLocal && fn)
{
if (GNUNET_disk_file_test (ectx, fn) == GNUNET_YES)
@@ -206,8 +209,8 @@
GNUNET_free (user);
GNUNET_GC_free (dcfg);
}
- g_free (fn);
}
+ GNUNET_free_non_null(fnx);
gtk_image_set_from_stock (GTK_IMAGE (statsEntry), GTK_STOCK_YES,
GTK_ICON_SIZE_SMALL_TOOLBAR);
gtk_widget_set_sensitive (killEntry, FALSE);
@@ -258,10 +261,15 @@
else
GNUNET_GTK_display_daemon_status (GNUNET_GTK_STATUS_NODAEMON, 0);
}
- GNUNET_GTK_save_call (&doUpdateMenus, &ret);
+ GNUNET_GTK_save_call (&daemon_doUpdateMenus, &ret);
}
+/* in setup.c */
+void
+on_gnunetdconfigfile_changed_daemon (GtkWidget * wid, gpointer data);
+
+
/**
* Launch gnunetd w/ checks
*/
@@ -355,6 +363,8 @@
&cronCheckDaemon,
15 * GNUNET_CRON_SECONDS, NULL);
}
+
+ on_gnunetdconfigfile_changed_daemon (NULL, NULL);
}
/**
@@ -407,6 +417,12 @@
(i + 1) * 500 * GNUNET_CRON_MILLISECONDS, 0, NULL);
}
+struct GNUNET_GC_Configuration *
+daemon_get_cfg_handle()
+{
+ return cfg;
+}
+
void
init_daemon (struct GNUNET_GE_Context *e, struct GNUNET_GC_Configuration *c)
{
@@ -451,39 +467,18 @@
"CONFIGFILE",
GNUNET_DEFAULT_DAEMON_CONFIG_FILE,
&daemon_config);
- if (GNUNET_YES == GNUNET_disk_file_test (NULL, daemon_config))
+ gtk_entry_set_text (GTK_ENTRY
+ (glade_xml_get_widget
+ (GNUNET_GTK_get_main_glade_XML (),
+ "configfilenameEntry")),
+ daemon_config);
+ if (GNUNET_YES != GNUNET_disk_file_test (NULL, daemon_config))
{
- gtk_file_chooser_set_filename (GTK_FILE_CHOOSER
- (glade_xml_get_widget
- (GNUNET_GTK_get_main_glade_XML (),
- "gnunetdconfigFileChooserButton")),
- daemon_config);
- }
- else
- {
GNUNET_GTK_add_log_entry (_
("Configuration file for GNUnet daemon `%s'
does not exist! Run `gnunet-setup -d'.\n"),
daemon_config);
}
-
-#ifndef WITH_LIBGKSU2
- GtkWidget *startDaemonConfWizard;
- GtkWidget *startDaemonConfTool;
-
- startDaemonConfWizard
- = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),
- "startDaemonConfWizard");
- startDaemonConfTool
- = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),
- "startDaemonConfTool");
- if (0 != ACCESS (daemon_config, W_OK))
- {
- gtk_widget_set_sensitive (startDaemonConfWizard, FALSE);
- gtk_widget_set_sensitive (startDaemonConfTool, FALSE);
- }
-#endif
GNUNET_free (daemon_config);
-
cron = GNUNET_GTK_get_cron_manager ();
GNUNET_cron_add_job (cron, &cronCheckDaemon, 2 * GNUNET_CRON_SECONDS,
15 * GNUNET_CRON_SECONDS, NULL);
@@ -511,77 +506,4 @@
}
-/**
-* Launch 'gnunet-setup -d wizard-gtk' with needed rights
-*/
-void
-on_startDaemonConfWizard_clicked_daemon (GtkWidget * widget, gpointer data)
-{
- GtkWidget *filechooserbutton;
- char *conffile;
-
- filechooserbutton
- = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),
- "gnunetdconfigFileChooserButton");
- conffile =
- gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (filechooserbutton));
- GNUNET_GTK_run_gnunet_setup (conffile, TRUE);
- GNUNET_free (conffile);
-}
-
-/**
-* Launch 'gnunet-setup -d gconfig' with needed rights
-*/
-void
-on_startDaemonConfTool_clicked_daemon (GtkWidget * widget, gpointer data)
-{
- GtkWidget *filechooserbutton;
- char *conffile;
-
- filechooserbutton
- = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),
- "gnunetdconfigFileChooserButton");
- conffile =
- gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (filechooserbutton));
- GNUNET_GTK_run_gnunet_setup (conffile, FALSE);
- GNUNET_free (conffile);
-}
-
-/**
-* Update sensitivity of daemon buttons
-*/
-void
-on_gnunetdconfigfile_set_daemon (GtkWidget * filechooserbutton, gpointer data)
-{
-#ifndef WITH_LIBGKSU2
- GtkWidget *startDaemonConfWizard;
- GtkWidget *startDaemonConfTool;
- char *conffile;
- int ret;
-
- startDaemonConfWizard
- = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),
- "startDaemonConfWizard");
- startDaemonConfTool
- = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),
- "startDaemonConfTool");
- conffile =
- gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (filechooserbutton));
- if (0 == ACCESS (conffile, W_OK))
- {
- gtk_widget_set_sensitive (startDaemonConfWizard, TRUE);
- gtk_widget_set_sensitive (startDaemonConfTool, TRUE);
- }
- else
- {
- gtk_widget_set_sensitive (startDaemonConfWizard, FALSE);
- gtk_widget_set_sensitive (startDaemonConfTool, FALSE);
- }
- ret = 0;
- GNUNET_GTK_save_call (&doUpdateMenus, &ret);
- GNUNET_free_non_null (conffile);
-#endif
- return;
-}
-
/* end of daemon.c */
Added: gnunet-gtk/src/plugins/daemon/daemon.h
===================================================================
--- gnunet-gtk/src/plugins/daemon/daemon.h (rev 0)
+++ gnunet-gtk/src/plugins/daemon/daemon.h 2008-09-29 03:07:47 UTC (rev
7725)
@@ -0,0 +1,34 @@
+/*
+ This file is part of GNUnet.
+ (C) 2005, 2006, 2007, 2008 Christian Grothoff (and other contributing
authors)
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * @file src/plugins/daemon/daemon.h
+ * @brief code for gnunet-setup interaction
+ * @author Christian Grothoff
+ */
+#ifndef DAEMON_H
+#define DAEMON_H
+
+void * daemon_doUpdateMenus (void *arg);
+
+struct GNUNET_GC_Configuration *
+daemon_get_cfg_handle(void);
+
+#endif
Added: gnunet-gtk/src/plugins/daemon/setup.c
===================================================================
--- gnunet-gtk/src/plugins/daemon/setup.c (rev 0)
+++ gnunet-gtk/src/plugins/daemon/setup.c 2008-09-29 03:07:47 UTC (rev
7725)
@@ -0,0 +1,267 @@
+/*
+ This file is part of GNUnet.
+ (C) 2005, 2006, 2007, 2008 Christian Grothoff (and other contributing
authors)
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * @file src/plugins/daemon/setup.c
+ * @brief code for gnunet-setup interaction
+ * @author Christian Grothoff
+ */
+
+#include "platform.h"
+#include "gnunetgtk_common.h"
+#include <GNUnet/gnunet_directories.h>
+#include <GNUnet/gnunet_util.h>
+#include <glib/gerror.h>
+#include "daemon.h"
+
+/**
+ * Can we write to the given file (with our current
+ * permissions)?
+ */
+static int
+can_write(const char * f)
+{
+ struct stat buf;
+ char * fn;
+ int ret;
+ int sret;
+
+ fn = GNUNET_expand_file_name(NULL, f);
+ sret = STAT (fn, &buf);
+ ret =
+ (0 < strlen(fn)) &&
+ ( ( (0 == ACCESS (fn, W_OK)) &&
+ (! S_ISDIR(buf.st_mode)) ) ||
+ ( (0 != sret) &&
+ (GNUNET_OK == GNUNET_disk_directory_create_for_file(NULL,
+ fn))) );
+ GNUNET_free(fn);
+ return ret;
+}
+
+static char *
+get_gnunetdconfigfile (void)
+{
+ GtkWidget * entry;
+
+ entry
+ = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),
+ "configfilenameEntry");
+ return
+ GNUNET_strdup(gtk_entry_get_text (GTK_ENTRY(entry)));
+}
+
+/**
+ * Change the configuration filename.
+ */
+void
+on_change_config_name_clicked_daemon (GtkWidget * editFNbutton,
+ GtkWidget * ent)
+{
+ GtkWidget *dialog;
+ char * fn;
+ GtkWidget * entry;
+
+ dialog = gtk_file_chooser_dialog_new ("Select Configuration File",
+ NULL,
+ GTK_FILE_CHOOSER_ACTION_SAVE,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
+ NULL);
+ gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog),
FALSE);
+ fn = get_gnunetdconfigfile ();
+ gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (dialog), fn);
+ GNUNET_free(fn);
+ if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
+ {
+ fn = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
+ entry
+ = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),
+ "configfilenameEntry");
+ gtk_entry_set_text (GTK_ENTRY(entry), fn);
+ GNUNET_free(fn);
+ }
+ gtk_widget_destroy (dialog);
+}
+
+/**
+ * Update sensitivity of daemon buttons
+ */
+void
+on_gnunetdconfigfile_changed_daemon (GtkWidget * wid, gpointer data)
+{
+ char *conffile;
+
+ conffile =
+ get_gnunetdconfigfile();
+ GNUNET_GC_set_configuration_value_string (daemon_get_cfg_handle(),
+ NULL,
+ "DAEMON",
+ "CONFIGFILE",
+ conffile);
+ GNUNET_GC_write_configuration(daemon_get_cfg_handle(),
+ GNUNET_GTK_get_client_config_filename());
+
+#ifndef WITH_LIBGKSU2
+ GtkWidget *startDaemonConfWizard;
+ GtkWidget *startDaemonConfTool;
+ int ret;
+
+ startDaemonConfWizard
+ = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),
+ "startDaemonConfWizard");
+ startDaemonConfTool
+ = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),
+ "startDaemonConfTool");
+ if (can_write(conffile))
+ {
+ gtk_widget_set_sensitive (startDaemonConfWizard, TRUE);
+ gtk_widget_set_sensitive (startDaemonConfTool, TRUE);
+ }
+ else
+ {
+ gtk_widget_set_sensitive (startDaemonConfWizard, FALSE);
+ gtk_widget_set_sensitive (startDaemonConfTool, FALSE);
+ }
+ ret = 0;
+#endif
+ daemon_doUpdateMenus(&ret);
+ GNUNET_free_non_null (conffile);
+ return;
+}
+/**
+ * Start gnunet-setup, asking for a password if needed
+ *
+ * @param conffile path to the gnunetd configuration file
+ * @param run_wizard TRUE to run the wizard, FALSE to run the complete tool
+ * @returns FALSE if gnunet-setup was run, TRUE else
+ */
+static gboolean
+GNUNET_GTK_run_gnunet_setup (gchar * conffile, gboolean run_wizard)
+{
+ GtkWidget *mainWindow;
+ GtkWidget *messageDialog;
+ GError *gerror = NULL;
+ char *error_message = NULL;
+
+ if (can_write(conffile))
+ {
+ if (run_wizard)
+ {
+ char *argv[]
+ = { "gnunet-setup", "-d", "wizard-gtk", "-c", conffile, NULL };
+ g_spawn_async (NULL, argv, NULL,
+ G_SPAWN_SEARCH_PATH | G_SPAWN_CHILD_INHERITS_STDIN,
+ NULL, NULL, NULL, &gerror);
+ }
+ else
+ {
+ char *argv[]
+ = { "gnunet-setup", "-d", "gconfig", "-c", conffile, NULL };
+ g_spawn_async (NULL, argv, NULL,
+ G_SPAWN_SEARCH_PATH | G_SPAWN_CHILD_INHERITS_STDIN,
+ NULL, NULL, NULL, &gerror);
+ }
+ if (gerror)
+ {
+ error_message = GNUNET_strdup (gerror->message);
+ g_error_free (gerror);
+ }
+ }
+ else
+#ifndef WITH_LIBGKSU2
+ {
+ error_message =
+ GNUNET_strdup (_
+ ("You don't have rights to write to the provided
configuration file."));
+ }
+#else
+ {
+ char *commandline;
+
+ if (run_wizard)
+ {
+ commandline =
+ g_strconcat ("gnunet-setup -d wizard-gtk -c ", conffile, NULL);
+ gksu_run (commandline, &gerror);
+ }
+ else
+ {
+ commandline =
+ g_strconcat ("gnunet-setup -d gconfig -c ", conffile, NULL);
+ gksu_run (commandline, &gerror);
+ }
+ GNUNET_free (commandline);
+ if (gerror)
+ {
+ error_message = GNUNET_strdup (gerror->message);
+ g_error_free (gerror);
+ }
+ }
+#endif
+ if (error_message)
+ {
+ mainWindow =
+ glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "mainWindow");
+ messageDialog =
+ gtk_message_dialog_new (GTK_WINDOW (mainWindow),
+ GTK_DIALOG_MODAL |
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_WARNING, GTK_BUTTONS_CLOSE,
+ _
+ ("Failed to run the configuration tool
(gnunet-setup): %s"),
+ error_message);
+ gtk_dialog_run (GTK_DIALOG (messageDialog));
+ gtk_widget_destroy (messageDialog);
+ GNUNET_free (error_message);
+ return FALSE;
+ }
+ return TRUE;
+}
+
+/**
+ * Launch 'gnunet-setup -d wizard-gtk' with needed rights
+ */
+void
+on_startDaemonConfWizard_clicked_daemon (GtkWidget * widget, gpointer data)
+{
+ char *conffile;
+
+ conffile =
+ get_gnunetdconfigfile();
+ GNUNET_GTK_run_gnunet_setup (conffile, TRUE);
+ GNUNET_free (conffile);
+}
+
+/**
+ * Launch 'gnunet-setup -d gconfig' with needed rights
+ */
+void
+on_startDaemonConfTool_clicked_daemon (GtkWidget * widget, gpointer data)
+{
+ char *conffile;
+
+ conffile =
+ get_gnunetdconfigfile();
+ GNUNET_GTK_run_gnunet_setup (conffile, FALSE);
+ GNUNET_free (conffile);
+}
+
+/* end of setup.c */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r7725 - in gnunet-gtk/src: common core include plugins/daemon,
gnunet <=