Clean up GPS display
[fw/altos] / aoview / aoview_main.c
1 /*
2  * Copyright © 2009 Keith Packard <keithp@keithp.com>
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; version 2 of the License.
7  *
8  * This program is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11  * General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License along
14  * with this program; if not, write to the Free Software Foundation, Inc.,
15  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
16  */
17
18 #include "aoview.h"
19
20 static void usage(void) {
21         printf("aoview [--device|-d device_file]");
22         exit(1);
23 }
24
25 static void destroy_event(GtkWidget *widget, gpointer data)
26 {
27         gtk_main_quit();
28 }
29
30 int main(int argc, char **argv)
31 {
32         GladeXML *xml = NULL;
33         GtkWidget *mainwindow;
34         char *device = NULL;
35
36         static struct option long_options[] = {
37                 { "device", 1, 0, 'd'},
38                 { 0, 0, 0, 0 }
39         };
40         for (;;) {
41                 int c, temp;
42
43                 c = getopt_long_only(argc, argv, "d:", long_options, &temp);
44                 if (c == -1)
45                         break;
46
47                 switch (c) {
48                 case 'd':
49                         device = optarg;
50                         break;
51                 default:
52                         usage();
53                 }
54         }
55
56         gtk_init(&argc, &argv);
57         glade_init();
58
59         xml = glade_xml_new("aoview.glade", NULL, NULL);
60         /* connect the signals in the interface */
61         glade_xml_signal_autoconnect(xml);
62
63         /* Hook up the close button. */
64         mainwindow = glade_xml_get_widget(xml, "aoview");
65         g_signal_connect (G_OBJECT(mainwindow), "destroy",
66             G_CALLBACK(destroy_event), NULL);
67
68         aoview_dev_dialog_init(xml);
69
70         aoview_state_init(xml);
71
72         aoview_log_init(xml);
73
74         aoview_table_init(xml);
75
76         gtk_main();
77
78         return 0;
79 }