Re: Removing/Reordering Multiple Selections in GtkTreeModel



So, uh, did you take a look at the link? I eventually figured out that
gtk_tree_selection_get_selected_rows() was the key and got it all
working. I was posting so that if people search the mailing list, they
can find an explanation of how I did it. But thanks for verifying that I
was on the right track.

Yes, deleting backwards works in a GtkListStore (and I think there
should be some simpler API to allow this--one without tons of lists,
like maybe a gtk_selection_foreach_reverse), but for GtkTreeStores, I'm
guessing that's not really possible.

On Wed, 2003-07-30 at 10:25, David M. Cook wrote:
On Wed, Jul 30, 2003 at 12:51:29AM -0700, Jared Krinke wrote:

I just recently had quite a bit of trouble figuring out how to remove
all of the selected rows from a gtk_list_store. As near as I can tell,
there is no simple way to do this and using
gtk_tree_selection_get_selected_rows() is necessary.

In Python, I just make sure I delete the rows in reverse order.  

The API doc for gtk_tree_selection_get_selected_rows nots that...

"Additionally, if you are planning on modifying the model after calling this
function, you may want to convert the returned list into a list of
GtkTreeRowReferences. To do this, you can use
gtk_tree_row_reference_new_proxy()." 

Once you have the list of row references you can iterate thru it and get the
correct paths from the references even though you've deleted intermediate
rows.  At least that's the way I understand it. However, I have no idea
where this proxy GObject that gtk_tree_row_reference_new_proxy() takes as
it's first argument is supposed to come from.

Dave Cook
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




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