]> git.street.me.uk Git - andy/viking.git/blob - src/acquire.h
small fixes in acquire from gps code
[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 typedef struct _VikDataSourceInterface VikDataSourceInterface;
26
27 /* global data structure used to expose the progress dialog to the worker thread */
28 typedef 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;
36   VikDataSourceInterface *interface;
37 } acq_dialog_widgets_t;
38
39 typedef enum { VIK_DATASOURCE_GPSBABEL_DIRECT, VIK_DATASOURCE_SHELL_CMD } vik_datasource_type_t;
40 typedef enum { VIK_DATASOURCE_CREATENEWLAYER, VIK_DATASOURCE_ADDTOLAYER } vik_datasource_mode_t;
41
42 typedef gpointer (*VikDataSourceAddWidgetsFunc) ( GtkWidget *dialog, VikViewport *vvp );
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) */
47
48 /* returns NULL if OK, otherwise returns an error message. */
49 typedef gchar *(*VikDataSourceCheckExistenceFunc) ();
50
51 typedef void (*VikDataSourceGetCmdStringFunc) ( gpointer widgets_data, gchar **babelargs_or_shellcmd, gchar **inputfile_or_inputtype );
52 typedef void (*VikDataSourceFirstCleanupFunc) ( gpointer widgets_data );
53 typedef void  (*VikDataSourceProgressFunc)  (gpointer c, gpointer data, acq_dialog_widgets_t *w);
54 typedef gpointer  (*VikDataSourceAddProgressWidgetsFunc) ( GtkWidget *dialog );
55 typedef void (*VikDataSourceCleanupFunc) ( gpointer progress_widgets_data );
56
57 struct _VikDataSourceInterface {
58   const gchar *window_title;
59   const gchar *layer_title;
60   vik_datasource_type_t type;
61   vik_datasource_type_t mode;
62
63   VikDataSourceCheckExistenceFunc check_existence_func; /* NULL if no first dialog */
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;
71 };
72
73
74 void a_acquire ( VikWindow *vw, VikLayersPanel *vlp, VikViewport *vvp, VikDataSourceInterface *interface );
75
76 #endif