[evolution-data-server] Add CamelMimeFilterToHTMLFlags type.



commit 00b97fe7293727dfef01a11a3c34e02435726621
Author: Matthew Barnes <mbarnes redhat com>
Date:   Wed Feb 6 10:19:34 2013 -0500

    Add CamelMimeFilterToHTMLFlags type.
    
    Convert the CAMEL_MIME_FILTER_TOHTML_* flag macros to an enum type and
    move it to camel-enums.h so a GFlagsClass is generated for it.
    
    Use CamelMimeFilterToHTMLFlags as the 'flags' parameter type in
    camel_mime_filter_tohtml_new() and camel_text_to_html().

 camel/camel-enums.h                     |   13 +++++++++++++
 camel/camel-mime-filter-tohtml.c        |    8 ++++----
 camel/camel-mime-filter-tohtml.h        |   16 +++-------------
 docs/reference/camel/camel-sections.txt |   11 +----------
 4 files changed, 21 insertions(+), 27 deletions(-)
---
diff --git a/camel/camel-enums.h b/camel/camel-enums.h
index 8d7bb95..76ebc77 100644
--- a/camel/camel-enums.h
+++ b/camel/camel-enums.h
@@ -135,6 +135,19 @@ typedef enum { /*< flags >*/
 
 #define CAMEL_FOLDER_TYPE_MASK (63 << CAMEL_FOLDER_TYPE_BIT)
 
+typedef enum { /*< flags >*/
+	CAMEL_MIME_FILTER_TOHTML_PRE               = 1 << 0,
+	CAMEL_MIME_FILTER_TOHTML_CONVERT_NL        = 1 << 1,
+	CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES    = 1 << 2,
+	CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS      = 1 << 3,
+	CAMEL_MIME_FILTER_TOHTML_MARK_CITATION     = 1 << 4,
+	CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES = 1 << 5,
+	CAMEL_MIME_FILTER_TOHTML_ESCAPE_8BIT       = 1 << 6,
+	CAMEL_MIME_FILTER_TOHTML_CITE              = 1 << 7,
+	CAMEL_MIME_FILTER_TOHTML_PRESERVE_8BIT     = 1 << 8,
+	CAMEL_MIME_FILTER_TOHTML_FORMAT_FLOWED     = 1 << 9
+} CamelMimeFilterToHTMLFlags;
+
 /* WARNING: This enum and CamelFolderInfoFlags must stay in sync.
  * FIXME: Eliminate the need for two separate types. */
 typedef enum { /*< flags >*/
diff --git a/camel/camel-mime-filter-tohtml.c b/camel/camel-mime-filter-tohtml.c
index 053b518..c4b598f 100644
--- a/camel/camel-mime-filter-tohtml.c
+++ b/camel/camel-mime-filter-tohtml.c
@@ -39,7 +39,7 @@ struct _CamelMimeFilterToHTMLPrivate {
 
 	CamelUrlScanner *scanner;
 
-	guint32 flags;
+	CamelMimeFilterToHTMLFlags flags;
 	guint32 color;
 
 	guint32 column   : 31;
@@ -62,7 +62,7 @@ struct _CamelMimeFilterToHTMLPrivate {
 #define CONVERT_ADDRSPEC  CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES
 
 static struct {
-	guint mask;
+	CamelMimeFilterToHTMLFlags mask;
 	urlpattern_t pattern;
 } patterns[] = {
 	{ CONVERT_WEB_URLS, { "file://",   "",        camel_url_file_start,     camel_url_file_end     } },
@@ -502,7 +502,7 @@ camel_mime_filter_tohtml_init (CamelMimeFilterToHTML *filter)
  * Returns: a new #CamelMimeFilterToHTML object
  **/
 CamelMimeFilter *
-camel_mime_filter_tohtml_new (guint32 flags,
+camel_mime_filter_tohtml_new (CamelMimeFilterToHTMLFlags flags,
                               guint32 color)
 {
 	CamelMimeFilter *filter;
@@ -537,7 +537,7 @@ camel_mime_filter_tohtml_new (guint32 flags,
  **/
 gchar *
 camel_text_to_html (const gchar *in,
-                    guint32 flags,
+                    CamelMimeFilterToHTMLFlags flags,
                     guint32 color)
 {
 	CamelMimeFilter *filter;
diff --git a/camel/camel-mime-filter-tohtml.h b/camel/camel-mime-filter-tohtml.h
index 836b3f9..5d70f27 100644
--- a/camel/camel-mime-filter-tohtml.h
+++ b/camel/camel-mime-filter-tohtml.h
@@ -27,6 +27,7 @@
 #ifndef CAMEL_MIME_FILTER_TOHTML_H
 #define CAMEL_MIME_FILTER_TOHTML_H
 
+#include <camel/camel-enums.h>
 #include <camel/camel-mime-filter.h>
 
 /* Standard GObject macros */
@@ -48,17 +49,6 @@
 	(G_TYPE_INSTANCE_GET_CLASS \
 	((obj), CAMEL_TYPE_MIME_FILTER_TOHTML, CamelMimeFilterToHTMLClass))
 
-#define CAMEL_MIME_FILTER_TOHTML_PRE               (1 << 0)
-#define CAMEL_MIME_FILTER_TOHTML_CONVERT_NL        (1 << 1)
-#define CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES    (1 << 2)
-#define CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS      (1 << 3)
-#define CAMEL_MIME_FILTER_TOHTML_MARK_CITATION     (1 << 4)
-#define CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES (1 << 5)
-#define CAMEL_MIME_FILTER_TOHTML_ESCAPE_8BIT       (1 << 6)
-#define CAMEL_MIME_FILTER_TOHTML_CITE              (1 << 7)
-#define CAMEL_MIME_FILTER_TOHTML_PRESERVE_8BIT     (1 << 8)
-#define CAMEL_MIME_FILTER_TOHTML_FORMAT_FLOWED     (1 << 9)
-
 G_BEGIN_DECLS
 
 typedef struct _CamelMimeFilterToHTML CamelMimeFilterToHTML;
@@ -76,13 +66,13 @@ struct _CamelMimeFilterToHTMLClass {
 
 GType		camel_mime_filter_tohtml_get_type (void);
 CamelMimeFilter *
-		camel_mime_filter_tohtml_new	(guint32 flags,
+		camel_mime_filter_tohtml_new	(CamelMimeFilterToHTMLFlags flags,
 						 guint32 color);
 
 /* utility functions to replace e_text_to_html */
 
 gchar *		camel_text_to_html		(const gchar *in,
-						 guint32 flags,
+						 CamelMimeFilterToHTMLFlags flags,
 						 guint32 color);
 
 G_END_DECLS
diff --git a/docs/reference/camel/camel-sections.txt b/docs/reference/camel/camel-sections.txt
index 7645f03..bc11ff9 100644
--- a/docs/reference/camel/camel-sections.txt
+++ b/docs/reference/camel/camel-sections.txt
@@ -1475,16 +1475,7 @@ CamelMimeFilterSavePrivate
 <FILE>camel-mime-filter-tohtml</FILE>
 <TITLE>CamelMimeFilterToHTML</TITLE>
 CamelMimeFilterToHTML
-CAMEL_MIME_FILTER_TOHTML_PRE
-CAMEL_MIME_FILTER_TOHTML_CONVERT_NL
-CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES
-CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS
-CAMEL_MIME_FILTER_TOHTML_MARK_CITATION
-CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES
-CAMEL_MIME_FILTER_TOHTML_ESCAPE_8BIT
-CAMEL_MIME_FILTER_TOHTML_CITE
-CAMEL_MIME_FILTER_TOHTML_PRESERVE_8BIT
-CAMEL_MIME_FILTER_TOHTML_FORMAT_FLOWED
+CamelMimeFilterToHTMLFlags
 camel_mime_filter_tohtml_new
 camel_text_to_html
 <SUBSECTION Standard>



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