This is designed to handle the main event of conversion / whatever processing is to be done.
ATM only invoked for the new VIK_DATASOURCE_INTERNAL type.
}
gdk_threads_leave();
+ // TODO consider removing 'type' and make everything run via the specficied process function
switch ( source_interface->type ) {
case VIK_DATASOURCE_GPSBABEL_DIRECT:
result = a_babel_convert_from (vtl, cmd, (BabelStatusFunc) progress_func, extra, w);
case VIK_DATASOURCE_SHELL_CMD:
result = a_babel_convert_from_shellcommand ( vtl, cmd, extra, (BabelStatusFunc) progress_func, w);
break;
+ case VIK_DATASOURCE_INTERNAL:
+ if ( source_interface->process_func )
+ result = source_interface->process_func ( vtl, cmd, extra, (BabelStatusFunc) progress_func, w );
+ break;
default:
g_critical("Houston, we've had a problem.");
}
/* for manual dialogs */
GtkWidget *dialog = NULL;
GtkWidget *status;
- gchar *cmd, *extra;
+ gchar *cmd = NULL;
+ gchar *extra = NULL;
gchar *cmd_off = NULL;
gchar *extra_off = NULL;
acq_dialog_widgets_t *w;
( pass_along_data, &cmd, &extra, name_src_track );
g_free ( name_src_track );
- } else
- source_interface->get_cmd_string_func ( pass_along_data, &cmd, &extra );
+ } else if ( source_interface->get_cmd_string_func )
+ source_interface->get_cmd_string_func ( pass_along_data, &cmd, &extra );
/* Get data for Off command */
if ( source_interface->off_func ) {
#include "vikwindow.h"
#include "viklayerspanel.h"
#include "vikviewport.h"
+#include "babel.h"
typedef struct _VikDataSourceInterface VikDataSourceInterface;
gpointer user_data;
} acq_dialog_widgets_t;
+/* Direct, URL & Shell types process the results with GPSBabel to create tracks/waypoint */
typedef enum {
VIK_DATASOURCE_GPSBABEL_DIRECT,
VIK_DATASOURCE_URL,
- VIK_DATASOURCE_SHELL_CMD
+ VIK_DATASOURCE_SHELL_CMD,
+ VIK_DATASOURCE_INTERNAL
} vik_datasource_type_t;
typedef enum {
typedef void (*VikDataSourceGetCmdStringFuncWithInput) ( gpointer user_data, gchar **babelargs_or_shellcmd, gchar **inputfile_or_inputtype, const gchar *input_file_name );
typedef void (*VikDataSourceGetCmdStringFuncWithInputInput) ( gpointer user_data, gchar **babelargs_or_shellcmd, gchar **inputfile_or_inputtype, const gchar *input_file_name, const gchar *input_track_file_name );
+/* The actual function to do stuff - must report success/failure */
+typedef gboolean (*VikDataSourceProcessFunc) ( gpointer vtl, const gchar *cmd, const gchar *extra, BabelStatusFunc status_cb, acq_dialog_widgets_t *adw );
+
/* */
typedef void (*VikDataSourceProgressFunc) (gpointer c, gpointer data, acq_dialog_widgets_t *w);
/* or VikDataSourceGetCmdStringFuncWithInput, if inputtype is not NONE */
VikDataSourceGetCmdStringFunc get_cmd_string_func;
+ VikDataSourceProcessFunc process_func;
+
VikDataSourceProgressFunc progress_func;
VikDataSourceAddProgressWidgetsFunc add_progress_widgets_func;
VikDataSourceCleanupFunc cleanup_func;
FALSE, /* keep dialog open after success */
NULL, NULL, NULL,
(VikDataSourceGetCmdStringFunc) datasource_bfilter_simplify_get_cmd_string,
+ (VikDataSourceProcessFunc) NULL,
NULL, NULL, NULL,
(VikDataSourceOffFunc) NULL,
FALSE, /* keep dialog open after success */
NULL, NULL, NULL,
(VikDataSourceGetCmdStringFunc) datasource_bfilter_dup_get_cmd_string,
+ (VikDataSourceProcessFunc) NULL,
NULL, NULL, NULL,
(VikDataSourceOffFunc) NULL,
FALSE, /* keep dialog open after success */
NULL, NULL, NULL,
(VikDataSourceGetCmdStringFunc) datasource_bfilter_polygon_get_cmd_string,
+ (VikDataSourceProcessFunc) NULL,
NULL, NULL, NULL,
(VikDataSourceOffFunc) NULL,
FALSE, /* keep dialog open after success */
NULL, NULL, NULL,
(VikDataSourceGetCmdStringFunc) datasource_bfilter_exclude_polygon_get_cmd_string,
+ (VikDataSourceProcessFunc) NULL,
NULL, NULL, NULL,
(VikDataSourceOffFunc) NULL,
(VikDataSourceCheckExistenceFunc) NULL,
(VikDataSourceAddSetupWidgetsFunc) datasource_file_add_setup_widgets,
(VikDataSourceGetCmdStringFunc) datasource_file_get_cmd_string,
+ (VikDataSourceProcessFunc) NULL,
(VikDataSourceProgressFunc) NULL,
(VikDataSourceAddProgressWidgetsFunc) NULL,
(VikDataSourceCleanupFunc) datasource_file_cleanup,
(VikDataSourceCheckExistenceFunc) datasource_gc_check_existence,
(VikDataSourceAddSetupWidgetsFunc) datasource_gc_add_setup_widgets,
(VikDataSourceGetCmdStringFunc) datasource_gc_get_cmd_string,
+ (VikDataSourceProcessFunc) NULL,
(VikDataSourceProgressFunc) NULL,
(VikDataSourceAddProgressWidgetsFunc) NULL,
(VikDataSourceCleanupFunc) datasource_gc_cleanup,
(VikDataSourceCheckExistenceFunc) NULL,
(VikDataSourceAddSetupWidgetsFunc) datasource_google_add_setup_widgets,
(VikDataSourceGetCmdStringFunc) datasource_google_get_cmd_string,
+ (VikDataSourceProcessFunc) NULL,
(VikDataSourceProgressFunc) NULL,
(VikDataSourceAddProgressWidgetsFunc) NULL,
(VikDataSourceCleanupFunc) datasource_google_cleanup,
(VikDataSourceCheckExistenceFunc) NULL,
(VikDataSourceAddSetupWidgetsFunc) datasource_gps_add_setup_widgets,
(VikDataSourceGetCmdStringFunc) datasource_gps_get_cmd_string,
+ (VikDataSourceProcessFunc) NULL,
(VikDataSourceProgressFunc) datasource_gps_progress,
(VikDataSourceAddProgressWidgetsFunc) datasource_gps_add_progress_widgets,
(VikDataSourceCleanupFunc) datasource_gps_cleanup,
(VikDataSourceCheckExistenceFunc) NULL,
(VikDataSourceAddSetupWidgetsFunc) datasource_osm_add_setup_widgets,
(VikDataSourceGetCmdStringFunc) datasource_osm_get_cmd_string,
+ (VikDataSourceProcessFunc) NULL,
(VikDataSourceProgressFunc) NULL,
(VikDataSourceAddProgressWidgetsFunc) NULL,
(VikDataSourceCleanupFunc) datasource_osm_cleanup,