Re: need people to add documentation to glib?
- From: Matthias Clasen <maclas gmx de>
- To: gtk-doc-list gnome org
- Subject: Re: need people to add documentation to glib?
- Date: 10 Apr 2003 22:26:52 +0200
On Wed, 2003-04-09 at 22:55, Guido Draheim wrote:
> Hmmm, and I wondered why the gtk-doc list shows so
> little traffic, one might get the impression there is
> nothing going on about gtk doc tools. So it seems,
> those discussion have been going on in gtk-devel then.
Just to prove you wrong, here is a patch which improves the output for
properties which contain arrays of values. Recent discussion on
gtk-devel-list revealed that such properties can be typed and of fixed
length. The patch makes gtk-doc emit this information in the form:
"authors" GValueArray (gchararray[]) : Write
"threelogos" GValueArray (GdkPixbuf[3]) : Read / Write
Ok to commit this ? The impact should be fairly low, since I couldn't
find more than 2 or 3 instances of g_param_spec_value_array() in all of
Gnome...
Matthias
Index: gtkdoc-scangobj.in
===================================================================
RCS file: /cvs/gnome/gtk-doc/gtkdoc-scangobj.in,v
retrieving revision 1.33
diff -u -b -B -p -r1.33 gtkdoc-scangobj.in
--- gtkdoc-scangobj.in 30 Dec 2002 22:55:45 -0000 1.33
+++ gtkdoc-scangobj.in 10 Apr 2003 20:22:30 -0000
@@ -887,6 +887,7 @@ output_widget_args (FILE *fp, GType obje
guint n_properties;
gboolean child_prop;
gboolean style_prop;
+ gchar *type_name;
if (!G_TYPE_IS_CLASSED (object_type))
return;
@@ -938,8 +939,30 @@ output_widget_args (FILE *fp, GType obje
dot = ".";
}
+ if (spec->value_type == G_TYPE_VALUE_ARRAY) {
+ GParamSpecValueArray *array_spec = G_PARAM_SPEC_VALUE_ARRAY (spec);
+ GString *tmp = g_string_new (g_type_name (spec->value_type));
+
+ if (array_spec->element_spec || array_spec->fixed_n_elements) {
+ g_string_append (tmp, " (");
+ if (array_spec->element_spec)
+ g_string_append_printf (tmp, "%s", g_type_name (array_spec->element_spec->value_type));
+ if (array_spec->fixed_n_elements)
+ g_string_append_printf (tmp, " [%d]", array_spec->fixed_n_elements);
+ else
+ g_string_append (tmp, " []");
+ g_string_append (tmp, ")");
+ }
+
+ type_name = g_string_free (tmp, FALSE);
+ }
+ else
+ type_name = g_strdup (g_type_name (spec->value_type));
+
fprintf (fp, "<ARG>\\n<NAME>%s::%s</NAME>\\n<TYPE>%s</TYPE>\\n<FLAGS>%s</FLAGS>\\n<NICK>%s</NICK>\\n<BLURB>%s%s</BLURB>\\n</ARG>\\n\\n",
- object_class_name, g_param_spec_get_name (spec), g_type_name (spec->value_type), flags, nick ? nick : "(null)", blurb ? blurb : "(null)", dot);
+ object_class_name, g_param_spec_get_name (spec), type_name, flags, nick ? nick : "(null)", blurb ? blurb : "(null)", dot);
+
+ g_free (type_name);
}
g_free (properties);
Index: gtkdoc-mkdb.in
===================================================================
RCS file: /cvs/gnome/gtk-doc/gtkdoc-mkdb.in,v
retrieving revision 1.74
diff -u -b -B -p -r1.74 gtkdoc-mkdb.in
--- gtkdoc-mkdb.in 14 Mar 2003 22:07:55 -0000 1.74
+++ gtkdoc-mkdb.in 10 Apr 2003 20:22:31 -0000
@@ -1826,6 +1826,8 @@ sub GetArgs {
} elsif ($type eq "GtkString") {
$type = "gchar*";
$type_output = &MakeXRef ("gchar") . "*";
+ } elsif ($type =~ /GValueArray \((.*) \[(.*)\]\)/) {
+ $type_output = &MakeXRef ("GValueArray") . " (" . &MakeXRef($1) . "[" . $2 . "])";
} else {
$type_output = &MakeXRef ($type);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]