Commit 0a52042b authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter

support notify attribute for properties

2007-09-20  Juerg Billeter  <j@bitron.ch>

	* vala/valaproperty.vala, gobject/valaccodegenerator.vala: support
	  notify attribute for properties

svn path=/trunk/; revision=621
parent 1d319fc9
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
......
......@@ -643,6 +643,14 @@ public class Vala.CCodeGenerator : CodeGenerator {
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);
......
......@@ -45,7 +45,13 @@ public class Vala.Property : Member, Lockable {
* 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.
......@@ -168,7 +174,9 @@ public class Vala.Property : Member, Lockable {
*/
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;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment