From: Kaj-Michael Lang Date: Mon, 4 Feb 2008 12:39:37 +0000 (+0200) Subject: Make the track/route load/save functions into two generic path load/save functions X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f84723bc5794e5961dcdd54b3140c383e7c544a6;p=mapper Make the track/route load/save functions into two generic path load/save functions --- diff --git a/src/config-gconf.c b/src/config-gconf.c index 9810f13..ad5bb59 100644 --- a/src/config-gconf.c +++ b/src/config-gconf.c @@ -78,13 +78,13 @@ if (gconf_client_get_bool(gconf_client, GCONF_KEY_HTTP_PROXY_ON, NULL)) { } static void -track_save(const gchar *config_dir, const gchar *file) +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)) { - write_gpx(&_track, handle); + write_gpx(path, handle); gnome_vfs_close(handle); } g_free(tfile); @@ -415,33 +415,19 @@ g_free(config_dir); return TRUE; } -static void -config_load_saved_route(gchar *config_dir) -{ -gchar *route_file; -gchar *bytes; -gint size; - -route_file = gnome_vfs_uri_make_full_from_relative(config_dir, CONFIG_FILE_ROUTE); -if (GNOME_VFS_OK == gnome_vfs_read_entire_file(route_file, &size, &bytes)) - parse_gpx(&_route, bytes, size, 0); /* 0 to replace route. */ -g_free(route_file); -} - -static void -config_load_saved_track(gchar *config_dir) +static void +path_load(Path *path, const gchar *config_dir, const gchar *file) { -gchar *track_file; +gchar *pfile; gchar *bytes; gint size; -track_file = gnome_vfs_uri_make_full_from_relative(config_dir, CONFIG_FILE_TRACK); -if (GNOME_VFS_OK == gnome_vfs_read_entire_file(track_file, &size, &bytes)) - parse_gpx(&_track, bytes, size, 0); /* 0 to replace track. */ -g_free(track_file); +pfile = gnome_vfs_uri_make_full_from_relative(config_dir, file); +if (GNOME_VFS_OK == gnome_vfs_read_entire_file(pfile, &size, &bytes)) + parse_gpx(path, bytes, size, 0); /* 0 to replace track. */ +g_free(pfile); } - /** * Initialize all configuration from GCONF. This should not be called more * than once during execution.