1 <!-- ##### SECTION Title ##### -->
4 <!-- ##### SECTION Short_Description ##### -->
5 A list-like data structure that can be used with the #GtkTreeView
7 <!-- ##### SECTION Long_Description ##### -->
9 The #GtkListStore object is a list model for use with a #GtkTreeView
10 widget. It implements the #GtkTreeModel interface, and consequentialy,
11 can use all of the methods available there. It also implements the
12 #GtkTreeSortable interface so it can be sorted by the view.
13 Finally, it also implements the tree <link linkend="gtktreednd">drag and
14 drop</link> interfaces.
18 The #GtkListStore can accept most GObject types as a column type, though
19 it can't accept all custom types. Internally, it will keep a copy of
20 data passed in (such as a string or a boxed pointer). Columns that
21 accept #GObject<!-- -->s are handled a little differently. The
22 #GtkListStore will keep a reference to the object instead of copying the
23 value. As a result, if the object is modified, it is up to the
24 application writer to call @gtk_tree_model_row_changed to emit the
25 "row_changed" signal. This most commonly affects lists with
26 #GdkPixbuf<!-- -->s stored.
30 <title>Creating a simple list store.</title>
40 GtkListStore *list_store;
45 list_store = gtk_list_store_new (N_COLUMNS,
50 for (i = 0; i < 10; i++)
54 some_data = get_some_data (i);
56 /* Add a new row to the model */
57 gtk_list_store_append (list_store, &iter);
58 gtk_list_store_set (list_store, &iter,
59 COLUMN_STRING, some_data,
61 COLUMN_BOOLEAN, FALSE,
64 /* As the store will keep a copy of the string internally, we
70 /* Modify a particular row */
71 path = gtk_tree_path_new_from_string ("4");
72 gtk_tree_model_get_iter (GTK_TREE_MODEL (list_store),
75 gtk_tree_path_free (path);
76 gtk_list_store_set (list_store, &iter,
84 <title>Performance Considerations</title>
86 Internally, the #GtkListStore was implemented with a linked list with a
87 tail pointer prior to GTK+ 2.6. As a result, it was fast at data
88 insertion and deletion, and not fast at random data access. The
89 #GtkListStore sets the #GTK_TREE_MODEL_ITERS_PERSIST flag, which means
90 that #GtkTreeIter<!-- -->s can be cached while the row exists. Thus, if
91 access to a particular row is needed often and your code is expected to
92 run on older versions of GTK+, it is worth keeping the iter around.
96 <!-- ##### SECTION See_Also ##### -->
98 #GtkTreeModel, #GtkTreeStore
101 <!-- ##### SECTION Stability_Level ##### -->
104 <!-- ##### STRUCT GtkListStore ##### -->
110 <!-- ##### FUNCTION gtk_list_store_new ##### -->
120 <!-- ##### FUNCTION gtk_list_store_newv ##### -->
130 <!-- ##### FUNCTION gtk_list_store_set_column_types ##### -->
140 <!-- ##### FUNCTION gtk_list_store_set ##### -->
150 <!-- ##### FUNCTION gtk_list_store_set_valist ##### -->
160 <!-- ##### FUNCTION gtk_list_store_set_value ##### -->
171 <!-- ##### FUNCTION gtk_list_store_remove ##### -->
179 <!-- # Unused Parameters # -->
183 <!-- ##### FUNCTION gtk_list_store_insert ##### -->
191 <!-- # Unused Parameters # -->
195 <!-- ##### FUNCTION gtk_list_store_insert_before ##### -->
203 <!-- # Unused Parameters # -->
207 <!-- ##### FUNCTION gtk_list_store_insert_after ##### -->
215 <!-- # Unused Parameters # -->
219 <!-- ##### FUNCTION gtk_list_store_insert_with_values ##### -->
230 <!-- ##### FUNCTION gtk_list_store_insert_with_valuesv ##### -->
243 <!-- ##### FUNCTION gtk_list_store_prepend ##### -->
250 <!-- # Unused Parameters # -->
254 <!-- ##### FUNCTION gtk_list_store_append ##### -->
261 <!-- # Unused Parameters # -->
265 <!-- ##### FUNCTION gtk_list_store_clear ##### -->
273 <!-- ##### FUNCTION gtk_list_store_iter_is_valid ##### -->
283 <!-- ##### FUNCTION gtk_list_store_reorder ##### -->
292 <!-- ##### FUNCTION gtk_list_store_swap ##### -->
302 <!-- ##### FUNCTION gtk_list_store_move_before ##### -->
312 <!-- ##### FUNCTION gtk_list_store_move_after ##### -->