[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r16939 - gnunet/src/util gnunet-gtk/src/include gnunet-gtk/
From: |
gnunet |
Subject: |
[GNUnet-SVN] r16939 - gnunet/src/util gnunet-gtk/src/include gnunet-gtk/src/lib gnunet-gtk/src/setup |
Date: |
Sun, 18 Sep 2011 23:34:08 +0200 |
Author: grothoff
Date: 2011-09-18 23:34:08 +0200 (Sun, 18 Sep 2011)
New Revision: 16939
Modified:
gnunet-gtk/src/include/gnunet_gtk.h
gnunet-gtk/src/lib/eventloop.c
gnunet-gtk/src/setup/gnunet-setup.c
gnunet/src/util/program.c
Log:
fixing #1781
Modified: gnunet/src/util/program.c
===================================================================
--- gnunet/src/util/program.c 2011-09-18 13:55:43 UTC (rev 16938)
+++ gnunet/src/util/program.c 2011-09-18 21:34:08 UTC (rev 16939)
@@ -218,8 +218,7 @@
if ((-1 ==
(ret =
GNUNET_GETOPT_run (binaryName, allopts, (unsigned int) argc, argv))) ||
- ((GNUNET_OK != GNUNET_log_setup (lpfx, loglev, logfile)) ||
- (GNUNET_OK != GNUNET_CONFIGURATION_load (cfg, cc.cfgfile))))
+ (GNUNET_OK != GNUNET_log_setup (lpfx, loglev, logfile)) )
{
GNUNET_CONFIGURATION_destroy (cfg);
GNUNET_free_non_null (cc.cfgfile);
@@ -229,6 +228,7 @@
GNUNET_free (lpfx);
return GNUNET_SYSERR;
}
+ (void) GNUNET_CONFIGURATION_load (cfg, cc.cfgfile);
GNUNET_free (allopts);
GNUNET_free (lpfx);
if (GNUNET_OK ==
Modified: gnunet-gtk/src/include/gnunet_gtk.h
===================================================================
--- gnunet-gtk/src/include/gnunet_gtk.h 2011-09-18 13:55:43 UTC (rev 16938)
+++ gnunet-gtk/src/include/gnunet_gtk.h 2011-09-18 21:34:08 UTC (rev 16939)
@@ -146,6 +146,7 @@
const char *main_window_file,
GNUNET_SCHEDULER_Task main_task);
+
/**
* Get an object from the main window.
*
@@ -160,6 +161,16 @@
/**
+ * Obtain the name of the configuration file that is being used.
+ *
+ * @param ml handle to the main loop
+ * @return name of configuration file
+ */
+const char *
+GNUNET_GTK_main_loop_get_configuration_file (struct GNUNET_GTK_MainLoop *ml);
+
+
+/**
* Get the configuration.
*
* @param ml handle to the main loop
Modified: gnunet-gtk/src/lib/eventloop.c
===================================================================
--- gnunet-gtk/src/lib/eventloop.c 2011-09-18 13:55:43 UTC (rev 16938)
+++ gnunet-gtk/src/lib/eventloop.c 2011-09-18 21:34:08 UTC (rev 16939)
@@ -87,6 +87,11 @@
GPollFD *cached_poll_array;
/**
+ * Name of the configuration file.
+ */
+ char *cfgfile;
+
+ /**
* Size of the 'cached_poll_array'.
*/
guint cached_poll_array_size;
@@ -188,6 +193,19 @@
/**
+ * Obtain the name of the configuration file that is being used.
+ *
+ * @param ml handle to the main loop
+ * @return name of configuration file
+ */
+const char *
+GNUNET_GTK_main_loop_get_configuration_file (struct GNUNET_GTK_MainLoop *ml)
+{
+ return ml->cfgfile;
+}
+
+
+/**
* Get an object from the main window.
*
* @param ml handle to the main loop
@@ -816,7 +834,7 @@
*/
static void
run_main_loop (void *cls, char *const *args, const char *cfgfile,
- const struct GNUNET_CONFIGURATION_Handle *cfg)
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
struct GNUNET_GTK_MainLoop *ml = cls;
int argc;
@@ -836,6 +854,7 @@
ml->gml = g_main_loop_new (NULL, TRUE);
ml->gmc = g_main_loop_get_context (ml->gml);
ml->cfg = cfg;
+ ml->cfgfile = GNUNET_strdup (cfgfile);
#if WINDOWS
ml->hEventRead = CreateEvent (NULL, TRUE, FALSE, NULL);
ml->hEventReadReady = CreateEvent (NULL, TRUE, TRUE, NULL);
@@ -891,8 +910,8 @@
ml.main_window_file = main_window_file;
ml.main_task = main_task;
ret =
- GNUNET_PROGRAM_run (argc, argv, binary_name, "GTK GUI for GNUnet",
- options, &run_main_loop, &ml);
+ GNUNET_PROGRAM_run (argc, argv, binary_name, binary_help,
+ options, &run_main_loop, &ml);
if (NULL != ml.cached_poll_array)
g_free (ml.cached_poll_array);
if (NULL != ml.rs)
@@ -903,6 +922,7 @@
g_object_unref (G_OBJECT (ml.builder));
if (NULL != ml.gml)
g_main_loop_unref (ml.gml);
+ GNUNET_free_non_null (ml.cfgfile);
return ret;
}
Modified: gnunet-gtk/src/setup/gnunet-setup.c
===================================================================
--- gnunet-gtk/src/setup/gnunet-setup.c 2011-09-18 13:55:43 UTC (rev 16938)
+++ gnunet-gtk/src/setup/gnunet-setup.c 2011-09-18 21:34:08 UTC (rev 16939)
@@ -38,14 +38,9 @@
/**
* Name of the configuration file.
*/
-static char *cfgName;
+static const char *cfgName;
/**
- * Our log level (FIXME: needed!?)
- */
-static char *loglev;
-
-/**
* Our configuration.
*/
struct GNUNET_CONFIGURATION_Handle *cfg;
@@ -319,6 +314,7 @@
GtkWidget *main_window;
ml = cls;
+ cfgName = GNUNET_GTK_main_loop_get_configuration_file (ml);
cfg = GNUNET_CONFIGURATION_create ();
(void) GNUNET_CONFIGURATION_load (cfg, cfgName);
main_window = GTK_WIDGET (GNUNET_SETUP_get_object ("GNUNET_setup_dialog"));
@@ -342,26 +338,17 @@
main (int argc, char *const *argv)
{
struct GNUNET_GETOPT_CommandLineOption options[] = {
- GNUNET_GETOPT_OPTION_CFG_FILE (&cfgName),
- GNUNET_GETOPT_OPTION_HELP (gettext_noop ("Setup tool for GNUnet")),
- GNUNET_GETOPT_OPTION_LOGLEVEL (&loglev),
- GNUNET_GETOPT_OPTION_VERSION (PACKAGE_VERSION),
GNUNET_GETOPT_OPTION_END
};
int ret;
- cfgName = GNUNET_strdup (GNUNET_DEFAULT_USER_CONFIG_FILE);
- loglev = GNUNET_strdup ("WARNING");
-
if (GNUNET_OK ==
- GNUNET_GTK_main_loop_start ("gnunet-setup", "guunet-setup", argc, argv,
+ GNUNET_GTK_main_loop_start ("gnunet-setup", "gnunet-setup", argc, argv,
options,
"gnunet_setup_gtk_main_window.glade",
&run))
ret = gret;
else
ret = 1;
- GNUNET_free (cfgName);
- GNUNET_free (loglev);
return ret;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r16939 - gnunet/src/util gnunet-gtk/src/include gnunet-gtk/src/lib gnunet-gtk/src/setup,
gnunet <=