engine: Vala disallows using nullabe enum value as real GObject property

This commit is contained in:
Cédric Bellegarde 2022-07-20 14:35:30 +02:00
parent b3c0afddab
commit a2e59b92a3
3 changed files with 8 additions and 6 deletions

View file

@ -558,7 +558,7 @@ public class Geary.Imap.ClientService : Geary.ClientService {
var session = source as ClientSession;
if (session != null &&
session.protocol_state == NOT_CONNECTED &&
session.disconnected != null) {
session.disconnected != ClientSession.DisconnectReason.NULL) {
debug(
"Session disconnected: %s: %s",
session.to_string(),

View file

@ -109,10 +109,11 @@ public abstract class Geary.Imap.SessionObject : BaseObject, Logging.Source {
// Disconnect reason will null when the session is being
// logged out but the logout command has not yet been
// completed.
var reason = (
this.session.disconnected ??
ClientSession.DisconnectReason.LOCAL_CLOSE
);
var reason =
this.session.disconnected ==
ClientSession.DisconnectReason.NULL ?
ClientSession.DisconnectReason.LOCAL_CLOSE :
this.session.disconnected;
close();
disconnected(reason);
}

View file

@ -108,6 +108,7 @@ public class Geary.Imap.ClientSession : BaseObject, Logging.Source {
}
public enum DisconnectReason {
NULL,
LOCAL_CLOSE,
LOCAL_ERROR,
REMOTE_CLOSE,
@ -277,7 +278,7 @@ public class Geary.Imap.ClientSession : BaseObject, Logging.Source {
}
/** Specifies the reason the session was disconnected, if any. */
public DisconnectReason? disconnected { get; private set; default = null; }
public DisconnectReason disconnected { get; private set; default = NULL; }
/**
* Set of IMAP extensions reported as being supported by the server.