+2007-09-20 Jürg Billeter <j@bitron.ch>
+
+ * vala/valaproperty.vala, gobject/valaccodegenerator.vala: support
+ notify attribute for properties
+
2007-09-19 Alberto Ruiz <aruiz@gnome.org>
+
* vala-1.0.pc.in: add vapigen variable,
fixes bug 477111
function.block = (CCodeBlock) acc.body.ccodenode;
function.block.prepend_statement (create_property_type_check_statement (prop, acc.readable, t, true, "self"));
+
+ // notify on property changes
+ if (prop.notify && (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 ());
+ function.block.add_statement (new CCodeExpressionStatement (notify_call));
+ }
}
source_type_member_definition.append (function);
* Represents the generated ´this' parameter in this property.
*/
public FormalParameter this_parameter { get; set; }
-
+
+ /**
+ * Specifies whether a `notify' signal should be emitted on property
+ * changes.
+ */
+ public bool notify { get; set; }
+
/**
* Specifies whether the implementation of this property does not
* provide getter/setter methods.
*/
public void process_attributes () {
foreach (Attribute a in attributes) {
- if (a.name == "NoAccessorMethod") {
+ if (a.name == "Notify") {
+ notify = true;
+ } else if (a.name == "NoAccessorMethod") {
no_accessor_method = true;
}
}