RE:Re: Please, help-me, show itens selected in tree_view



path = GTK_TREE_PATH (l->data); ????????????????

GTK_TREE_PATH exist ?






Jean Br�rt wrote:

Le mer 16/06/2004 �5:40, Ranieri a �it :
This code was not correct.
The error message is:

test.c: In function `main':
test.c:55: `CList' undeclared (first use in this function)

I apologize, I mistyped, it's GList, not CList

test.c:55: (Each undeclared identifier is reported only once
test.c:55: for each function it appears in.)
test.c:55: `l' undeclared (first use in this function)
test.c:55: warning: passing arg 1 of
`gtk_tree_selection_get_selected_rows'
from                                              incompatible pointer type
test.c:55: too few arguments to function
`gtk_tree_selection_get_selected_rows'

I wrote the code much too quickly and did not test it :-(

line 55 should be:
GList *l = gtk_tree_selection_get_selected_rows (selection, model2);

test.c:57: redeclaration of `iter'
test.c:13: `iter' previously declared here

I did not notice that iter already existed. Remove this line (57).

test.c:61: warning: assignment makes pointer from integer without a cast

This is due to line 55. You should not get it anymore.

test.c:68: warning: passing arg 2 of `g_list_foreach' from incompatible
pointer type

add (GFunc*) before gtk_tree_path_free

The GTK_TREE_MODEL and gtk_model_get exist ?

it is gtk_tree_model_get. (GTK_TREE_MODEL exists).

Jean Br�rt wrote:

Oops, my code was not correct, the list was not freed :-(
Here is a new (and hopefully better) version:

GtkTreeModel *model2 = GTK_TREE_MODEL (model);
CList *l = gtk_tree_selection_get_selected_rows (tree_view);
GtkTreePath *path;
GtkTreeIter iter;
char *str;
GList *list = l;
while (l) {
	path = GTK_TREE_PATH (l->data);
	gtk_tree_model_get_iter (model2, &iter, path);
	gtk_model_get (model, &iter, 0, &str, -1);
	g_print (str);
	g_free (str);
	l = l->next;
}
g_list_foreach (list, gtk_tree_path_free, NULL);
g_list_free (list);







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]