]> git.street.me.uk Git - andy/viking.git/blame_incremental - src/acquire.h
Gpslayer: New menu items to remove all tracks and waypoints in GPS folders.
[andy/viking.git] / src / acquire.h
... / ...
CommitLineData
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#include <gtk/gtk.h>
26
27#include "vikwindow.h"
28#include "viklayerspanel.h"
29#include "vikviewport.h"
30
31typedef struct _VikDataSourceInterface VikDataSourceInterface;
32
33/* global data structure used to expose the progress dialog to the worker thread */
34typedef struct {
35 GtkWidget *status;
36 VikWindow *vw;
37 VikLayersPanel *vlp;
38 VikViewport *vvp;
39 GtkWidget *dialog;
40 gboolean ok; /* if OK is false when we exit, we MUST free w */
41 VikDataSourceInterface *interface;
42 gpointer user_data;
43} acq_dialog_widgets_t;
44
45typedef enum { VIK_DATASOURCE_GPSBABEL_DIRECT, VIK_DATASOURCE_SHELL_CMD } vik_datasource_type_t;
46typedef enum { VIK_DATASOURCE_CREATENEWLAYER, VIK_DATASOURCE_ADDTOLAYER } vik_datasource_mode_t;
47
48
49/* returns pointer to state if OK, otherwise NULL */
50typedef gpointer (*VikDataSourceInitFunc) ();
51
52/* returns NULL if OK, otherwise returns an error message. */
53typedef gchar *(*VikDataSourceCheckExistenceFunc) ();
54
55/* Create widgets to show in a setup dialog, set up state via user_data */
56typedef void (*VikDataSourceAddSetupWidgetsFunc) ( GtkWidget *dialog, VikViewport *vvp, gpointer user_data );
57
58/* if VIK_DATASOURCE_GPSBABEL_DIRECT, babelargs and inputfile.
59 if VIK_DATASOURCE_SHELL_CMD, shellcmd and inputtype.
60 set both to NULL to signal refusal (ie already downloading) */
61typedef void (*VikDataSourceGetCmdStringFunc) ( gpointer user_data, gchar **babelargs_or_shellcmd, gchar **inputfile_or_inputtype );
62
63/* */
64typedef void (*VikDataSourceProgressFunc) (gpointer c, gpointer data, acq_dialog_widgets_t *w);
65
66/* Creates widgets to show in a progress dialog, may set up state via user_data */
67typedef void (*VikDataSourceAddProgressWidgetsFunc) ( GtkWidget *dialog, gpointer user_data );
68
69/* Frees any widgets created for the setup or progress dialogs, any allocated state, etc. */
70typedef void (*VikDataSourceCleanupFunc) ( gpointer user_data );
71
72
73struct _VikDataSourceInterface {
74 const gchar *window_title;
75 const gchar *layer_title;
76 vik_datasource_type_t type;
77 vik_datasource_type_t mode;
78
79 VikDataSourceInitFunc init_func;
80 VikDataSourceCheckExistenceFunc check_existence_func;
81 VikDataSourceAddSetupWidgetsFunc add_setup_widgets_func;
82 VikDataSourceGetCmdStringFunc get_cmd_string_func;
83
84 VikDataSourceProgressFunc progress_func;
85 VikDataSourceAddProgressWidgetsFunc add_progress_widgets_func;
86 VikDataSourceCleanupFunc cleanup_func;
87};
88
89
90void a_acquire ( VikWindow *vw, VikLayersPanel *vlp, VikViewport *vvp, VikDataSourceInterface *interface );
91
92#endif