On Fri, Dec 06, 2002 at 08:27:56AM -0800, Harring Figueiredo wrote: > I could not find a way to break out of the > gtk_tree_selection_selected_foreach function [...] > > It turns out that I also implemnted some of my programs with > the "foreach" design pattern (i.e. callback), but I chenged > the signature of my callback function to return a boolean. > > If the callback returns TRUE, it means the "foreach" should > continue, else, the foreach breaks out. A nicer and cleaner solution could be based on the GIterator patch to GLib: http://bugzilla.gnome.org/show_bug.cgi?id=83729 This way you will be able to iterate through selected items by using a simple while() loop, and get rid of the (orrible) foreach() callback pattern. Furthermore, you will ensure binary compatibility with other Gtk+ applications (since you won't modify any function signature). Regards, alceste, who keeps promoting the GIterator adoption inside GLib :-) -- This .signature is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. ___________________________________ ______________________________________) PGP information in e-mail header |
Attachment:
pgpcTCRW8KeTV.pgp
Description: PGP signature