gtdc/variable_tab.c

55 lines
1.8 KiB
C
Raw Normal View History

2008-03-15 23:18:09 +01:00
#include <gtk/gtk.h>
enum {
COL_GRAPH = 0,
COL_VALUE,
COL_TYPE,
COL_NAME,
};
gint variable_tab_init(GtkNotebook *notebook)
{
/* graph, value, type, name */
GtkListStore *list_store = gtk_list_store_new(1,
G_TYPE_BOOLEAN, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING);
GtkWidget *view = gtk_tree_view_new();
gtk_tree_view_set_model(GTK_TREE_VIEW(view), GTK_TREE_MODEL(list_store));
g_object_unref(list_store);
GtkTreeViewColumn *col;
GtkCellRenderer *renderer;
col = gtk_tree_view_column_new();
gtk_tree_view_column_set_title(col, "Graph");
gtk_tree_view_append_column(GTK_TREE_VIEW(view), col);
renderer = gtk_cell_renderer_toggle_new();
gtk_tree_view_column_pack_start(col, renderer, TRUE);
gtk_tree_view_column_add_attribute(col, renderer, "active", COL_GRAPH);
col = gtk_tree_view_column_new();
gtk_tree_view_column_set_title(col, "Value");
gtk_tree_view_append_column(GTK_TREE_VIEW(view), col);
renderer = gtk_cell_renderer_text_new();
gtk_tree_view_column_pack_start(col, renderer, TRUE);
gtk_tree_view_column_add_attribute(col, renderer, "text", COL_VALUE);
col = gtk_tree_view_column_new();
gtk_tree_view_column_set_title(col, "Type");
gtk_tree_view_append_column(GTK_TREE_VIEW(view), col);
renderer = gtk_cell_renderer_text_new();
gtk_tree_view_column_pack_start(col, renderer, TRUE);
gtk_tree_view_column_add_attribute(col, renderer, "text", COL_TYPE);
col = gtk_tree_view_column_new();
gtk_tree_view_column_set_title(col, "Name");
gtk_tree_view_append_column(GTK_TREE_VIEW(view), col);
renderer = gtk_cell_renderer_text_new();
gtk_tree_view_column_pack_start(col, renderer, TRUE);
gtk_tree_view_column_add_attribute(col, renderer, "text", COL_NAME);
GtkWidget *label = gtk_label_new(" Variables ");
return gtk_notebook_append_page(GTK_NOTEBOOK(notebook), view, label);
}