Re: GtkBuildable type resolver



On Tue, 05 Jun 2007 11:23:36 -0400 Owen Taylor wrote:

>Actually, GtkIMContext fits the standard naming rules we have for
>mixed-case names:
>
>They are something like:
>
> NAME := INITIAL_WORD WORD+
> INITIAL_WORD := [A-Z][a-z0-9]*
> WORD := [A_Z]{2,} | [A-Z][a-z0-9]+
>
>So:
>
> GString => g_string
> GtkCTree => gtk_ctree
> GtkIMContext => gtk_im_context
> GdkRGB => gtk_rgb

On a possibly-related note, glib-mkenums doesn't work properly with this
scheme.  It always treats consecutive capitals as separate 'words' in
the enum names.

My application is called 'Airconfig', and I use the 'ac_' prefix for
function names.  GObject names look like 'ACPreferredNetwork'.  But, if
I call an enum 'ACSecurityType', this happens:

$ cat test.h
typedef enum
{
    AC_SECURITY_TYPE_FOO
} ACSecurityType;

$ glib-mkenums --eprod '@EnumName \n@enum_name \n@ENUMNAME \n' test.h

/* Generated data (by glib-mkenums) */

ACSecurityType
a_csecurity_type
A_CSECURITY_TYPE

/* Generated data ends here */

Obviously, what I want here is ac_security_type and AC_SECURITY_TYPE.
As a workaround, I use a different convention for enums, e.g.,
'AcSecurityType', but it would be nice not to have to do this.

Is this a bug (and should I file a bug report), or is this intended (or
unavoidable) behavior?

	-brian




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