Re: Steps to get to GTK+ 3.0



On Wed, 2008-06-04 at 21:50 +0300, Stefan Kost wrote:
> Felipe Contreras schrieb:
> > So how should people create extra functionality? For example, I
> > extended GHashTable creating a g_hash_table_peek_first function, for
> > which I needed the private fields.

No you don't.

gboolean
true_predicate(void)
{ return TRUE; }

first = g_hash_table_find(hash_table, true_predicate, NULL);


If you needed any private access, it means the GHashTable API is
incomplete.  You should file a bug about it at that point.

You are *not* supposed to be able to arbitrarily expand glib data
structures.

>  So I had to create fake structures
> > with the same fields just to access them. I know that's dirty, but it
> > works, and creating my own hash table just to add that function wasn't
> > appealing.
> > 
> > What about publicly stating that including foo_private.h is looking
> > for trouble, and perhaps foo_protected.h for objects that inherit.
> > 
> > I'm just dumping ideas, I don't know what's the proper solution, but
> I
> > definitely see obstacles to re-use current objects/widgets.
> > 
> > Best regards.
> > 
> 
> The proper solution in the above case is to submit a patch that adds 
> g_hash_table_peek_first to the GHashtable :)

And the bug will be closed WONTFIX as that's not a generally
accepted/useful operation for a hash table.  And it can already be
implemented efficiently using current API.


> Stefan
-- 
behdad
http://behdad.org/

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759



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