vala r1690 - in trunk: . gobject tests vala
- From: rasa svn gnome org
- To: svn-commits-list gnome org
- Subject: vala r1690 - in trunk: . gobject tests vala
- Date: Wed, 9 Jul 2008 21:38:27 +0000 (UTC)
Author: rasa
Date: Wed Jul 9 21:38:27 2008
New Revision: 1690
URL: http://svn.gnome.org/viewvc/vala?rev=1690&view=rev
Log:
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
Modified:
trunk/ChangeLog
trunk/gobject/valaccodegenerator.vala
trunk/tests/classes-properties.vala
trunk/vala/valaproperty.vala
Modified: trunk/gobject/valaccodegenerator.vala
==============================================================================
--- trunk/gobject/valaccodegenerator.vala (original)
+++ trunk/gobject/valaccodegenerator.vala Wed Jul 9 21:38:27 2008
@@ -953,7 +953,10 @@
}
// 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 ());
Modified: trunk/tests/classes-properties.vala
==============================================================================
--- trunk/tests/classes-properties.vala (original)
+++ trunk/tests/classes-properties.vala Wed Jul 9 21:38:27 2008
@@ -4,7 +4,6 @@
private string automatic { get; set; }
private string _name;
- [Notify]
public string name {
get { return _name; }
set { _name = value; }
Modified: trunk/vala/valaproperty.vala
==============================================================================
--- trunk/vala/valaproperty.vala (original)
+++ trunk/vala/valaproperty.vala Wed Jul 9 21:38:27 2008
@@ -18,6 +18,7 @@
*
* Author:
* JÃrg Billeter <j bitron ch>
+ * Raffaele Sandrini <raffaele sandrini ch>
*/
using GLib;
@@ -56,7 +57,7 @@
* 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
@@ -241,14 +242,20 @@
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") {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]