]> Pileus Git - aweather/blob - src/plugins/gps-plugin.h
Initial checkin of prototype gps plugin support.
[aweather] / src / plugins / gps-plugin.h
1 /*
2  * Copyright (C) 2012 Adam Boggs <boggs@aircrafter.org>
3  * 
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  * 
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  * 
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17 #ifndef _GPS_PLUGIN_H
18 #define _GPS_PLUGIN_H
19
20 gpointer gps_init(GtkWidget *gbox, GtkWidget *status_bar);
21
22 void gps_set_follow(gpointer state, gboolean track);
23 gboolean gps_key_press_event(gpointer state, GdkEventKey *kevent);
24 gboolean gps_redraw_all(gpointer data);
25
26 #define GRITS_TYPE_PLUGIN_GPS            (grits_plugin_gps_get_type ())
27 #define GRITS_PLUGIN_GPS(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj),   GRITS_TYPE_PLUGIN_GPS, GritsPluginGPS))
28 #define GRITS_IS_PLUGIN_GPS(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj),   GRITS_TYPE_PLUGIN_GPS))
29 #define GRITS_PLUGIN_GPS_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST   ((klass), GRITS_TYPE_PLUGIN_GPS, GritsPluginGPSClass))
30 #define GRITS_IS_PLUGIN_GPS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE   ((klass), GRITS_TYPE_PLUGIN_GPS))
31 #define GRITS_PLUGIN_GPS_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),   GRITS_TYPE_PLUGIN_GPS, GritsPluginGPSClass))
32
33 typedef struct _GritsPluginGPS      GritsPluginGPS;
34 typedef struct _GritsPluginGPSClass GritsPluginGPSClass;
35
36 /* All the User Interface objects we need to keep track of. */
37 struct gps_ui_t {
38     /* gps info frame */
39     GtkWidget *gps_status_frame;
40     GtkWidget *gps_status_table;
41     GtkWidget *gps_status_label;
42     GtkWidget *gps_latitude_label;
43     GtkWidget *gps_longitude_label;
44     GtkWidget *gps_heading_label;
45     GtkWidget *gps_elevation_label;
46
47     GtkWidget *status_bar;
48
49     /* control frame */
50     GtkWidget *gps_follow_checkbox;
51     GtkWidget *gps_track_checkbox;
52
53     /* log frame */
54     GtkWidget *gps_log_checkbox;
55     GtkWidget *gps_log_filename_entry;
56     GtkWidget *gps_log_interval_slider;
57     guint gps_log_timeout_id;           /* id of timeout so we can delete it */
58     unsigned int gps_log_number;        /* sequential log number */
59
60     /* spotternetwork frame */
61     GtkWidget *gps_sn_checkbox;
62     GtkWidget *gps_sn_active_checkbox;
63     gboolean gps_sn_active;             /* Whether chaser is "active" or not */
64     SoupSession *soup_session;          /* for sn requests */
65     guint gps_sn_timeout_id;            /* id of timeout so we can delete it */
66     GtkWidget *gps_sn_entry;            /* Entry box for spotternetwork ID */
67
68     /* range ring frame */
69     GtkWidget *gps_rangering_checkbox;
70 };
71
72 /* GPS private data */
73 struct _GritsPluginGPS {
74         GObject parent_instance;
75
76         /* instance members */
77         GritsViewer *viewer;
78         GritsPrefs  *prefs;
79         GtkWidget   *config;
80         guint        tab_id;
81         GtkWidget *hbox;
82         GritsMarker *marker;
83
84         struct gps_data_t *gps_data;
85         gboolean follow_gps;
86         gboolean gps_sn_active;
87         gboolean gps_rangering_active;  /* range rings are visible or not */
88         guint gps_update_timeout_id;    /* id of timeout so we can delete it */
89
90         struct gps_ui_t ui;
91 };
92
93 struct _GritsPluginGPSClass {
94         GObjectClass parent_class;
95 };
96
97 GType grits_plugin_gps_get_type();
98
99
100 #endif /* GPS_PLUGIN_H */
101