Re: gtkstock fixes and other comments



Paolo Molaro <lupus lettere unipd it> writes: 
> The default value for the flag 'need_free'  could be 0 and gtk_stock_add
> will enforce it to TRUE.
> 

One problem with this, and also with doing the dgettext() call in
advance, is that the static GtkStockItem could be in read-only memory.

But the more important point is that the fields in GtkStockItem define
an interface. Interfaces should not contain implementation details.
 
> That's fine, but why have a class for it when it could be a simple hash
> table in the style?

Why have classes ever, when you can just have a bunch of structs
containing data?

Classes define the interface to something. In this case, if you just
had GHashTable then gtk_icon_factory_add_default() would take a
mysterious GHashTable argument for example, that wouldn't be a very
easy interface to figure out.

Or we might want to change the implementation to not use a hash, or
to use two hashes, or who knows what, in the future.

> And if you want to change the icon from a style,
> why not the label and the keyval as well? 

Themes aren't the place to do this. They are right now defined to be
purely cosmetic in nature, and never affect application functionality.

> Right now stock keyboard
> accelerators can't be changed, it seems, and it would be nice to
> be able to set them in the style.

When we have a system for customizing accelerators at all, it works
with the stock accelerators. e.g. GtkItemFactory's change-in-place
feature.

Granted it won't change the stock accelerators for all apps at once,
but I don't think doing that in the theme is the right solution.

We should address this problem when we fix the menu/toolbar API,
rather than adding some cheesy hack in the short term as with
GnomeUIInfo.
 
> Yep, but if the stock id is the same, why not store all the info
> associated with that stock id in the same hash table?
> 

Because we are treating these two aspects of a stock ID separately; 
icons can be per-style and are customized via themes, labels and
accelerators can't be per-style and should be customized another
way. Also, it's totally reasonable for apps to want to register stock
icons without using the stock label/accelerator stuff.

Havoc
 




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