]> err.no Git - mapper/commitdiff
Make the track/route load/save functions into two generic path load/save functions
authorKaj-Michael Lang <milang@onion.tal.org>
Mon, 4 Feb 2008 12:39:37 +0000 (14:39 +0200)
committerKaj-Michael Lang <milang@onion.tal.org>
Mon, 4 Feb 2008 12:39:37 +0000 (14:39 +0200)
src/config-gconf.c

index 9810f135e1fa8832092679800bd2aa573c428a61..ad5bb59bd0333e98b67aeff8175d223f01ed718a 100644 (file)
@@ -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.