diff options
Diffstat (limited to 'src/lib/eventloop.c')
-rw-r--r-- | src/lib/eventloop.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/lib/eventloop.c b/src/lib/eventloop.c index aef8d966..5ef2282b 100644 --- a/src/lib/eventloop.c +++ b/src/lib/eventloop.c | |||
@@ -42,9 +42,9 @@ struct GNUNET_GTK_MainLoop | |||
42 | { | 42 | { |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * Our configuration. | 45 | * Our configuration (includes defaults from gnunet-gtk/config.d/ and gnunet/config.d/) |
46 | */ | 46 | */ |
47 | const struct GNUNET_CONFIGURATION_Handle *cfg; | 47 | struct GNUNET_CONFIGURATION_Handle *cfg; |
48 | 48 | ||
49 | /** | 49 | /** |
50 | * Name of the glade file for the main window | 50 | * Name of the glade file for the main window |
@@ -857,6 +857,9 @@ run_main_loop (void *cls, char *const *args, const char *cfgfile, | |||
857 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 857 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
858 | { | 858 | { |
859 | struct GNUNET_GTK_MainLoop *ml = cls; | 859 | struct GNUNET_GTK_MainLoop *ml = cls; |
860 | struct GNUNET_CONFIGURATION_Handle *gcfg; | ||
861 | char *baseconfig; | ||
862 | char *ipath; | ||
860 | int argc; | 863 | int argc; |
861 | 864 | ||
862 | /* command-line processing for Gtk arguments */ | 865 | /* command-line processing for Gtk arguments */ |
@@ -864,12 +867,24 @@ run_main_loop (void *cls, char *const *args, const char *cfgfile, | |||
864 | while (args[argc] != NULL) | 867 | while (args[argc] != NULL) |
865 | argc++; | 868 | argc++; |
866 | gtk_init (&argc, (char ***) &args); | 869 | gtk_init (&argc, (char ***) &args); |
870 | gcfg = GNUNET_CONFIGURATION_create (); | ||
867 | 871 | ||
872 | ipath = GNUNET_GTK_installation_get_path (GNUNET_OS_IPK_DATADIR); | ||
873 | if (ipath == NULL) | ||
874 | { | ||
875 | GNUNET_break (0); | ||
876 | return; | ||
877 | } | ||
878 | GNUNET_asprintf (&baseconfig, "%s%s", ipath, "config.d"); | ||
879 | GNUNET_free (ipath); | ||
880 | (void) GNUNET_CONFIGURATION_load_from (gcfg, baseconfig); | ||
881 | GNUNET_free (baseconfig); | ||
882 | (void) GNUNET_CONFIGURATION_load (gcfg, cfgfile); | ||
868 | ml->rs = GNUNET_NETWORK_fdset_create (); | 883 | ml->rs = GNUNET_NETWORK_fdset_create (); |
869 | ml->ws = GNUNET_NETWORK_fdset_create (); | 884 | ml->ws = GNUNET_NETWORK_fdset_create (); |
870 | ml->gml = g_main_loop_new (NULL, TRUE); | 885 | ml->gml = g_main_loop_new (NULL, TRUE); |
871 | ml->gmc = g_main_loop_get_context (ml->gml); | 886 | ml->gmc = g_main_loop_get_context (ml->gml); |
872 | ml->cfg = cfg; | 887 | ml->cfg = gcfg; |
873 | ml->cfgfile = GNUNET_strdup (cfgfile); | 888 | ml->cfgfile = GNUNET_strdup (cfgfile); |
874 | #if WINDOWS | 889 | #if WINDOWS |
875 | ml->hEventRead = CreateEvent (NULL, TRUE, FALSE, NULL); | 890 | ml->hEventRead = CreateEvent (NULL, TRUE, FALSE, NULL); |
@@ -938,6 +953,8 @@ GNUNET_GTK_main_loop_start (const char *binary_name, const char *binary_help, | |||
938 | g_object_unref (G_OBJECT (ml.builder)); | 953 | g_object_unref (G_OBJECT (ml.builder)); |
939 | if (NULL != ml.gml) | 954 | if (NULL != ml.gml) |
940 | g_main_loop_unref (ml.gml); | 955 | g_main_loop_unref (ml.gml); |
956 | GNUNET_CONFIGURATION_destroy (ml.cfg); | ||
957 | ml.cfg = NULL; | ||
941 | GNUNET_free_non_null (ml.cfgfile); | 958 | GNUNET_free_non_null (ml.cfgfile); |
942 | return ret; | 959 | return ret; |
943 | } | 960 | } |