]> git.street.me.uk Git - andy/viking.git/blob - src/acquire.h
Data sources core structure, google directions
[andy/viking.git] / src / acquire.h
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
25 /* global data structure used to expose the progress dialog to the worker thread */
26 typedef struct {
27   GtkWidget *status;
28   VikWindow *vw;
29   VikLayersPanel *vlp;
30   VikViewport *vvp;
31   GtkWidget *dialog;
32   gboolean ok; /* if OK is false when we exit, we MUST free w */
33   gpointer specific_data;
34 } acq_dialog_widgets_t;
35
36 typedef enum { VIK_DATASOURCE_GPSBABEL_DIRECT, VIK_DATASOURCE_SHELL_CMD } vik_datasource_type_t;
37
38 typedef gpointer (*VikDataSourceAddWidgetsFunc) ( GtkWidget *dialog );
39
40 /* if VIK_DATASOURCE_GPSBABEL_DIRECT, babelargs and inputfile.
41    if VIK_DATASOURCE_SHELL_CMD, shellcmd and inputtype.
42    set both to NULL to signal refusal (ie already downloading) */
43 typedef void (*VikDataSourceGetCmdStringFunc) ( gpointer widgets_data, gchar **babelargs_or_shellcmd, gchar **inputfile_or_inputtype );
44 typedef void (*VikDataSourceFirstCleanupFunc) ( gpointer widgets_data );
45 typedef void  (*VikDataSourceProgressFunc)  (gpointer c, gpointer data, acq_dialog_widgets_t *w);
46 typedef gpointer  (*VikDataSourceAddProgressWidgetsFunc) ( GtkWidget *dialog );
47 typedef void (*VikDataSourceCleanupFunc) ( gpointer progress_widgets_data );
48
49 typedef struct {
50   const gchar *layer_title;
51   vik_datasource_type_t type;
52
53   VikDataSourceAddWidgetsFunc add_widgets_func; /* NULL if no first dialog */
54   VikDataSourceGetCmdStringFunc get_cmd_string_func; /* passed rv from above */
55   VikDataSourceFirstCleanupFunc first_cleanup_func; /* frees rv from addwidgets */
56
57   VikDataSourceProgressFunc progress_func;
58   VikDataSourceAddProgressWidgetsFunc add_progress_widgets_func;
59   VikDataSourceCleanupFunc cleanup_func;
60 } VikDataSourceInterface;
61
62
63 void a_acquire ( VikWindow *vw, VikLayersPanel *vlp, VikViewport *vvp, VikDataSourceInterface *interface );
64
65 #endif