+static void
+export_accessors (const char *var_name,
+ const char *get_cbuf,
+ int get_lineno,
+ const char *set_cbuf,
+ int set_lineno,
+ Type *type,
+ const char *gtktype,
+ int lineno)
+{
+ if (type == NULL) {
+ char *cast = g_strdup (get_cast (gtktype, FALSE));
+ char *p = strchr (cast, ' ');
+ if (p != NULL) {
+ *p = '\0';
+ p++;
+ }
+ /* leak, but we don't really care any more */
+ type = (Type *)new_type (cast,
+ g_strdup (p),
+ NULL);
+ }
+
+ if (get_cbuf != NULL) {
+ char *get_id = g_strdup_printf ("get_%s", var_name);
+ GString *get_cbuf_copy = g_string_new (get_cbuf);
+ char *tmp;
+ Node *node1 = new_type (g_strdup (type->name),
+ g_strdup (type->pointer),
+ g_strdup (type->postfix));
+ Node *node3 = new_type (g_strdup (class->class.otype),
+ g_strdup ("*"),
+ NULL);
+
+ tmp = g_strdup_printf ("\t%s%s ARG;\n",
+ type->name,
+ type->pointer ? type->pointer : "");
+ get_cbuf_copy = g_string_prepend (get_cbuf_copy, tmp);
+ g_free (tmp);
+
+ tmp = g_strdup_printf ("\n\t\treturn ARG;\n");
+ get_cbuf_copy = g_string_append (get_cbuf_copy, tmp);
+ g_free (tmp);
+
+ typestack = g_list_prepend (typestack, node1);
+ typestack = g_list_prepend (typestack, node3);
+
+ push_funcarg ("self", FALSE);
+
+ push_function (PUBLIC_SCOPE, REGULAR_METHOD, NULL,
+ get_id, get_cbuf_copy, get_lineno,
+ lineno, FALSE, NULL);
+ }
+
+ if (set_cbuf != NULL) {
+ char *set_id = g_strdup_printf ("set_%s", var_name);
+ GString *set_cbuf_copy = g_string_new (set_cbuf);
+ Node *node1 = new_type (g_strdup (type->name),
+ g_strdup (type->pointer),
+ g_strdup (type->postfix));
+ Node *node2 = new_type (g_strdup ("void"),
+ NULL,
+ NULL);
+ Node *node3 = new_type (g_strdup (class->class.otype),
+ g_strdup ("*"),
+ NULL);
+
+ typestack = g_list_prepend (typestack, node2);
+ typestack = g_list_prepend (typestack, node1);
+ typestack = g_list_prepend (typestack, node3);
+
+ push_funcarg ("self", FALSE);
+ push_funcarg ("ARG", FALSE);
+
+ typestack = g_list_prepend (typestack, node2);
+ push_function (PUBLIC_SCOPE, REGULAR_METHOD, NULL,
+ set_id, set_cbuf_copy, set_lineno,
+ lineno, FALSE, NULL);
+ }
+}
+