]> git.street.me.uk Git - andy/viking.git/blobdiff - src/babel.c
Document previous translation updates
[andy/viking.git] / src / babel.c
index 63b1ea587c5ad3a8c8e50225587a4ceb9bb0331e..91c86314994fc496d9558766a1f4e5150dd9794f 100644 (file)
@@ -2,6 +2,7 @@
  * viking -- GPS Data and Topo Analyzer, Explorer, and Manager
  *
  * Copyright (C) 2003-2005, Evan Battaglia <gtoevan@gmx.net>
+ * Copyright (C) 2006, Quy Tonthat <qtonthat@gmail.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -158,6 +159,10 @@ gboolean babel_general_convert_from( VikTrwLayer *vt, BabelStatusFunc cb, gchar
     g_error_free(error);
     ret = FALSE;
   } else {
+    /* No data required */
+    if ( vt == NULL )
+      return TRUE;
+
     gchar line[512];
     FILE *diag;
     diag = fdopen(babel_stdout, "r");
@@ -217,7 +222,7 @@ gboolean a_babel_convert_from( VikTrwLayer *vt, const char *babelargs, BabelStat
       args[i++] = "-o";
       args[i++] = "gpx";
       args[i++] = "-f";
-      args[i++] = from;
+      args[i++] = (char *)from;
       args[i++] = "-F";
       args[i++] = name_dst;
       args[i] = NULL;
@@ -226,7 +231,8 @@ gboolean a_babel_convert_from( VikTrwLayer *vt, const char *babelargs, BabelStat
 
       g_free ( unbuffer_loc );
       g_strfreev(sub_args);
-    }
+    } else
+      g_warning("gpsbabel not found in PATH");
     g_free(gpsbabel_loc);
   }
 
@@ -276,7 +282,7 @@ gboolean a_babel_convert_from_shellcommand ( VikTrwLayer *vt, const char *input_
 
 gboolean a_babel_convert_from_url ( VikTrwLayer *vt, const char *url, const char *input_type, BabelStatusFunc cb, gpointer user_data )
 {
-  static DownloadOptions options = {NULL, 0, a_check_html_file};
+  static DownloadMapOptions options = { FALSE, FALSE, NULL, 0, a_check_kml_file};
   gint fd_src;
   int fetch_ret;
   gboolean ret = FALSE;
@@ -291,7 +297,7 @@ gboolean a_babel_convert_from_url ( VikTrwLayer *vt, const char *url, const char
 
     babelargs = g_strdup_printf(" -i %s", input_type);
 
-    fetch_ret = a_http_download_get_url(url, "", name_src, &options);
+    fetch_ret = a_http_download_get_url(url, "", name_src, &options, NULL);
     if (fetch_ret == 0)
       ret = a_babel_convert_from( vt, babelargs, NULL, name_src, NULL);
  
@@ -441,14 +447,15 @@ gboolean a_babel_convert_to( VikTrwLayer *vt, const char *babelargs, BabelStatus
       args[i++] = "-f";
       args[i++] = name_src;
       args[i++] = "-F";
-      args[i++] = to;
+      args[i++] = (char *)to;
       args[i] = NULL;
 
       ret = babel_general_convert_to ( vt, cb, args, name_src, user_data );
 
       g_free ( unbuffer_loc );
       g_strfreev(sub_args);
-    }
+    } else
+      g_warning("gpsbabel not found in PATH");
     g_free(gpsbabel_loc);
   }