From bb4d0da566cf3f6c1f3189cf31b59309f6720220 Mon Sep 17 00:00:00 2001 From: James Henstridge Date: Sat, 16 Mar 2002 15:16:07 +0000 Subject: fix up property listing. 2002-03-16 James Henstridge * pygtype.c (add_property_docs): fix up property listing. * gtk/libglade.override: add modulename directive. * gtk/gdk.override: add modulename directive. * gtk/gtk.override: add modulename directive. * atk.override: add modulename directive. * pango.override: add modulename directive. * codegen/codegen.py (write_class): if override.modulename is set, put it into the classname. (write_interface): same here. (write_boxed): same here. (write_pointer): same here. * codegen/override.py (Overrides.__parse_override): add support for a "modulename" directive for overrides files. --- gobject/pygtype.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/gobject/pygtype.c b/gobject/pygtype.c index df8530f..84a0781 100644 --- a/gobject/pygtype.c +++ b/gobject/pygtype.c @@ -818,25 +818,31 @@ add_property_docs(GType gtype, GString *string) GObjectClass *class; GParamSpec **props; guint n_props = 0, i; + gboolean has_prop = FALSE; class = g_type_class_ref(gtype); props = g_object_class_list_properties(class, &n_props); - if (n_props > 0) { - g_string_append_printf(string, "Properties from %s:\n", - g_type_name(gtype)); - - for (i = 0; i < n_props; i++) { - g_string_append_printf(string, " %s -> %s: %s\n", - g_param_spec_get_name(props[i]), - g_type_name(props[i]->value_type), - g_param_spec_get_nick(props[i])); - g_string_append_printf(string, " %s\n", - g_param_spec_get_blurb(props[i])); - } - g_free(props); - g_string_append(string, "\n"); + for (i = 0; i < n_props; i++) { + if (props[i]->owner_type != gtype) + continue; /* these are from a parent type */ + + /* print out the heading first */ + if (!has_prop) { + g_string_append_printf(string, "Properties from %s:\n", + g_type_name(gtype)); + has_prop = TRUE; + } + g_string_append_printf(string, " %s -> %s: %s\n", + g_param_spec_get_name(props[i]), + g_type_name(props[i]->value_type), + g_param_spec_get_nick(props[i])); + g_string_append_printf(string, " %s\n", + g_param_spec_get_blurb(props[i])); } + g_free(props); + if (has_prop) + g_string_append(string, "\n"); g_type_class_unref(class); } -- cgit