gboolean menu_cb_route_save(GtkAction * action)
{
- GnomeVFSHandle *handle;
printf("%s()\n", __PRETTY_FUNCTION__);
- if (open_file(NULL, &handle, NULL, &_route_dir_uri, NULL,
- GTK_FILE_CHOOSER_ACTION_SAVE)) {
- if (write_gpx(&_route, handle)) {
- MACRO_BANNER_SHOW_INFO(_window, _("Route Saved"));
- } else
- popup_error(_window, _("Error writing GPX file."));
- gnome_vfs_close(handle);
- }
+ route_save();
vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
return TRUE;
#include <string.h>
#include <strings.h>
#include <stddef.h>
+#include <libintl.h>
#include <locale.h>
#include <math.h>
#include <errno.h>
#include <fcntl.h>
#include <libgnomevfs/gnome-vfs.h>
#include <curl/multi.h>
-#include <gconf/gconf-client.h>
-#include <libxml/parser.h>
#include "utils.h"
#include "gps.h"
gboolean route_open_file()
{
- gchar *buffer;
- gint size;
-
- if (open_file(&buffer, NULL, &size, &_route_dir_uri, NULL,
- GTK_FILE_CHOOSER_ACTION_OPEN)) {
- /* If auto is enabled, append the route, otherwise replace it. */
- if (parse_gpx(&_route, buffer, size,
- _autoroute_data.enabled ? 0 : 1)) {
- cancel_autoroute(FALSE);
+gchar *buffer;
+gint size;
+
+if (open_file(&buffer, NULL, &size, &_route_dir_uri, NULL, GTK_FILE_CHOOSER_ACTION_OPEN)) {
+ /* If auto is enabled, append the route, otherwise replace it. */
+ if (parse_gpx(&_route, buffer, size, _autoroute_data.enabled ? 0 : 1)) {
+ cancel_autoroute(FALSE);
+
+ /* Find the nearest route point, if we're connected. */
+ route_find_nearest_point();
+
+ map_force_redraw();
+ MACRO_BANNER_SHOW_INFO(_window, _("Route Opened"));
+ } else
+ popup_error(_window, _("Error parsing GPX file."));
+ g_free(buffer);
+}
+}
- /* Find the nearest route point, if we're connected. */
- route_find_nearest_point();
+gboolean
+route_save(void)
+{
+GnomeVFSHandle *handle;
- map_force_redraw();
- MACRO_BANNER_SHOW_INFO(_window, _("Route Opened"));
- } else
- popup_error(_window, _("Error parsing GPX file."));
- g_free(buffer);
+if (file_save(_route_dir_uri, _route_dir_uri, &handle)) {
+ if (write_gpx(&_route, handle)) {
+ MACRO_BANNER_SHOW_INFO(_window, _("Route Saved"));
+ } else {
+ popup_error(_window, _("Error writing GPX file."));
}
+ gnome_vfs_close(handle);
+ return TRUE;
+}
+return FALSE;
}
gboolean origin_type_selected(GtkWidget * toggle, OriginToggleInfo * oti)
#ifdef WITH_HILDON
if (_iap_connected && !_curl_sid)
- _curl_sid = g_timeout_add(100,
- (GSourceFunc) curl_download_timeout,
- NULL);
#else
if (!_curl_sid)
+#endif
_curl_sid = g_timeout_add(100,
(GSourceFunc) curl_download_timeout,
NULL);
-#endif
_autoroute_data.in_progress = TRUE;
return TRUE;
}
-WayPoint *find_nearest_waypoint(guint unitx, guint unity, guint _zoom)
+WayPoint *find_nearest_waypoint(guint unitx, guint unity)
{
WayPoint *wcurr;
WayPoint *wnear;