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.
20 static GtkTreeView *dataview;
21 static GtkListStore *datalist;
24 aoview_table_start(void)
26 datalist = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING);
30 aoview_table_add_row(char *label, char *format, ...)
37 vsnprintf(buf, sizeof (buf), format, ap);
39 gtk_list_store_append(datalist, &iter);
40 gtk_list_store_set(datalist, &iter,
47 aoview_table_finish(void)
49 gtk_tree_view_set_model(dataview, GTK_TREE_MODEL(datalist));
50 g_object_unref(G_OBJECT(datalist));
51 gtk_tree_view_columns_autosize(dataview);
55 aoview_table_clear(void)
57 gtk_tree_view_set_model(dataview, NULL);
61 aoview_table_init(GladeXML *xml)
63 dataview = GTK_TREE_VIEW(glade_xml_get_widget(xml, "dataview"));
66 aoview_add_plain_text_column(dataview, "Field", 0, 20);
67 aoview_add_plain_text_column(dataview, "Value", 1, 32);