Problem deleting multiple rows from a Tree
- From: "Daniel K. O." <danielosmari yahoo com br>
- To: "gtk-app-devel-list gnome org" <gtk-app-devel-list gnome org>
- Subject: Problem deleting multiple rows from a Tree
- Date: Thu, 19 Jun 2003 00:58:09 -0300
Hello.
I'm having a little problem deleting selected rows form a GtkTreeView.
I have a list (tree). Connected with the signal "key-press-event" is the
function remove_items:
---
int remove_items(GtkWidget *widget, GdkEventKey *event)
{
GtkTreeSelection *sel;
GList *list;
if (event->keyval==GDK_Delete) {
sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree));
list = gtk_tree_selection_get_selected_rows(sel, NULL);
g_list_foreach(list, (GFunc)apaga_item, NULL);
g_list_foreach(list, (GFunc)gtk_tree_path_free, NULL);
g_list_free (list);
}
return 0;
}
---
And there's also a function apaga_item, that is called:
---
void apaga_item(GtkTreePath *path)
{
GtkTreeIter iter;
if (gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter, path))
gtk_list_store_remove(store, &iter);
}
---
So, this is my problem: when there are many rows selected, it doesn't
remove all of them, or even worse: delete rows there were not selected.
What is the right way to remove all the selected rows?
Daniel K. O.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]