#include <curl/multi.h>
#include <gconf/gconf-client.h>
+#include "config-gconf.h"
#include "utils.h"
#include "mapper-types.h"
#include "map.h"
#include "ui-common.h"
#include "settings.h"
-void config_update_proxy()
+void config_update_proxy(void)
{
GConfClient *gconf_client = gconf_client_get_default();
printf("%s()\n", __PRETTY_FUNCTION__);
}
gboolean
-config_save_repo()
+config_save_repo(void)
{
GConfClient *gconf_client = gconf_client_get_default();
GList *curr = _repo_list;
gconf_client_set_list(gconf_client,
GCONF_KEY_REPOSITORIES,
GCONF_VALUE_STRING, temp_list, NULL);
+
+g_slist_free(temp_list);
+
+return TRUE;
+}
+
+static void
+config_default_repo(void)
+{
+/* We have no repositories - create a default one. */
+RepoData *repo = g_new(RepoData, 1);
+GConfClient *gconf_client = gconf_client_get_default();
+
+if (!gconf_client)
+ return FALSE;
+
+/* Get Map Cache Dir. Default is REPO_DEFAULT_CACHE_DIR. */
+repo->cache_dir = gconf_client_get_string(gconf_client,
+ GCONF_KEY_MAP_DIR_NAME,
+ NULL);
+
+if (!repo->cache_dir)
+ repo->cache_dir = gnome_vfs_expand_initial_tilde(REPO_DEFAULT_CACHE_DIR);
+
+/* Get Map Download URL Format. Default is "". */
+repo->url = gconf_client_get_string(gconf_client,
+ GCONF_KEY_MAP_URI_FORMAT,
+ NULL);
+if (!repo->url)
+ repo->url = g_strdup(REPO_DEFAULT_MAP_URI);
+
+/* Get Map Download Zoom Steps. Default is 2. */
+repo->dl_zoom_steps = gconf_client_get_int(gconf_client,
+ GCONF_KEY_MAP_ZOOM_STEPS,
+ NULL);
+if (!repo->dl_zoom_steps)
+ repo->dl_zoom_steps = REPO_DEFAULT_DL_ZOOM_STEPS;
+
+repo->name = g_strdup(REPO_DEFAULT_NAME);
+repo->view_zoom_steps = REPO_DEFAULT_VIEW_ZOOM_STEPS;
+repo->double_size = FALSE;
+repo->nextable = TRUE;
+set_repo_type(repo);
+
+_repo_list = g_list_append(_repo_list, repo);
+repo_set_curr(repo);
}
gboolean
-config_load_repo()
+config_load_repo(void)
{
GSList *list, *curr;
GConfValue *value;
}
g_slist_free(list);
-if (_repo_list == NULL) {
- /* We have no repositories - create a default one. */
- RepoData *repo = g_new(RepoData, 1);
-
- /* Many fields can be retrieved from the "old" gconf keys. */
-
- /* Get Map Cache Dir. Default is REPO_DEFAULT_CACHE_DIR. */
- repo->cache_dir = gconf_client_get_string(gconf_client,
- GCONF_KEY_MAP_DIR_NAME,
- NULL);
-
- if (!repo->cache_dir)
- repo->cache_dir = gnome_vfs_expand_initial_tilde(REPO_DEFAULT_CACHE_DIR);
-
- /* Get Map Download URL Format. Default is "". */
- repo->url = gconf_client_get_string(gconf_client,
- GCONF_KEY_MAP_URI_FORMAT,
- NULL);
- if (!repo->url)
- repo->url = g_strdup(REPO_DEFAULT_MAP_URI);
-
- /* Get Map Download Zoom Steps. Default is 2. */
- repo->dl_zoom_steps = gconf_client_get_int(gconf_client,
- GCONF_KEY_MAP_ZOOM_STEPS,
- NULL);
- if (!repo->dl_zoom_steps)
- repo->dl_zoom_steps = REPO_DEFAULT_DL_ZOOM_STEPS;
-
- /* Other fields are brand new. */
- repo->name = g_strdup(REPO_DEFAULT_NAME);
- repo->view_zoom_steps = REPO_DEFAULT_VIEW_ZOOM_STEPS;
- repo->double_size = FALSE;
- repo->nextable = TRUE;
- set_repo_type(repo);
-
- _repo_list = g_list_append(_repo_list, repo);
- repo_set_curr(repo);
-}
+if (_repo_list == NULL)
+ config_default_repo();
return TRUE;
}
* Save all configuration data to GCONF.
*/
gboolean
-config_save()
+config_save(void)
{
gchar *config_dir;
GConfClient *gconf_client = gconf_client_get_default();
* Initialize all configuration from GCONF. This should not be called more
* than once during execution.
*/
-void config_init()
+void config_init(void)
{
GConfValue *value;
GConfClient *gconf_client = gconf_client_get_default();