+static void
+make_destroy(Class *cl)
+{
+ int got_destroy = FALSE;
+ GList *li;
+ Node *node;
+ for(li=cl->nodes;li;li=g_list_next(li)) {
+ Node *n = li->data;
+ if(n->type == METHOD_NODE) {
+ Method *m = (Method *)n;
+ if(m->method == OVERRIDE_METHOD &&
+ strcmp(m->id,"destroy")==0) {
+ if(strcmp(m->otype,"Gtk:Object")==0) {
+ got_destroy = TRUE;
+ break;
+ } else {
+ print_error(FALSE,"destroy method override "
+ "of class other then Gtk:Object",
+ m->line_no);
+ }
+
+ }
+ }
+ }
+ if(!got_destroy) {
+ node = new_method(NO_SCOPE, OVERRIDE_METHOD,
+ (Type *)new_type(0,g_strdup("void"),NULL),
+ g_strdup("Gtk:Object"),
+ NULL,g_strdup("destroy"),
+ make_func_arg("Gtk:Object",FALSE,g_strdup("o")),
+ NULL,
+ g_strdup("PARENT_HANDLER (o);\n"),
+ 0,0,FALSE);
+ cl->nodes = g_list_append(cl->nodes,node);
+ overrides++;
+ }
+}
+
+/* here we will find out how inconsistent gtk really is :) */
+/* the commented out types mean that these types don't actually
+ exist. so we "emulate them" with an equivalent */
+const struct {
+ char *gtkname;
+ char *typename;
+} our_gtk_type_table[] = {
+ { "NONE", "void" },
+ { "CHAR", "gchar" },
+ { "UCHAR", "guchar" },
+ { "BOOL", "gboolean" },
+ { "INT", "gint" },
+ { "UINT", "guint" },
+ { "LONG", "glong" },
+ { "ULONG", "gulong" },
+ { "FLOAT", "gfloat" },
+ { "DOUBLE", "gdouble" },
+ { "STRING", /*"GtkString"*/"gchar *" },
+ { "ENUM", /*"GtkEnum"*/"gint" },
+ { "FLAGS", /*"GtkFlags"*/"guint" },
+ { "BOXED", /*"GtkBoxed"*/"gpointer" },
+ { "POINTER", "gpointer" },
+ { "OBJECT", "GtkObject *" },
+ { "SIGNAL", /*"GtkSignal"*/"__twopointertype" },
+ { "ARGS", /*"GtkArgs"*/"__twopointertype" },
+ { "CALLBACK", /*"GtkCallback"*/"__threepointertype" },
+ { "C_CALLBACK", /*"GtkCCallback"*/"__twopointertype" },
+ { "FOREIGN", /*"GtkForeign"*/"__twopointertype" },
+
+ { NULL, NULL }
+};
+
+static const char *
+get_cast(char *type)
+{
+ int i;
+ for(i=0;our_gtk_type_table[i].gtkname;i++) {
+ if(strcmp(our_gtk_type_table[i].gtkname,type)==0) {
+ return our_gtk_type_table[i].typename;
+ }
+ }
+ return NULL;
+}
+
+
+/* hash of method -> name of signal prototype */