/* Returns a list of localisedNode elements containing all the information stored in a localised treeview. */
GSList *
obtain_list_from_localised_treemodel (GtkTreeModel *model)
{
GtkTreeIter iter;
gboolean valid;
localisedNode *localisedRow;
GSList *list = NULL;
/* Obtain the first row iter to scan the treemodel and extract the information row by row. */
valid = gtk_tree_model_get_iter_first (model, &iter);
while (valid)
{
/* Allocate node memory */
localisedRow = g_new (localisedNode, 1);
/* Extract the information of the current row */
gtk_tree_model_get (model, &iter,
COL_LANG, &(localisedRow->language),
COL_TEXT, &(localisedRow->text),
-1);
/* Insert the node */
list = g_slist_append (list, localisedRow);
/* Obtain the next row iter (if it exists) */
valid = gtk_tree_model_iter_next (model, &iter);
}
return list;
}