+2008-07-10 Raffaele Sandrini <raffaele@sandrini.ch>
+
+ * gobject/valaccodegenerator.vala:
+ * vala/valaproperty.vala:
+
+ Change GObject properties to always notify on value change, remove the
+ [Notify] attribute and add a boolean CCode attribute parameter named
+ `notify', based on patch by Jared Moore, fixes bug 540700
+
+ * tests/classes-properties.vala: update
+
2008-07-98 Jared Moore <jaredm@svn.gnome.org>
* gobject/valaccodecompiler.vala:
}
// notify on property changes
- if (prop.notify && (acc.writable || acc.construction)) {
+ if (current_class.is_subtype_of (gobject_type) &&
+ prop.notify &&
+ prop.access != SymbolAccessibility.PRIVATE && // FIXME: use better means to detect gobject properties
+ (acc.writable || acc.construction)) {
var notify_call = new CCodeFunctionCall (new CCodeIdentifier ("g_object_notify"));
notify_call.add_argument (new CCodeCastExpression (new CCodeIdentifier ("self"), "GObject *"));
notify_call.add_argument (prop.get_canonical_cconstant ());
private string automatic { get; set; }
private string _name;
- [Notify]
public string name {
get { return _name; }
set { _name = value; }
*
* Author:
* Jürg Billeter <j@bitron.ch>
+ * Raffaele Sandrini <raffaele@sandrini.ch>
*/
using GLib;
* Specifies whether a `notify' signal should be emitted on property
* changes.
*/
- public bool notify { get; set; }
+ public bool notify { get; set; default = true; }
/**
* Specifies whether the implementation of this property does not
return str.str;
}
-
+
+ void process_ccode_attribute (Attribute a) {
+ if (a.has_argument ("notify")) {
+ notify = a.get_bool ("notify");
+ }
+ }
+
/**
* Process all associated attributes.
*/
public void process_attributes () {
foreach (Attribute a in attributes) {
- if (a.name == "Notify") {
- notify = true;
+ if (a.name == "CCode") {
+ process_ccode_attribute (a);
} else if (a.name == "NoAccessorMethod") {
no_accessor_method = true;
} else if (a.name == "Description") {