Index: vala/valainterfacewriter.vala =================================================================== --- vala/valainterfacewriter.vala (revision 602) +++ vala/valainterfacewriter.vala (working copy) @@ -123,6 +123,10 @@ } } + if (cl.get_cname () != cl.get_default_cname ()) { + write_string ("cname = \"%s\", ".printf (cl.get_cname ())); + } + write_string ("cheader_filename = \"%s\")]".printf (cheaders)); write_newline (); Index: vala/valaclass.vala =================================================================== --- vala/valaclass.vala (revision 602) +++ vala/valaclass.vala (working copy) @@ -346,7 +346,21 @@ } return cname; } - + + /** + * Returns the default interface name of this class as it is used in C + * code. + * + * @return the name to be used in C code by default + */ + public virtual string! get_default_cname () { + if (name.has_prefix ("_")) { + return "_%s%s".printf (parent_symbol.get_cprefix (), name.offset (1)); + } else { + return "%s%s".printf (parent_symbol.get_cprefix (), name); + } + } + /** * Sets the name of this class as it is used in C code. *