Re: [Vala] default value is less accessible than method

2017-10-10 Thread Al Thomas via vala-list
> On Tuesday, 10 October 2017, 20:11:15 BST, Ondrej Tuma  
> wrote: 
> I have simple code (in attachment), when I try to compile, i got error:

> GLib.Object.vala:15.39-15.52:
> error: default value is less accessible than method `Node.add'
>     public Node add (uint direction = Direction.AUTO) {
                                      ^^
> Compilation failed: 1 error(s), 0 warning(s)

> What's wrong?

 You want:
public enum Direction {    LEFT,    RIGHT,    AUTO}
instead of:
enum Direction {    LEFT,    RIGHT,    AUTO}
Without an explicit access modifier the default is 'internal'.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] default value is less accessible than method

2017-10-10 Thread Ondrej Tuma
Hi there,

I have simple code (in attachment), when I try to compile, i got error:

GLib.Object.vala:15.39-15.52:
error: default value is less accessible than method `Node.add'
 public Node add (uint direction = Direction.AUTO) {
   ^^
Compilation failed: 1 error(s), 0 warning(s)

What's wrong?

PS:
I test this code on Debian tesing (valac 0.36.5-1)
-- 
Ondřej Tůma 
www: http://ipv6.mcbig.cz   jabber: mc...@jabber.cz   twitter: mcbig_cz
enum Direction {
LEFT,
RIGHT,
AUTO
}

public class Node : GLib.Object {

public uint direction;

private Node (uint direction = Direction.AUTO) {
this.direction = direction;
}

public Node add (uint direction = Direction.AUTO) {
var child = new Node (direction);
return child;
}
}


pgpfo1QC1JCVa.pgp
Description: Digitální podpis OpenPGP
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] notify for synthetic properties?

2017-10-10 Thread Michael Gratton

Hey people,

Say you have a GObject with a synthetic property, the value of which 
depends on some other value, e.g.:



public string value {
get { return entry.get_text(); }
set { entry.set_text(value); }
}

private Gtk.Entry entry;


You want to want to get notifies when the synthetic property changes, 
which is obviously dependent on the value being used.


So you can manually add handlers for the dependent value and call 
notify_property("value") when it changes, or you can use GObject 
bindings. But both of these suck since they add code cruft that is off 
somewhere far away from the declarations, and that makes it hard to 
maintain and understand what is going with the values.


Is there a nicer way to do this in vala?

//Mike

--
⊨ Michael Gratton, Percept Wrangler.
⚙ 


___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list