Re: [Vala] How to connect to signal if there's a property with the same name?
- From: "marcin saepia net" <marcin saepia net>
- To: Al Thomas <astavale yahoo co uk>
- Cc: vala <vala-list gnome org>
- Subject: Re: [Vala] How to connect to signal if there's a property with the same name?
- Date: Thu, 10 Dec 2015 21:16:01 +0100
Not really, because I don't want to poll and check periodically if
connection is closed but to get event when it is closed.
For now I've invented something like this. Works but I have no clue yet if
there are no memleaks.
private bool on_dbus_server_new_connection(DBusServer server,
DBusConnection connection) {
info(@"[Daemon] New connection
$(get_dbus_connection_remote_address(connection))");
Signal.connect_object(connection, "closed",
(Callback)on_dbus_connection_closed, this, 0);
on_dbus_connection_ready(connection);
connection.ref();
return true;
}
private delegate void DBusConnectionClosed(DBusConnection
connection, bool remote_peer_vanished);
private static void on_dbus_connection_closed(DBusConnection
connection, bool remote_peer_vanished) {
info(@"[Daemon] Closed connection
$(get_dbus_connection_remote_address(connection)), remote peer vanished =
$(remote_peer_vanished)");
connection.unref();
}
m.
2015-12-10 21:07 GMT+01:00 Al Thomas <astavale yahoo co uk>:
From: "marcin saepia net" <marcin saepia net>
Sent: Thursday, 10 December 2015, 19:52
Subject: Re: [Vala] How to connect to signal if there's a property with
the same name?
I cannot rename this, this is part of GIO.
https://developer.gnome.org/gio/stable/GDBusConnection.html#GDBusConnection--closed
Hmm, there is also an is_closed() call:
https://developer.gnome.org/gio/stable/GDBusConnection.html#g-dbus-connection-is-closed
That would hopefully work around the name clash for you.
I'm not sure how the name clash should be resolved in the bindings.
Al
m.
2015-12-10 16:29 GMT+01:00 Al Thomas <astavale yahoo co uk>:
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]