[geary/gnumdk/vala_nullable_enum_property] engine: Vala disallows using nullabe enum value as real GObject property
- From: Cédric Bellegarde <cbellegarde src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/gnumdk/vala_nullable_enum_property] engine: Vala disallows using nullabe enum value as real GObject property
- Date: Sat, 23 Jul 2022 17:08:57 +0000 (UTC)
commit a2e59b92a396e5be1954a26bf16d22f4231bbb40
Author: Cédric Bellegarde <cedric bellegarde adishatz org>
Date: Wed Jul 20 14:35:30 2022 +0200
engine: Vala disallows using nullabe enum value as real GObject property
src/engine/imap/api/imap-client-service.vala | 2 +-
src/engine/imap/api/imap-session-object.vala | 9 +++++----
src/engine/imap/transport/imap-client-session.vala | 3 ++-
3 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/src/engine/imap/api/imap-client-service.vala b/src/engine/imap/api/imap-client-service.vala
index da3598f38..fe534b498 100644
--- a/src/engine/imap/api/imap-client-service.vala
+++ b/src/engine/imap/api/imap-client-service.vala
@@ -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(),
diff --git a/src/engine/imap/api/imap-session-object.vala b/src/engine/imap/api/imap-session-object.vala
index 80695fcaf..24fbf5e67 100644
--- a/src/engine/imap/api/imap-session-object.vala
+++ b/src/engine/imap/api/imap-session-object.vala
@@ -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);
}
diff --git a/src/engine/imap/transport/imap-client-session.vala
b/src/engine/imap/transport/imap-client-session.vala
index 9f1eb94e8..31aa16afc 100644
--- a/src/engine/imap/transport/imap-client-session.vala
+++ b/src/engine/imap/transport/imap-client-session.vala
@@ -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.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]