~foxtrotgps-team/foxtrotgps/trunk

« back to all changes in this revision

Viewing changes to src/main.c

  • Committer: Paul Wise
  • Date: 2018-03-06 03:32:21 UTC
  • Revision ID: pabs3@bonedaddy.net-20180306033221-lzyia8y0cpw95j1b
Remove trailing whitespace

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
#include "init.h"
19
19
#include "callbacks.h"
20
20
#include "globals.h"
21
 
#include "wp.h"
22
 
#include "poi.h"
23
 
#include "converter.h"
24
 
#include "map_management.h"
25
21
 
26
22
int
27
23
main (int argc, char *argv[])
30
26
 
31
27
        gboolean fullscreen = FALSE;
32
28
        gboolean show_version = FALSE;
33
 
        char * waypoint_lat = NULL;
34
 
        char * waypoint_lon = NULL;
35
29
 
36
30
        GOptionEntry cmd_options[] =
37
31
        {
41
35
                 N_("Start in fullscreen mode"), NULL},
42
36
                {"gui", 0, 0, G_OPTION_ARG_FILENAME, &gladefile,
43
37
                 N_("Load the GUI from this GladeXML file"), "GLADEFILE"},
44
 
                {"lat", 0, 0, G_OPTION_ARG_STRING, &waypoint_lat,
45
 
                 N_("Select waypoint's latitude"), "LAT"},
46
 
                {"lon", 0, 0, G_OPTION_ARG_STRING, &waypoint_lon,
47
 
                 N_("Select waypoint's longitude"), "LON"},
48
 
                {NULL}
 
38
                {NULL}
49
39
        };
50
40
 
51
41
        GOptionContext *option_context =
84
74
                exit (0);
85
75
        }
86
76
 
87
 
        /* g_thread_init is deprecated since version 2.32 and is no longer
88
 
         * necessary. https://developer.gnome.org/glib/2.34/glib-Deprecated-Thread-APIs.html#g-thread-init
89
 
         * For more on GLIB_CHECK_VERSION, see
90
 
         * https://developer.gnome.org/glib/stable/glib-Version-Information.html#GLIB-CHECK-VERSION:CAPS */
91
 
#if ! GLIB_CHECK_VERSION(2,32,0)
92
77
        if (!g_thread_supported ())
93
78
                g_thread_init (NULL);
94
 
#endif
95
79
        gdk_threads_init ();
96
80
        gdk_threads_enter ();
97
81
        gtk_init (&argc, &argv);
101
85
        add_pixmap_directory (PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps");
102
86
 
103
87
 
104
 
        glade_init ();
 
88
        glade_init ();
105
89
 
106
 
        gladexml = glade_xml_new (gladefile, NULL, GETTEXT_PACKAGE);
 
90
        gladexml = glade_xml_new (gladefile, NULL, GETTEXT_PACKAGE);
107
91
 
108
92
        if (!gladexml)
109
93
        {
128
112
                         PACKAGE, PACKAGE);
129
113
        }
130
114
 
131
 
        glade_xml_signal_autoconnect (gladexml);
 
115
        glade_xml_signal_autoconnect (gladexml);
132
116
 
133
117
        pre_init();
134
118
        window1 = glade_xml_get_widget (gladexml, "window1");
140
124
 
141
125
 
142
126
        int screen_height, screen_width;
143
 
        GtkWidget *toolbar;
 
127
        GtkWidget *toolbar;
144
128
 
145
 
        screen_height = gdk_screen_get_height(gdk_screen_get_default());
 
129
        screen_height = gdk_screen_get_height(gdk_screen_get_default());
146
130
        screen_width  = gdk_screen_get_width (gdk_screen_get_default());
147
131
 
148
132
        if (screen_height > screen_width)
207
191
        gtk_widget_show (glade_xml_get_widget (gladexml, "frame15"));
208
192
#else
209
193
        /* It looks like we can't hide widgets attached to a grid,
210
 
           so the next best thing is to just `null them out':
211
 
         */
 
194
           so the next best thing is to just `null them out':
 
195
         */
212
196
        gtk_label_set_label (glade_xml_get_widget (gladexml, "label205"), "");
213
197
        gtk_label_set_label (glade_xml_get_widget (gladexml, "label206"), "");
214
198
        gtk_label_set_label (glade_xml_get_widget (gladexml, "label207"), "");
216
200
 
217
201
        init();
218
202
 
219
 
        if (waypoint_lat && waypoint_lon)
220
 
        {
221
 
                double lat = deg2rad(parse_degrees(waypoint_lat));
222
 
                double lon = deg2rad(parse_degrees(waypoint_lon));
223
 
 
224
 
                set_current_wp(lat, lon);
225
 
        }
226
 
 
227
203
        gtk_main ();
228
204
 
229
205
        gdk_threads_leave ();