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 <[email protected]>:
> >From: "[email protected]" <[email protected]>
> >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 <[email protected]>:
> >>Rename your property as 'is_closed', e.g.
> >>
> >>if ( connection.is_closed ) { }
> >>
> >>Otherwise I don't know.
> >>
> >>Al
> _______________________________________________
> vala-list mailing list
> [email protected]
> https://mail.gnome.org/mailman/listinfo/vala-list
>
_______________________________________________
vala-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/vala-list