+static char *
+interface_type(const char *if_name)
+{
+ char *rawtype = remove_sep(if_name);
+ char *end = "", *typename;
+
+ if (!gtk3_ok) {
+ /*
+ * EEEK! evil, we should have some sort of option
+ * to force this for arbitrary interfaces, since
+ * some are Class and some are Iface. Glib is shite
+ * in consistency.
+ */
+
+ if (strcmp (rawtype, "GtkEditable") == 0
+ || strcmp (rawtype, "GTypePlugin") == 0)
+ {
+ end = "Class";
+ } else {
+ /* We'll assume Iface is the standard ending */
+ end = "Iface";
+ }
+ } else {
+ /* GTK3 doesn't need Iface end */
+ end = "Interface";
+ }
+
+ typename = g_strconcat(rawtype, end, (char *)NULL);
+ g_free(rawtype);
+
+ return typename;
+}
+
+static void
+define_parent_interface_refs(Class *c)
+{
+ GList *li;
+
+ if (!c->interfaces)
+ return;
+
+ out_printf(out, "\n/* parent class interface implementations */\n");
+ for (li = c->interfaces; li != NULL; li = li->next) {
+ char *name = replace_sep(li->data, '_');
+ char *type = interface_type(li->data);
+
+ out_printf (out, "static %s *%s_parent_iface;\n", type, name);
+
+ g_free(name);
+ g_free(type);
+ }
+}
+