foreach functions




 Guys, 

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

 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.

 i.e: 

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...

Harring.



__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com



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