]>
Commit | Line | Data |
---|---|---|
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 | ||
a25c4c50 GB |
25 | #include <gtk/gtk.h> |
26 | ||
27 | #include "vikwindow.h" | |
28 | #include "viklayerspanel.h" | |
29 | #include "vikviewport.h" | |
30 | ||
cf697cc2 EB |
31 | typedef struct _VikDataSourceInterface VikDataSourceInterface; |
32 | ||
7b3479e3 EB |
33 | /* global data structure used to expose the progress dialog to the worker thread */ |
34 | typedef 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 */ | |
cf697cc2 | 41 | VikDataSourceInterface *interface; |
65f0ccab | 42 | gpointer user_data; |
7b3479e3 EB |
43 | } acq_dialog_widgets_t; |
44 | ||
45 | typedef enum { VIK_DATASOURCE_GPSBABEL_DIRECT, VIK_DATASOURCE_SHELL_CMD } vik_datasource_type_t; | |
805d282e | 46 | typedef enum { VIK_DATASOURCE_CREATENEWLAYER, VIK_DATASOURCE_ADDTOLAYER } vik_datasource_mode_t; |
7b3479e3 | 47 | |
7b3479e3 | 48 | |
65f0ccab AF |
49 | /* returns pointer to state if OK, otherwise NULL */ |
50 | typedef gpointer (*VikDataSourceInitFunc) (); | |
92255687 EB |
51 | |
52 | /* returns NULL if OK, otherwise returns an error message. */ | |
53 | typedef gchar *(*VikDataSourceCheckExistenceFunc) (); | |
54 | ||
65f0ccab AF |
55 | /* Create widgets to show in a setup dialog, set up state via user_data */ |
56 | typedef 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) */ | |
61 | typedef void (*VikDataSourceGetCmdStringFunc) ( gpointer user_data, gchar **babelargs_or_shellcmd, gchar **inputfile_or_inputtype ); | |
62 | ||
63 | /* */ | |
7b3479e3 | 64 | typedef void (*VikDataSourceProgressFunc) (gpointer c, gpointer data, acq_dialog_widgets_t *w); |
65f0ccab AF |
65 | |
66 | /* Creates widgets to show in a progress dialog, may set up state via user_data */ | |
67 | typedef void (*VikDataSourceAddProgressWidgetsFunc) ( GtkWidget *dialog, gpointer user_data ); | |
68 | ||
69 | /* Frees any widgets created for the setup or progress dialogs, any allocated state, etc. */ | |
70 | typedef void (*VikDataSourceCleanupFunc) ( gpointer user_data ); | |
71 | ||
7b3479e3 | 72 | |
cf697cc2 | 73 | struct _VikDataSourceInterface { |
a8d46e0b | 74 | const gchar *window_title; |
7b3479e3 EB |
75 | const gchar *layer_title; |
76 | vik_datasource_type_t type; | |
805d282e | 77 | vik_datasource_type_t mode; |
7b3479e3 | 78 | |
65f0ccab AF |
79 | VikDataSourceInitFunc init_func; |
80 | VikDataSourceCheckExistenceFunc check_existence_func; | |
81 | VikDataSourceAddSetupWidgetsFunc add_setup_widgets_func; | |
82 | VikDataSourceGetCmdStringFunc get_cmd_string_func; | |
7b3479e3 EB |
83 | |
84 | VikDataSourceProgressFunc progress_func; | |
85 | VikDataSourceAddProgressWidgetsFunc add_progress_widgets_func; | |
86 | VikDataSourceCleanupFunc cleanup_func; | |
cf697cc2 | 87 | }; |
7b3479e3 EB |
88 | |
89 | ||
90 | void a_acquire ( VikWindow *vw, VikLayersPanel *vlp, VikViewport *vvp, VikDataSourceInterface *interface ); | |
1d1bc3c1 EB |
91 | |
92 | #endif |