2 * Copyright © 2009 Keith Packard <keithp@keithp.com>
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 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
26 { "height_label", "Height (m)", NULL },
27 { "state_label", "State", NULL },
28 { "rssi_label", "RSSI (dBm)", NULL },
29 { "speed_label", "Speed (m/s)", NULL },
30 { "height_value", "0", NULL },
31 { "state_value", "pad", NULL },
32 { "rssi_value", "-50", NULL },
33 { "speed_value", "0", NULL },
37 aoview_label_assign(GtkLabel *widget, char *value)
41 markup = g_markup_printf_escaped("<span font_weight=\"bold\" size=\"xx-large\">%s</span>", value);
42 gtk_label_set_markup(widget, markup);
47 aoview_label_show(struct aostate *state)
50 sprintf(line, "%d", state->height);
51 aoview_label_assign(label_widgets[4].widget, line);
53 aoview_label_assign(label_widgets[5].widget, state->data.state);
55 sprintf(line, "%d", state->data.rssi);
56 aoview_label_assign(label_widgets[6].widget, line);
59 sprintf(line, "%6.0f", fabs(state->speed));
61 sprintf(line, "%6.0f", fabs(state->baro_speed));
62 aoview_label_assign(label_widgets[7].widget, line);
66 aoview_label_init(GladeXML *xml)
69 for (i = 0; i < sizeof(label_widgets)/sizeof(label_widgets[0]); i++) {
70 label_widgets[i].widget = GTK_LABEL(glade_xml_get_widget(xml, label_widgets[i].name));
71 aoview_label_assign(label_widgets[i].widget, label_widgets[i].initial_value);
72 assert(label_widgets[i].widget);