[evolution-data-server/tintou/more-flags-type] M!73 - Add more GType for many Camel Flags




commit 6f9b577217dd23efa7f8b08558acf63ac5b05d76
Author: Corentin Noël <corentin noel collabora com>
Date:   Sat Jul 24 15:46:12 2021 +0200

    M!73 - Add more GType for many Camel Flags
    
    Also change the CamelMessageInfo:flags property to CamelMessageFlags.
    
    Closes: https://gitlab.gnome.org/GNOME/evolution-data-server/-/merge_requests/73
    
    Signed-off-by: Corentin Noël <corentin noel collabora com>

 src/camel/CMakeLists.txt               |  3 +++
 src/camel/camel-message-info.c         | 10 ++++++----
 src/camel/camel-mime-filter-canon.c    |  2 +-
 src/camel/camel-mime-filter-canon.h    |  4 ++--
 src/camel/camel-mime-filter-enriched.c |  4 ++--
 src/camel/camel-mime-filter-enriched.h |  5 ++++-
 6 files changed, 18 insertions(+), 10 deletions(-)
---
diff --git a/src/camel/CMakeLists.txt b/src/camel/CMakeLists.txt
index 2ba609b8e..7058b9c08 100644
--- a/src/camel/CMakeLists.txt
+++ b/src/camel/CMakeLists.txt
@@ -1,6 +1,9 @@
 glib_mkenums_multiple(camel-enumtypes CAMEL_ENUMTYPES_H
        camel-enums.h
        camel-folder.h
+       camel-message-info.h
+       camel-mime-filter-canon.h
+       camel-mime-filter-enriched.h
        camel-service.h
        camel-sexp.h
        camel-store.h
diff --git a/src/camel/camel-message-info.c b/src/camel/camel-message-info.c
index 70e4bedc9..c2473b58b 100644
--- a/src/camel/camel-message-info.c
+++ b/src/camel/camel-message-info.c
@@ -21,6 +21,7 @@
 #include <string.h>
 
 #include "camel-db.h"
+#include "camel-enumtypes.h"
 #include "camel-folder.h"
 #include "camel-folder-summary.h"
 #include "camel-message-info-base.h"
@@ -406,7 +407,7 @@ message_info_set_property (GObject *object,
                return;
 
        case PROP_FLAGS:
-               camel_message_info_set_flags (mi, ~0, g_value_get_uint (value));
+               camel_message_info_set_flags (mi, ~0, g_value_get_flags (value));
                return;
 
        case PROP_USER_FLAGS:
@@ -499,7 +500,7 @@ message_info_get_property (GObject *object,
                return;
 
        case PROP_FLAGS:
-               g_value_set_uint (value, camel_message_info_get_flags (mi));
+               g_value_set_flags (value, camel_message_info_get_flags (mi));
                return;
 
        case PROP_USER_FLAGS:
@@ -731,11 +732,12 @@ camel_message_info_class_init (CamelMessageInfoClass *class)
        g_object_class_install_property (
                object_class,
                PROP_FLAGS,
-               g_param_spec_uint (
+               g_param_spec_flags (
                        "flags",
                        "Flags",
                        NULL,
-                       0, G_MAXUINT32, 0,
+                       CAMEL_TYPE_MESSAGE_FLAGS,
+                       0,
                        G_PARAM_READWRITE |
                        G_PARAM_EXPLICIT_NOTIFY |
                        G_PARAM_STATIC_STRINGS));
diff --git a/src/camel/camel-mime-filter-canon.c b/src/camel/camel-mime-filter-canon.c
index 0a5241291..cf491609b 100644
--- a/src/camel/camel-mime-filter-canon.c
+++ b/src/camel/camel-mime-filter-canon.c
@@ -191,7 +191,7 @@ camel_mime_filter_canon_init (CamelMimeFilterCanon *filter)
 
 /**
  * camel_mime_filter_canon_new:
- * @flags: bitwise flags defining the behaviour of the filter
+ * @flags: (type CamelMimeFilterCanonFlags): bitwise flags defining the behaviour of the filter
  *
  * Create a new filter to canonicalise an input stream.
  *
diff --git a/src/camel/camel-mime-filter-canon.h b/src/camel/camel-mime-filter-canon.h
index 495a065d9..fa0d962f3 100644
--- a/src/camel/camel-mime-filter-canon.h
+++ b/src/camel/camel-mime-filter-canon.h
@@ -52,11 +52,11 @@ typedef struct _CamelMimeFilterCanon CamelMimeFilterCanon;
 typedef struct _CamelMimeFilterCanonClass CamelMimeFilterCanonClass;
 typedef struct _CamelMimeFilterCanonPrivate CamelMimeFilterCanonPrivate;
 
-enum {
+typedef enum {
        CAMEL_MIME_FILTER_CANON_CRLF = (1 << 0), /* canoncialise end of line to crlf, otherwise canonicalise 
to lf only */
        CAMEL_MIME_FILTER_CANON_FROM = (1 << 1), /* escape "^From " using quoted-printable semantics into 
"=46rom " */
        CAMEL_MIME_FILTER_CANON_STRIP = (1 << 2)        /* strip trailing space */
-};
+} CamelMimeFilterCanonFlags;
 
 struct _CamelMimeFilterCanon {
        CamelMimeFilter parent;
diff --git a/src/camel/camel-mime-filter-enriched.c b/src/camel/camel-mime-filter-enriched.c
index 18bbff319..0808d2fdf 100644
--- a/src/camel/camel-mime-filter-enriched.c
+++ b/src/camel/camel-mime-filter-enriched.c
@@ -553,7 +553,7 @@ camel_mime_filter_enriched_init (CamelMimeFilterEnriched *filter)
 
 /**
  * camel_mime_filter_enriched_new:
- * @flags: bitwise set of flags to specify filter behaviour
+ * @flags: (type CamelMimeFilterEnrichedFlags): bitwise set of flags to specify filter behaviour
  *
  * Create a new #CamelMimeFilterEnriched object to convert input text
  * streams from text/plain into text/enriched or text/richtext.
@@ -577,7 +577,7 @@ camel_mime_filter_enriched_new (guint32 flags)
 /**
  * camel_enriched_to_html:
  * @in: input textual string
- * @flags: flags specifying filter behaviour
+ * @flags: (type CamelMimeFilterEnrichedFlags): flags specifying filter behaviour
  *
  * Convert @in from text/plain into text/enriched or text/richtext
  * based on @flags.
diff --git a/src/camel/camel-mime-filter-enriched.h b/src/camel/camel-mime-filter-enriched.h
index fbdf79710..ddf2a7cf6 100644
--- a/src/camel/camel-mime-filter-enriched.h
+++ b/src/camel/camel-mime-filter-enriched.h
@@ -45,7 +45,10 @@
        (G_TYPE_INSTANCE_GET_CLASS \
        ((obj), CAMEL_TYPE_MIME_FILTER_ENRICHED, CamelMimeFilterEnrichedClass))
 
-#define CAMEL_MIME_FILTER_ENRICHED_IS_RICHTEXT  (1 << 0)
+typedef enum {
+       CAMEL_MIME_FILTER_ENRICHED_NONE = 0,
+       CAMEL_MIME_FILTER_ENRICHED_IS_RICHTEXT = 1 << 0
+} CamelMimeFilterEnrichedFlags;
 
 G_BEGIN_DECLS
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]