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 580385 - Implement minimum, maximum constraints for GObject properties that support it
Implement minimum, maximum constraints for GObject properties that support it
Status: RESOLVED OBSOLETE
Product: vala
Classification: Core
Component: Code Generator: GObject
0.7.x
Other All
: Normal enhancement
: ---
Assigned To: Vala maintainers
Vala maintainers
: 575387 614587 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2009-04-27 07:26 UTC by Mark Lee
Modified: 2018-05-22 13:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add support for minimum/maximum constraints for properties (16.01 KB, patch)
2017-01-26 13:15 UTC, Rico Tzschichholz
none Details | Review

Description Mark Lee 2009-04-27 07:26:59 UTC
I'm attempting to convert some GObjects written in C into Vala for the Awn project, and in several instances, the minimum/maximum constraints for GObject properties are used with non-default values (Type.MIN/Type.MAX). For example, a panel background pattern can have a alpha (float) value between 0 and 1.

For the sake of completeness, there are two possible ways of implementing this (as far as I can tell):

1. Implement the same way as the default value. This would require that "min(imum)" and "max(imum)" become keywords, which would probably screw up a lot of code, but would be consistent with the other property attributes.
2. Implement as code attributes. For example:

...
[CCode (minimum_value = 0.0f, maximum_value = 1.0f)]
public float pattern_alpha { get; construct; default = 1.0f; }
...

I'm not entirely comfortable with the idea of having to add a code attribute for every single property with non-default constraints, though.
Comment 1 Luca Bruno 2010-05-27 19:54:34 UTC
*** Bug 614587 has been marked as a duplicate of this bug. ***
Comment 2 Luca Bruno 2010-05-27 19:55:37 UTC
*** Bug 575387 has been marked as a duplicate of this bug. ***
Comment 3 Rico Tzschichholz 2017-01-26 13:15:18 UTC
Created attachment 344320 [details] [review]
Add support for minimum/maximum constraints for properties

The values can be passed withing the property definition block, exactly
how the 'default' value is handled.

"public int foo { get; set; default = 0; minimum = -128; maximum = 512; }"
Comment 4 GNOME Infrastructure Team 2018-05-22 13:20:31 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/vala/issues/32.