Re: Default settings for GtkTextAttributes



Brian Cameron <Brian Cameron Sun COM> writes:

> Havoc & Others:
> 
> I didn't get a response to this email that I sent yesterday and since
> the gtk freeze is coming up soon I wanted to hopefully come to a concensus
> on what to do.
> 
> Another option that I didn't mention in my previous email would be to
> make the following gtktextiter.c functions public
> 
> _gtk_text_btree_get_tags
> _gtk_text_tag_array_sort
> 
> It seems that it would be dangerous for us to rewrite these in ATK.  Then
> if the code in GTK changes it is necessary for us to keep ATK in sync.  It
> seems like an area that would become error prone.

There is an equivalent public function gtk_text_iter_get_tags(), 
and the sort function is completely trivial:

 int
 tag_sort_func (gconstpointer a, gconstpointer b)
 {
   const GtkTextTag *taga = a;
   const GtkTextTag *tagb = b;

   return taga->priority < tagb->priority ? -1 : 
            (taga->priority == tagb->priority ? 0 : 1)
 } 

 tags = g_slist_sort (tags, tag_sort_func);

I don't see making a public version of this function, since it is
is simply a convenience function - there is no content to it
other than 'sort the list of tags numerically by tag->priority'. 
 
> I think my earlier suggestion of just calling gtk_text_iter_get_attributes
> with a callback function is a more clean solution...

This struck me as being not generally useful and a bit clunky.
Also, gtk_text_iter_get_attributes() is speed critical code.

Regards,
                                        Owen




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