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; version 2 of the License.
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.
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.
25 { "height_label", "Height (m)", NULL },
26 { "state_label", "State", NULL },
27 { "rssi_label", "RSSI (dBm)", NULL },
28 { "speed_label", "Speed (m/s)", NULL },
29 { "height_value", "0", NULL },
30 { "state_value", "pad", NULL },
31 { "rssi_value", "-50", NULL },
32 { "speed_value", "0", NULL },
36 aoview_label_assign(GtkLabel *widget, char *value)
40 markup = g_markup_printf_escaped("<span font_weight=\"bold\" size=\"xx-large\">%s</span>", value);
41 gtk_label_set_markup(widget, markup);
46 aoview_label_show(struct aostate *state)
49 sprintf(line, "%d", state->height);
50 aoview_label_assign(label_widgets[4].widget, line);
52 aoview_label_assign(label_widgets[5].widget, state->data.state);
54 sprintf(line, "%d", state->data.rssi);
55 aoview_label_assign(label_widgets[6].widget, line);
58 sprintf(line, "%6.0f", fabs(state->speed));
60 sprintf(line, "%6.0f", fabs(state->baro_speed));
61 aoview_label_assign(label_widgets[7].widget, line);
65 aoview_label_init(GladeXML *xml)
68 for (i = 0; i < sizeof(label_widgets)/sizeof(label_widgets[0]); i++) {
69 label_widgets[i].widget = GTK_LABEL(glade_xml_get_widget(xml, label_widgets[i].name));
70 aoview_label_assign(label_widgets[i].widget, label_widgets[i].initial_value);
71 assert(label_widgets[i].widget);