RE: How to remove all the selectd row in Treeview?
- From: <martyn 2 russell bt com>
- To: <tom liu flextrade com>, <gtk-app-devel-list gnome org>
- Subject: RE: How to remove all the selectd row in Treeview?
- Date: Thu, 30 Oct 2003 16:32:52 -0000
Document said that you can't make changes in this foreach.
So it does :) sorry.
I suppose you could use:
GtkTreeModel *model = NULL;
GtkTreeStore *store = NULL;
GtkTreeSelection *selection = NULL;
gboolean valid = FALSE;
model = gtk_tree_view_get_model(view);
store = GTK_TREE_STORE(gtk_tree_view_get_model(view));
selection = gtk_tree_view_get_selection(view);
valid = gtk_tree_model_get_iter_first(model, &iter);
for(;valid;valid = gtk_tree_model_iter_next(model, &iter))
{
gchar *text = NULL;
gchar *lc_text = NULL;
gboolean iter_still_valid = TRUE;
while(iter_still_valid && gtk_tree_selection_iter_selected(selection, &iter))
{
iter_still_valid = gtk_tree_store_remove(store, &iter);
}
}
Note: When gtk_tree_store_remove() returns, &iter points to the next iter on the list. The while loop
should then check it is still selected and again try to remove. This should continue until an iter is not
selected OR the end.
Also - this is crude and could probably be done a bit better.
Regards,
Martyn
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]