From: Kaj-Michael Lang Date: Thu, 20 Mar 2008 21:53:56 +0000 (+0200) Subject: Move path_load/save function to path.c X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=255371aad6a21c90106f0b380fff13da9161772b;p=mapper Move path_load/save function to path.c --- diff --git a/src/config-gconf.c b/src/config-gconf.c index 469a74c..cfd804c 100644 --- a/src/config-gconf.c +++ b/src/config-gconf.c @@ -79,19 +79,6 @@ if (gconf_client_get_bool(gconf_client, GCONF_KEY_HTTP_PROXY_ON, NULL)) { } } -static void -path_save(Path *path, const gchar *config_dir, const gchar *file) -{ -GnomeVFSHandle *handle; -gchar *tfile; -tfile=gnome_vfs_uri_make_full_from_relative(config_dir, file); -if (GNOME_VFS_OK == gnome_vfs_create(&handle, tfile, GNOME_VFS_OPEN_WRITE, FALSE, 0600)) { - gpx_write(path, handle); - gnome_vfs_close(handle); -} -g_free(tfile); -} - gboolean config_save_repo(void) { @@ -410,26 +397,10 @@ else gconf_client_set_int(gconf_client, GCONF_KEY_POI_ZOOM, _poi_zoom, NULL); gconf_client_suggest_sync(gconf_client, NULL); -#if 0 -gconf_client_clear_cache(gconf_client); -#endif g_free(config_dir); return TRUE; } -static void -path_load(Path *path, const gchar *config_dir, const gchar *file) -{ -gchar *pfile; -gchar *bytes; -gint size; - -pfile = gnome_vfs_uri_make_full_from_relative(config_dir, file); -if (GNOME_VFS_OK == gnome_vfs_read_entire_file(pfile, &size, &bytes)) - gpx_parse(path, bytes, size, GPX_PATH_NEW); -g_free(pfile); -} - /** * */ diff --git a/src/path.c b/src/path.c index fbb734c..66ac836 100644 --- a/src/path.c +++ b/src/path.c @@ -2,14 +2,15 @@ #include +#include "mapper-types.h" +#include "path.h" #include "utils.h" #include "map.h" -#include "route.h" -#include "mapper-types.h" #include "track.h" -#include "path.h" +#include "route.h" #include "settings.h" #include "latlon.h" +#include "gpx.h" Path * path_new(void) @@ -87,6 +88,34 @@ if (path->tail->unity) { return FALSE; } +gboolean +path_load(Path *path, const gchar *config_dir, const gchar *file) +{ +gchar *pfile; +gchar *bytes; +gint size; + +pfile = gnome_vfs_uri_make_full_from_relative(config_dir, file); +if (gnome_vfs_read_entire_file(pfile, &size, &bytes)==GNOME_VFS_OK) + gpx_parse(path, bytes, size, GPX_PATH_NEW); +g_free(pfile); +return TRUE; +} + +gboolean +path_save(Path *path, const gchar *config_dir, const gchar *file) +{ +GnomeVFSHandle *handle; +gchar *tfile; +tfile=gnome_vfs_uri_make_full_from_relative(config_dir, file); +if (gnome_vfs_create(&handle, tfile, GNOME_VFS_OPEN_WRITE, FALSE, 0600)==GNOME_VFS_OK) { + gpx_write(path, handle); + gnome_vfs_close(handle); +} +g_free(tfile); +return TRUE; +} + /** * Add a text description at current point *