From: Owen Taylor (otaylor@redhat.com)
Date: Fri Jul 06 2001 - 16:44:37 EDT
Archit Baweja <bighead@crosswinds.net> writes:
> Hi
>
> Before I start making changes to gtk<widget>.xml files I'd like to discuss
> something first.
>
> Currently, the gtk<widget>.xml files describe a <GetTypeFunction> tag
> for the (obviously enough) _get_type function. I think that it is a waste to do
> so. For just one thing. It doesn't serve any purpose. If we can get the same
> thing from something already there, I think it is better option.
>
> In the <Name> we give the widget name, we can make a _get_type from that.
> But as I've disscussed befor with chema, if we use only Capitals to locate
> where to put "_", it gives us problems in some situations.
> like for GtkButton we get gtk_button_get_type (we use the capital B,to identify
> place to insert the "_"). But for GtkHBox if we use the same technique, we
> get gtk_h_box_get_type, which is not so. So I once again recommend use of gob
> style naming. so GtkButton -> Gtk:Button. That way getting string-ified version
> of the _get_type function can be obtained accurately and reduce bloat of xml
> files.
There is "standard" method in GTK+ for converting from StudlyCaps to
lowercase_words.
Which is encapsulated by the following Perl code:
my $lowername = $capsname;
$lowername =~ s/([^A-Z])([A-Z])/$1_$2/g;
$lowername =~ s/([A-Z][A-Z])([A-Z][0-9a-z])/$1_$2/g;
$lowername = lc($lowername);
So:
GtkHBox => gtk_hbox
But:
GtkIMContext => gtk_im_context
GdkRGB => gdk_rgb
(GtkRBTree violates this rule, but it is private internal to GTK+)
Also, using single ':' as a separator is just evil - either use '.' or '::'.
Regards,
Owen
_______________________________________________
Glade-devel maillist - Glade-devel@ximian.com
http://lists.ximian.com/mailman/listinfo/glade-devel
This archive was generated by hypermail 2b29 : Fri Jul 06 2001 - 20:54:10 EDT