Commit a79b340e authored by Mathias Hasselmann's avatar Mathias Hasselmann Committed by Mathias Hasselmann
Browse files

link to bug 473804 for Object::notify add property sample from Wiki as

2007-09-05  Mathias Hasselmann  <mathias.hasselmann@gmx.de>

	* vapi/glib-2.0.vala: link to bug 473804 for Object::notify
	* tests/Makefile.am, tests/property-sample.exp,
	tests/property-sample.vala: add property sample from Wiki
	as regression test.

svn path=/trunk/; revision=582
parent 15f4c8e7
2007-09-05 Mathias Hasselmann <mathias.hasselmann@gmx.de>
* vapi/glib-2.0.vala: link to bug 473804 for Object::notify
* tests/Makefile.am, tests/property-sample.exp,
tests/property-sample.vala: add property sample from Wiki
as regression test.
2007-09-04 Mathias Hasselmann <mathias.hasselmann@gmx.de>
* gobject/valacodegenerator.vala: support strings in switch
......
......@@ -34,6 +34,8 @@ TESTS_ENVIRONMENT = $(srcdir)/testrunner.sh
TESTS = \
hello.vala \
property-sample.vala \
\
test-001.vala \
test-002.vala \
test-003.vala \
......@@ -76,7 +78,10 @@ TESTS = \
EXTRA_DIST = \
testrunner.sh \
$(TESTS) \
\
hello.exp \
property-sample.exp \
\
test-001.exp \
test-002.exp \
test-003.exp \
......
property `name' has changed!
automatic: TheNewAutomatic
name: TheNewName
read_only: InitialReadOnly
automatic: TheNewAutomatic
/* Properties Sample Code
* Keep in sync with <http://live.gnome.org/Vala/PropertiesSample>
*/
using GLib;
public class Sample : Object {
private string automatic {
get; set;
}
private string _name;
public string name {
get;
set {
_name = value;
notify("name");
}
}
private string _read_only;
public string read_only {
get;
}
private string _ignore_callee;
public string ignore_callee {
get;
set {}
}
public Sample(construct string! name) {
}
construct {
_automatic = "InitialAutomatic";
_read_only = "InitialReadOnly";
_ignore_callee = "InitialIgnoreCallee";
}
public void run() {
notify += (s, p) => {
/* FIXME Cast needed as signatures conflict for the
* notify method and the notify signal of GObject.
* See Bug 473804.
*/
stdout.printf("property `%s' has changed!\n",
((ParamSpec) p).name);
};
automatic = "TheNewAutomatic";
name = "TheNewName";
// The following statement would be rejected
// read_only = "TheNewReadOnly";
ignore_callee = "TheNewIgnoreCallee";
stdout.printf("automatic: %s\n", automatic);
stdout.printf("name: %s\n", name);
stdout.printf("read_only: %s\n", read_only);
stdout.printf("automatic: %s\n", automatic);
}
static int main (string[] args) {
var test = new Sample("InitialName");
test.run();
return 0;
}
}
......@@ -640,7 +640,9 @@ namespace GLib {
/* FIXME The notify passes a ParamSpec where the
* wrapper expects a string. Fortunatly Vala doesn't
* verify signatures of signal handlers yet.*/
* verify signatures of signal handlers yet.
* See Bug 473804.
*/
[HasEmitter]
public signal void notify(string! property_name);
......
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