gtk_list_store
- From: Russell Shaw <rjshaw netspace net au>
- To: gtk-app-devel-list gnome org
- Subject: gtk_list_store
- Date: Sun, 16 May 2004 16:36:24 +1000
Hi,
I just tried out gtk_list_store. The code below should
display:
Manufacturer Web Notes
------------ --- -----
cyclon www.cyclon.com lead-acid
but i can't get the data (cyclon, www.cyclon.com, lead-acid)
displayed (only gives a blank row with grey background).
enum{NAME,WWW,NOTES};
static void
manuf_cb(GtkWidget *widget)
{
GtkWidget *window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window),"Manufacturers");
g_signal_connect(G_OBJECT(window),"destroy",G_CALLBACK(quit),NULL);
GtkListStore
*store=gtk_list_store_new(3,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING);
GtkTreeIter iter;
gtk_list_store_append(store,&iter);
gtk_list_store_set(store,&iter,
NAME,"cyclon",
WWW,"www.cyclon.com",
NOTES,"lead-acid",
-1);
GtkWidget *tree=gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
renderer=gtk_cell_renderer_text_new();
column=gtk_tree_view_column_new();
gtk_tree_view_column_set_title(column,"Manufacturer");
gtk_tree_view_column_pack_start(column,renderer,FALSE);
gtk_tree_view_append_column(GTK_TREE_VIEW(tree),column);
renderer=gtk_cell_renderer_text_new();
column=gtk_tree_view_column_new();
gtk_tree_view_column_set_title(column,"Web");
gtk_tree_view_column_pack_start(column,renderer,FALSE);
gtk_tree_view_append_column(GTK_TREE_VIEW(tree),column);
renderer=gtk_cell_renderer_text_new();
column=gtk_tree_view_column_new();
gtk_tree_view_column_set_title(column,"Notes");
gtk_tree_view_column_pack_start(column,renderer,FALSE);
gtk_tree_view_append_column(GTK_TREE_VIEW(tree),column);
gtk_container_add(GTK_CONTAINER(window),tree);
gtk_widget_show_all(window);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]