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.
23 static GtkTreeView *dataview[NCOL];
24 static GtkListStore *datalist[NCOL];
27 aoview_table_start(void)
30 for (col = 0; col < NCOL; col++)
31 datalist[col] = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING);
35 aoview_table_add_row(int col, char *label, char *format, ...)
42 vsnprintf(buf, sizeof (buf), format, ap);
44 gtk_list_store_append(datalist[col], &iter);
45 gtk_list_store_set(datalist[col], &iter,
52 aoview_table_finish(void)
55 for (col = 0; col < NCOL; col++) {
56 gtk_tree_view_set_model(dataview[col], GTK_TREE_MODEL(datalist[col]));
57 g_object_unref(G_OBJECT(datalist[col]));
58 gtk_tree_view_columns_autosize(dataview[col]);
63 aoview_table_clear(void)
66 for (col = 0; col < NCOL; col++)
67 gtk_tree_view_set_model(dataview[col], NULL);
71 aoview_table_init(GladeXML *xml)
75 for (col = 0; col < NCOL; col++) {
77 sprintf(name, "dataview_%d", col);
78 dataview[col] = GTK_TREE_VIEW(glade_xml_get_widget(xml, name));
79 assert(dataview[col]);
81 aoview_add_plain_text_column(dataview[col], "Field", 0, 20);
82 aoview_add_plain_text_column(dataview[col], "Value", 1, 32);