+static void
+make_finalize(Class *cl)
+{
+ int got_finalize = 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,"finalize")==0) {
+ if(strcmp(m->otype,"Gtk:Object")==0) {
+ got_finalize = TRUE;
+ break;
+ } else {
+ print_error(FALSE,"finalize method override "
+ "of class other then Gtk:Object",
+ m->line_no);
+ }
+
+ }
+ }
+ }
+ if(!got_finalize) {
+ node = new_method(NO_SCOPE, OVERRIDE_METHOD,
+ (Type *)new_type(0,g_strdup("void"),NULL),
+ g_strdup("Gtk:Object"),
+ NULL,g_strdup("finalize"),
+ 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 {
+ gboolean simple;
+ char *gtkname;
+ char *typename;
+} our_gtk_type_table[] = {
+ { TRUE, "NONE", "void " },
+ { TRUE, "CHAR", "gchar " },
+ { TRUE, "UCHAR", "guchar " },
+ { TRUE, "BOOL", "gboolean " },
+ { TRUE, "INT", "gint " },
+ { TRUE, "UINT", "guint " },
+ { TRUE, "LONG", "glong " },
+ { TRUE, "ULONG", "gulong " },
+ { TRUE, "FLOAT", "gfloat " },
+ { TRUE, "DOUBLE", "gdouble " },
+ { TRUE, "STRING", /*"GtkString"*/"gchar *" },
+ { TRUE, "ENUM", /*"GtkEnum"*/"gint " },
+ { TRUE, "FLAGS", /*"GtkFlags"*/"guint " },
+ { TRUE, "BOXED", /*"GtkBoxed"*/"gpointer " },
+ { TRUE, "POINTER", "gpointer " },
+ { TRUE, "OBJECT", "GtkObject *" },
+ { FALSE, "SIGNAL", /*"GtkSignal"*/"___twopointertype " },
+ { FALSE, "ARGS", /*"GtkArgs"*/"___twopointertype " },
+ { FALSE, "CALLBACK", /*"GtkCallback"*/"___threepointertype " },
+ { FALSE, "C_CALLBACK", /*"GtkCCallback"*/"___twopointertype " },
+ { FALSE, "FOREIGN", /*"GtkForeign"*/"___twopointertype " },
+
+ { FALSE, NULL, NULL }
+};
+
+static const char *
+get_cast(char *type, gboolean simple_only)
+{
+ int i;
+ for(i=0;our_gtk_type_table[i].gtkname;i++) {
+ if(strcmp(our_gtk_type_table[i].gtkname,type)==0) {
+ if(simple_only &&
+ !our_gtk_type_table[i].simple)
+ return NULL;
+ return our_gtk_type_table[i].typename;
+ }
+ }
+ return NULL;
+}
+
+
+/* hash of method -> name of signal prototype */