Re: [Vala] How to connect to signal if there's a property with the same name?



Hi,

According to this
https://git.gnome.org/browse/vala/tree/vapi/gio-2.0.vapi#n516 it seems that
the signal isn't bound in vala. Maybe vala doesn't accept yet that a
property and a method (signal) have the same name.

As Robert Schroll says, connect to the notify signal of the property.
"...
        connection.notify["closed"].connect(on_dbus_connection_closed)
..."
go to : https://wiki.gnome.org/Projects/Vala/Tutorial#line-1112

Le jeu. 10 déc. 2015 à 21:05, Robert Schroll <rschroll gmail com> a écrit :

Does the 'closed' property change at the same time the 'closed' signal
fires?  If so, you may be able to connect to the notification on the
property:

        connection.notify["closed"].connect(on_dbus_connection_closed)

Note that you'll probably want to check whether 'closed' is true in
your handler before doing anything.

Robert


On Thu, Dec 10, 2015 at 2:52 PM, marcin saepia net <marcin saepia net>
wrote:
I cannot rename this, this is part of GIO.


https://developer.gnome.org/gio/stable/GDBusConnection.html#GDBusConnection--closed

m.

2015-12-10 16:29 GMT+01:00 Al Thomas <astavale yahoo co uk>:

 > From: "marcin saepia net" <marcin saepia net>

 > Sent: Thursday, 10 December 2015, 11:51
 > Subject: [Vala] How to connect to signal if there's a property
with the
 same  name?
 >
 > I need to connect to "closed" signal of GDBusConnection, but
because
 > there
 > is a property with the same name, valac refuses to compile and
throws the
 > following error
 >
 > src/common/daemon/base.vala:63.11-63.35: error: The name
`connect' does
 not
 > exist in the context of `bool'
 >           connection.closed.connect(on_dbus_connection_closed);
 >           ^^^^^^^^^^^^^^^^^^^^^^^^^
 >
 > How can I overcome this?


 Rename your property as 'is_closed', e.g.

 if ( connection.is_closed ) { }

 Otherwise I don't know.

 Al
 _______________________________________________
 vala-list mailing list
 vala-list gnome org
 https://mail.gnome.org/mailman/listinfo/vala-list

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

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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]