From d3be50a6a0344f387666926c9894470c47a3ed91 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Thu, 2 Nov 2017 09:01:37 +0100 Subject: [PATCH] Port MatrixAccountKind to C --- src/matrix-c-types.c | 9 +++++++++ src/matrix-c-types.h | 6 ++++++ src/matrix-types.vala | 21 --------------------- vapi/c-api.vapi | 9 +++++++++ 4 files changed, 24 insertions(+), 21 deletions(-) diff --git a/src/matrix-c-types.c b/src/matrix-c-types.c index f1fe360..8515961 100644 --- a/src/matrix-c-types.c +++ b/src/matrix-c-types.c @@ -89,3 +89,12 @@ * Gets the Matrix error #GQuark */ G_DEFINE_QUARK(matrix-error-quark, matrix_error); + +/** + * MatrixAccountKind: + * @MATRIX_ACCOUNT_KIND_DEFAULT: use the server default (usually #MATRIX_ACCOUNT_KIND_USER) + * @MATRIX_ACCOUNT_KIND_USER: normal user + * @MATRIX_ACCOUNT_KIND_GUEST: guest user + * + * User account types. + */ diff --git a/src/matrix-c-types.h b/src/matrix-c-types.h index 405e77c..9f12328 100644 --- a/src/matrix-c-types.h +++ b/src/matrix-c-types.h @@ -74,4 +74,10 @@ typedef enum { # define MATRIX_ERROR matrix_error_quark() GQuark matrix_error_quark(void); +typedef enum { + MATRIX_ACCOUNT_KIND_DEFAULT, + MATRIX_ACCOUNT_KIND_USER, + MATRIX_ACCOUNT_KIND_GUEST +} MatrixAccountKind; + #endif /* __MATRIX_TYPE_H__ */ diff --git a/src/matrix-types.vala b/src/matrix-types.vala index bc4d934..0b6b6e0 100644 --- a/src/matrix-types.vala +++ b/src/matrix-types.vala @@ -17,27 +17,6 @@ */ namespace Matrix { - /** - * User account types. - */ - public enum AccountKind { - /** - * use the server default (usually - * {@link Matrix.AccountKind.USER}) - */ - DEFAULT, - - /** - * normal user - */ - USER, - - /** - * guest user - */ - GUEST; - } - /** * Direction of events when requesting an event context. */ diff --git a/vapi/c-api.vapi b/vapi/c-api.vapi index a09b23f..6b1f903 100644 --- a/vapi/c-api.vapi +++ b/vapi/c-api.vapi @@ -62,6 +62,15 @@ namespace Matrix { public static GLib.Quark quark (); } + public const int MATRIX_ERROR; + + [CCode (cheader_filename = "matrix-enumtypes.h", cprefix = "MATRIX_ACCOUNT_KIND_")] + public enum AccountKind { + DEFAULT, + USER, + GUEST; + } + /** * The major version number of the Matrix.org GLib SDK. */