]> git.street.me.uk Git - andy/viking.git/blame - src/acquire.h
small fixes in acquire from gps code
[andy/viking.git] / src / acquire.h
CommitLineData
1d1bc3c1
EB
1/*
2 * viking -- GPS Data and Topo Analyzer, Explorer, and Manager
3 *
4 * Copyright (C) 2003-2005, Evan Battaglia <gtoevan@gmx.net>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 */
21
22#ifndef _VIKING_ACQUIRE_H
23#define _VIKING_ACQUIRE_H
24
cf697cc2
EB
25typedef struct _VikDataSourceInterface VikDataSourceInterface;
26
7b3479e3
EB
27/* global data structure used to expose the progress dialog to the worker thread */
28typedef struct {
29 GtkWidget *status;
30 VikWindow *vw;
31 VikLayersPanel *vlp;
32 VikViewport *vvp;
33 GtkWidget *dialog;
34 gboolean ok; /* if OK is false when we exit, we MUST free w */
35 gpointer specific_data;
cf697cc2 36 VikDataSourceInterface *interface;
7b3479e3
EB
37} acq_dialog_widgets_t;
38
39typedef enum { VIK_DATASOURCE_GPSBABEL_DIRECT, VIK_DATASOURCE_SHELL_CMD } vik_datasource_type_t;
805d282e 40typedef enum { VIK_DATASOURCE_CREATENEWLAYER, VIK_DATASOURCE_ADDTOLAYER } vik_datasource_mode_t;
7b3479e3 41
3333c069 42typedef gpointer (*VikDataSourceAddWidgetsFunc) ( GtkWidget *dialog, VikViewport *vvp );
7b3479e3
EB
43
44/* if VIK_DATASOURCE_GPSBABEL_DIRECT, babelargs and inputfile.
45 if VIK_DATASOURCE_SHELL_CMD, shellcmd and inputtype.
46 set both to NULL to signal refusal (ie already downloading) */
92255687
EB
47
48/* returns NULL if OK, otherwise returns an error message. */
49typedef gchar *(*VikDataSourceCheckExistenceFunc) ();
50
7b3479e3
EB
51typedef void (*VikDataSourceGetCmdStringFunc) ( gpointer widgets_data, gchar **babelargs_or_shellcmd, gchar **inputfile_or_inputtype );
52typedef void (*VikDataSourceFirstCleanupFunc) ( gpointer widgets_data );
53typedef void (*VikDataSourceProgressFunc) (gpointer c, gpointer data, acq_dialog_widgets_t *w);
54typedef gpointer (*VikDataSourceAddProgressWidgetsFunc) ( GtkWidget *dialog );
55typedef void (*VikDataSourceCleanupFunc) ( gpointer progress_widgets_data );
56
cf697cc2 57struct _VikDataSourceInterface {
a8d46e0b 58 const gchar *window_title;
7b3479e3
EB
59 const gchar *layer_title;
60 vik_datasource_type_t type;
805d282e 61 vik_datasource_type_t mode;
7b3479e3 62
92255687 63 VikDataSourceCheckExistenceFunc check_existence_func; /* NULL if no first dialog */
7b3479e3
EB
64 VikDataSourceAddWidgetsFunc add_widgets_func; /* NULL if no first dialog */
65 VikDataSourceGetCmdStringFunc get_cmd_string_func; /* passed rv from above */
66 VikDataSourceFirstCleanupFunc first_cleanup_func; /* frees rv from addwidgets */
67
68 VikDataSourceProgressFunc progress_func;
69 VikDataSourceAddProgressWidgetsFunc add_progress_widgets_func;
70 VikDataSourceCleanupFunc cleanup_func;
cf697cc2 71};
7b3479e3
EB
72
73
74void a_acquire ( VikWindow *vw, VikLayersPanel *vlp, VikViewport *vvp, VikDataSourceInterface *interface );
1d1bc3c1
EB
75
76#endif