Re: foreach functions

        Hmmm, If I were to make a sugestion, 
I would leave *foreach* the way it is so as 
not to break aplications that use this api
already and add a function *find_custom*
similar to the GList api. 
        This would be consistent with
the iteration api for G[S]Lists.

although this doesn't consern me at all
and I havent even used the treeselection;
thats my 2 cents.


Harring Figueiredo wrote:


 This is a suggestion -- and I am not sure where to sent it to, so I am posting

 I could not find a way to break out of the
gtk_tree_selection_selected_foreach function -- It means that I will have to
loop through the whole thing even if I am looking for only one thing (Like a
particular selected row, and that selected row is the first row, I still have
to loop through all the others needlessly.)

 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.

 Is that possible to change this behavior in upcoming release of GTK.


void        gtk_tree_selection_selected_foreach
                     (GtkTreeSelection *selection,
                      GtkTreeSelectionForeachFunc func,
                      gpointer data);

 Change this to:

gboolean        (*GtkTreeSelectionForeachFunc)  (GtkTreeModel *model,
^^^^^^^^               GtkTreePath *path,
                       GtkTreeIter *iter,
                       gpointer data);

 If it returns FALSE, the foreach function would "give up" the iteration, else
it would continue.

  This is probably true for every "foreach" function that is on glib/gtk -- It
is really a pain to go through the loop just to find out that you have
something selected on the tree.

   *SIGH* I am now ready to take flames...


Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org

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