static gboolean babel_general_convert_to( VikTrwLayer *vt, VikTrack *trk, BabelStatusFunc cb, gchar **args, const gchar *name_src, gpointer user_data ) { // Now strips out invisible tracks and waypoints if (!a_file_export(vt, name_src, FILE_TYPE_GPX, trk, FALSE)) { g_critical("Error exporting to %s", name_src); return FALSE; } return babel_general_convert (cb, args, user_data); }
static gboolean load_feature () { int i; gboolean ret = FALSE; gchar *args[4]; if ( gpsbabel_loc ) { i = 0; if ( unbuffer_loc ) args[i++] = unbuffer_loc; args[i++] = gpsbabel_loc; args[i++] = "-^3"; args[i] = NULL; ret = babel_general_convert (load_feature_cb, args, NULL); } return ret; }
/** * babel_general_convert_from: * @vtl: The TrackWaypoint Layer to save the data into * If it is null it signifies that no data is to be processed, * however the gpsbabel command is still ran as it can be for non-data related options eg: * for use with the power off command - 'command_off' * @cb: callback that is run upon new data from STDOUT (?) * (TODO: STDERR would be nice since we usually redirect STDOUT) * @user_data: passed along to cb * * Runs args[0] with the arguments and uses the GPX module * to import the GPX data into layer vt. Assumes that upon * running the command, the data will appear in the (usually * temporary) file name_dst. * * Returns: %TRUE on success */ static gboolean babel_general_convert_from( VikTrwLayer *vt, BabelStatusFunc cb, gchar **args, const gchar *name_dst, gpointer user_data ) { gboolean ret = FALSE; FILE *f = NULL; if (babel_general_convert(cb, args, user_data)) { /* No data actually required but still need to have run gpsbabel anyway - eg using the device power command_off */ if ( vt == NULL ) return TRUE; f = g_fopen(name_dst, "r"); if (f) { ret = a_gpx_read_file ( vt, f ); fclose(f); f = NULL; } } return ret; }