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.
22 static GtkTreeView *dataview[NCOL];
23 static GtkListStore *datalist[NCOL];
26 aoview_table_start(void)
29 for (col = 0; col < NCOL; col++)
30 datalist[col] = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING);
34 aoview_table_add_row(int col, char *label, char *format, ...)
41 vsnprintf(buf, sizeof (buf), format, ap);
43 gtk_list_store_append(datalist[col], &iter);
44 gtk_list_store_set(datalist[col], &iter,
51 aoview_table_finish(void)
54 for (col = 0; col < NCOL; col++) {
55 gtk_tree_view_set_model(dataview[col], GTK_TREE_MODEL(datalist[col]));
56 g_object_unref(G_OBJECT(datalist[col]));
57 gtk_tree_view_columns_autosize(dataview[col]);
62 aoview_table_clear(void)
65 for (col = 0; col < NCOL; col++)
66 gtk_tree_view_set_model(dataview[col], NULL);
70 aoview_table_init(GladeXML *xml)
74 for (col = 0; col < NCOL; col++) {
76 sprintf(name, "dataview_%d", col);
77 dataview[col] = GTK_TREE_VIEW(glade_xml_get_widget(xml, name));
78 assert(dataview[col]);
80 aoview_add_plain_text_column(dataview[col], "Field", 0, 20);
81 aoview_add_plain_text_column(dataview[col], "Value", 1, 32);