Re: [gtk-list] Re: Gtk-Perl & GnomeStock
- From: Dermot Musgrove <dermot glade perl connectfree co uk>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: Gtk-Perl & GnomeStock
- Date: Thu, 30 Sep 1999 02:16:40 +0000
Owen Taylor wrote:
> Dermot Musgrove <email@example.com> writes:
> > Unlike Gtk, the string literals seem to bear no regular relationship to
> > the constant names, it looks like the enums were each coded to a
> > different standard - and who thought of "Button_Ok" with a little K?
> > I ahve asked Lupus for a module that would provide all the enums but
> > he said it would be difficult/unnecessary to generate from the header
> > files in the same way that Keysyms are.
> For enumerations, there is a precisely defined standard way to
> get the 'nicknames' for the header files for GTK+.
> The algorithm is:
> take all the enumeration values,
> remove any prefix common to all values
> lower-case the result, replacing _ with -.
I have now read your email more carefully and looked at .h files but as I
was originally trying to say, Gtk is predictable and understandable but
Gnome seems to work to some other standard(s).
AFAIK, using the Perl/Gtk bindings, we have to use the 'nicknames' and I
made the silly assumption that Gnome enums could be converted using the
same logic as Gtk enums (which was obvious even to me).
However, what is the logic that converts:
'GNOME_STOCK_BUTTON_OK' => "Button_Ok",
'GNOME_STOCK_MENU_SAVE_AS' => "Save As",
and even worse
'GNOME_STOCK_MENU_MAIL_NEW' => "New Mail",
'GNOME_STOCK_PIXMAP_SRCHRPL' => "Search/Replace",
A lookup is the only way that I can see to convert many of the GNOME_ enums
to values that Perl/Gtk (and Gnome) can handle. If I am wrong, and I would
like to be, please tell me so that I don't have to hard code the lookups
into my code (several Kb and a PITA to check and maintain) :-)
] [Thread Prev