After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 437434 - Support property metadata
Support property metadata
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: general
0.1.x
Other All
: Normal normal
: ---
Assigned To: Jürg Billeter
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2007-05-10 12:43 UTC by Jürg Billeter
Modified: 2008-10-18 21:07 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed patch to add Description metadata to properties (2.16 KB, patch)
2008-01-29 22:52 UTC, Juan Carlos Girardi
reviewed Details | Review

Description Jürg Billeter 2007-05-10 12:43:40 UTC
Add support for property metadata like nick, blurb, and default value to Vala, possibly using attributes.
Comment 1 Mathias Hasselmann (IRC: tbf) 2007-08-28 07:11:35 UTC
In the spirit of C# I'd suggest using the attributes Description and DefaultValue for blurb and default value. Regarding the nick: Shouldn't it get generated automatically?
Comment 2 Jürg Billeter 2007-08-28 07:23:08 UTC
Description and DefaultValue attributes sound fine to me. What should Vala use as nick for properties?
Comment 3 Mathias Hasselmann (IRC: tbf) 2007-08-28 07:58:27 UTC
(In reply to comment #2)
> What should Vala use as nick for properties?

From my experience and from scanning the source code of GTK+ I'd suggest replacing underscores by spaces and converting the lower-case property name to title case:

    So "tooltip_column" would become "Tooltip Column".

Well, but you are right when you claim there are exceptions from this rule. For instance the "scroll-arrow-hlength" property has the nick "Horizontal Scroll Arrow Length". So it seems to be necessary to allow overriding of the nick. What would be good attribute name? "DisplayName"? Or should we just extend the "Description" attribute to have an optional "displayName" property?

Comment 4 Jürg Billeter 2008-01-25 15:51:55 UTC
An attribute might not be the best place for the default value. I currently tend to the following syntax:

public int foo { get; set; default (42); }
Comment 5 Juan Carlos Girardi 2008-01-29 22:52:08 UTC
Created attachment 103993 [details] [review]
proposed patch to add Description metadata to properties

I try to add metadata to properties and with this patch you can insert attributes in this form:

[Description(nickname="Short Descrition", fulldesc="Full Descrition of this property")]
public string example_property {get; set;}

I dont know if its enougth with these small changes or if its necesary change more files. Also im nor sure if the initialization in the Property class its good or if exist another better way to do it.
Anyway its my first path i hope you undertand. Thankyou.
Comment 6 Jürg Billeter 2008-02-02 12:18:06 UTC
Thanks for the patch. I'll go for nick and blurb for now to use the same names as in the GObject documentation.
Comment 7 Jürg Billeter 2008-02-02 12:22:15 UTC
2008-02-02  Jürg Billeter  <j@bitron.ch>

	* vala/valaproperty.vala, gobject/valaccodegeneratorinterface.vala:
	  support [Description (nick = "foo", blurb = "bar")] attribute,
	  based on patch by Juan Carlos Girardi, fixes part of bug 437434

Partly fixed in r948.
Comment 8 Jürg Billeter 2008-02-05 21:25:20 UTC
2008-02-05  Jürg Billeter  <j@bitron.ch>

	* vala/parser.y, vala/valaclass.vala, vala/valaproperty.vala,
	  gobject/valaccodegeneratorinterface.vala: support default values
	  for properties, fixes bug 437434

Fixed in r980.
Comment 9 Michael Lawrence 2008-02-14 21:43:22 UTC
Are there no plans for other metadata, such as the range for numeric types?
Comment 10 Marc-Andre Lureau 2008-10-18 21:07:42 UTC
test case added to vala-tests