Re: How do you get the data from a GList?
- From: "Matías Torres" <torresmat gmail com>
- To: "Steven Boyls" <sboyls tuckerenergy com>
- Cc: GTK App-Dev <gtk-app-devel-list gnome org>
- Subject: Re: How do you get the data from a GList?
- Date: Fri, 17 Nov 2006 13:09:19 -0300
you can iterate through the list:
node = mylist;
while (next)
{
gtk_tree_model_get_iter (treemodel, &iter, GTK_TREE_PATH (node->data));
/* Gets data in column COLUMN (zero based) and copies (depending the
type) it into data*/
gtk_tree_model_get (model, &iter, COLUMN, &data, -1);
next = g_slist_next (node);
}
Be aware that if you modify the model you may end up with a non-valid list
of paths. If you do so, convert the path's list into a list of
GtkTreeRowReferences.
Check this:
gtk_tree_selection_get_selected_rows
()<http://developer.gnome.org/doc/API/2.0/gtk/GtkTreeModel.html#gtk-tree-row-reference-new>
Single Linked
List<http://developer.gnome.org/doc/API/2.0/glib/glib-Singly-Linked-Lists.html>(g_slist_nth_data
, g_slist_foreach)
2006/11/17, Steven Boyls <sboyls tuckerenergy com>:
I have created a GList with the following code :
GList *my_list;
GtkTreeSelection *selection;
GtkTreeModel *model;
selection = gtk_tree_view_get_selection(list_file_treeview);
model = gtk_tree_view_get_model(list_file_treeview);
my_list = gtk_tree_selection_get_selected_rows(selection, &model);
The list contains rows of data that were in my GtkTreeView. The treeview
has several rows
and columns. I want to iterate through my_list and work on the data. So
what do I
need to do to get to the data. Example, say one of the rows in my tree
had several columns
of names. How do I access the name in the third column in row two.
Thanks in advance for your help.
Steve
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]