newer INSTALL file pulled in by autogen.sh
[fw/altos] / aoview / aoview_log.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 struct aoview_file       *aoview_log;
21
22 void
23 aoview_log_new(void)
24 {
25         aoview_file_finish(aoview_log);
26         aoview_state_new();
27 }
28
29 void
30 aoview_log_set_serial(int serial)
31 {
32         aoview_file_set_serial(aoview_log, serial);
33 }
34
35 int
36 aoview_log_get_serial(void)
37 {
38         return aoview_file_get_serial(aoview_log);
39 }
40
41 void
42 aoview_log_printf(char *format, ...)
43 {
44         va_list ap;
45
46         va_start(ap, format);
47         aoview_file_vprintf(aoview_log, format, ap);
48         va_end(ap);
49 }
50
51 static void
52 aoview_log_new_item(GtkWidget *widget, gpointer data)
53 {
54         aoview_file_finish(aoview_log);
55 }
56
57 void
58 aoview_log_init(GladeXML *xml)
59 {
60         GtkWidget       *log_new;
61
62         aoview_log = aoview_file_new("telem");
63         assert(aoview_log);
64
65         log_new = glade_xml_get_widget(xml, "log_new");
66         assert(log_new);
67         g_signal_connect(G_OBJECT(log_new), "activate",
68                          G_CALLBACK(aoview_log_new_item),
69                          NULL);
70 }