diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2013-06-04 21:33:42 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-06-05 01:10:02 +0800 |
commit | 552952d2cce32d2748339f380fbf34fea40c029b (patch) | |
tree | ffc8a7b6e9a246f33c6f930ac92fc9ba2124110a /em-format | |
parent | f925dac7c498cda34ac891c627b7ba3598fcd4f4 (diff) | |
download | gsoc2013-evolution-552952d2cce32d2748339f380fbf34fea40c029b.tar gsoc2013-evolution-552952d2cce32d2748339f380fbf34fea40c029b.tar.gz gsoc2013-evolution-552952d2cce32d2748339f380fbf34fea40c029b.tar.bz2 gsoc2013-evolution-552952d2cce32d2748339f380fbf34fea40c029b.tar.lz gsoc2013-evolution-552952d2cce32d2748339f380fbf34fea40c029b.tar.xz gsoc2013-evolution-552952d2cce32d2748339f380fbf34fea40c029b.tar.zst gsoc2013-evolution-552952d2cce32d2748339f380fbf34fea40c029b.zip |
Define GEnumClass types for mail formatter/parser enums.
Diffstat (limited to 'em-format')
-rw-r--r-- | em-format/Makefile.am | 30 | ||||
-rw-r--r-- | em-format/e-mail-formatter-enums.h | 90 | ||||
-rw-r--r-- | em-format/e-mail-formatter-quote.h | 6 | ||||
-rw-r--r-- | em-format/e-mail-formatter.c | 4 | ||||
-rw-r--r-- | em-format/e-mail-formatter.h | 39 | ||||
-rw-r--r-- | em-format/e-mail-parser-extension.h | 16 | ||||
-rw-r--r-- | em-format/e-mail-part.h | 10 |
7 files changed, 127 insertions, 68 deletions
diff --git a/em-format/Makefile.am b/em-format/Makefile.am index 5124c39e7a..2983eb0ecf 100644 --- a/em-format/Makefile.am +++ b/em-format/Makefile.am @@ -1,11 +1,31 @@ +privsolib_LTLIBRARIES = libevolution-mail-formatter.la + evolution_mail_formatter_includedir = $(privincludedir)/em-format -privsolib_LTLIBRARIES = libevolution-mail-formatter.la +ENUM_TYPES = e-mail-formatter-enums.h + +e-mail-formatter-enumtypes.h: $(top_srcdir)/enumtypes.h.template $(ENUM_TYPES) + $(AM_V_GEN) $(GLIB_MKENUMS) --template $(top_srcdir)/enumtypes.h.template \ + --fhead "#ifndef E_MAIL_FORMATTER_ENUMTYPES_H\n#define E_MAIL_FORMATTER_ENUMTYPES_H\n" \ + --ftail "#endif /* E_MAIL_FORMATTER_ENUMTYPES_H */\n" \ + $(addprefix $(srcdir)/,$(ENUM_TYPES)) > $@ + +e-mail-formatter-enumtypes.c: $(top_srcdir)/enumtypes.c.template $(ENUM_TYPES) + $(AM_V_GEN) $(GLIB_MKENUMS) --template $(top_srcdir)/enumtypes.c.template \ + --fhead "#include \"e-mail-formatter-enumtypes.h\"" \ + $(addprefix $(srcdir)/,$(ENUM_TYPES)) > $@ + +ENUM_GENERATED = \ + e-mail-formatter-enumtypes.c \ + e-mail-formatter-enumtypes.h \ + $(NULL) evolution_mail_formatter_include_HEADERS = \ e-mail-extension-registry.h \ e-mail-formatter-extension.h \ e-mail-formatter.h \ + e-mail-formatter-enums.h \ + e-mail-formatter-enumtypes.h \ e-mail-formatter-print.h \ e-mail-formatter-quote.h \ e-mail-formatter-utils.h \ @@ -48,6 +68,7 @@ libevolution_mail_formatter_la_SOURCES = \ e-mail-formatter-utils.c \ e-mail-formatter-attachment.c \ e-mail-formatter-attachment-bar.c \ + e-mail-formatter-enumtypes.c \ e-mail-formatter-error.c \ e-mail-formatter-extension.c \ e-mail-formatter-headers.c \ @@ -101,7 +122,6 @@ libevolution_mail_formatter_la_SOURCES = \ libevolution_mail_formatter_la_LDFLAGS = -avoid-version $(NO_UNDEFINED) - if ENABLE_SMIME SMIME_LIBS = \ $(top_builddir)/smime/lib/libessmime.la \ @@ -118,4 +138,10 @@ libevolution_mail_formatter_la_LIBADD = \ $(LIBSOUP_LIBS) \ $(SMIME_LIBS) +BUILT_SOURCES = \ + $(ENUM_GENERATED) \ + $(NULL) + +CLEANFILES = $(BUILT_SOURCES) + -include $(top_srcdir)/git.mk diff --git a/em-format/e-mail-formatter-enums.h b/em-format/e-mail-formatter-enums.h new file mode 100644 index 0000000000..e1b41d6cf6 --- /dev/null +++ b/em-format/e-mail-formatter-enums.h @@ -0,0 +1,90 @@ +/* + * e-mail-formatter-enums.h + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see <http://www.gnu.org/licenses/> + * + */ + +#ifndef E_MAIL_FORMATTER_ENUMS_H +#define E_MAIL_FORMATTER_ENUMS_H + +#include <glib.h> + +G_BEGIN_DECLS + +typedef enum { + E_MAIL_FORMATTER_COLOR_BODY, /* header area background */ + E_MAIL_FORMATTER_COLOR_CITATION, /* citation font color */ + E_MAIL_FORMATTER_COLOR_CONTENT, /* message area background */ + E_MAIL_FORMATTER_COLOR_FRAME, /* frame around message area */ + E_MAIL_FORMATTER_COLOR_HEADER, /* header font color */ + E_MAIL_FORMATTER_COLOR_TEXT, /* message font color */ + E_MAIL_FORMATTER_NUM_COLOR_TYPES /*< skip >*/ +} EMailFormatterColor; + +typedef enum { /*< flags >*/ + E_MAIL_FORMATTER_HEADER_FLAG_COLLAPSABLE = 1 << 0, + E_MAIL_FORMATTER_HEADER_FLAG_COLLAPSED = 1 << 1, + E_MAIL_FORMATTER_HEADER_FLAG_HTML = 1 << 2, + E_MAIL_FORMATTER_HEADER_FLAG_NOCOLUMNS = 1 << 3, + E_MAIL_FORMATTER_HEADER_FLAG_BOLD = 1 << 4, + E_MAIL_FORMATTER_HEADER_FLAG_NODEC = 1 << 5, + E_MAIL_FORMATTER_HEADER_FLAG_HIDDEN = 1 << 6, + E_MAIL_FORMATTER_HEADER_FLAG_NOLINKS = 1 << 7, + E_MAIL_FORMATTER_HEADER_FLAG_NOELIPSIZE = 1 << 8 +} EMailFormatterHeaderFlags; + +typedef enum { + E_MAIL_FORMATTER_MODE_INVALID = -1, + E_MAIL_FORMATTER_MODE_NORMAL = 0, + E_MAIL_FORMATTER_MODE_SOURCE, + E_MAIL_FORMATTER_MODE_RAW, + E_MAIL_FORMATTER_MODE_CID, + E_MAIL_FORMATTER_MODE_PRINTING, + E_MAIL_FORMATTER_MODE_ALL_HEADERS +} EMailFormatterMode; + +typedef enum { /*< flags >*/ + E_MAIL_FORMATTER_QUOTE_FLAG_CITE = 1 << 0, + E_MAIL_FORMATTER_QUOTE_FLAG_HEADERS = 1 << 1, + E_MAIL_FORMATTER_QUOTE_FLAG_KEEP_SIG = 1 << 2 /* do not strip signature */ +} EMailFormatterQuoteFlags; + +/** + * EMailParserExtensionFlags: + * @E_MAIL_PARSER_EXTENSION_INLINE: + * Don't parse as attachment. + * @E_MAIL_PARSER_EXTENSION_INLINE_DISPOSITION: + * Always expand. + * @E_MAIL_PARSER_EXTENSION_COMPOUND_TYPE: + * Always check what's inside. + **/ +typedef enum { /*< flags >*/ + E_MAIL_PARSER_EXTENSION_INLINE = 1 << 0, + E_MAIL_PARSER_EXTENSION_INLINE_DISPOSITION = 1 << 1, + E_MAIL_PARSER_EXTENSION_COMPOUND_TYPE = 1 << 2 +} EMailParserExtensionFlags; + +typedef enum { /*< flags >*/ + E_MAIL_PART_VALIDITY_NONE = 0, + E_MAIL_PART_VALIDITY_PGP = 1 << 0, + E_MAIL_PART_VALIDITY_SMIME = 1 << 1, + E_MAIL_PART_VALIDITY_SIGNED = 1 << 2, + E_MAIL_PART_VALIDITY_ENCRYPTED = 1 << 3 +} EMailPartValidityFlags; + +G_END_DECLS + +#endif /* E_MAIL_FORMATTER_ENUMS_H */ + diff --git a/em-format/e-mail-formatter-quote.h b/em-format/e-mail-formatter-quote.h index c8662612a5..3dac85f833 100644 --- a/em-format/e-mail-formatter-quote.h +++ b/em-format/e-mail-formatter-quote.h @@ -48,12 +48,6 @@ typedef struct _EMailFormatterQuoteClass EMailFormatterQuoteClass; typedef struct _EMailFormatterQuotePrivate EMailFormatterQuotePrivate; typedef struct _EMailFormatterQuoteContext EMailFormatterQuoteContext; -typedef enum { - E_MAIL_FORMATTER_QUOTE_FLAG_CITE = 1 << 0, - E_MAIL_FORMATTER_QUOTE_FLAG_HEADERS = 1 << 1, - E_MAIL_FORMATTER_QUOTE_FLAG_KEEP_SIG = 1 << 2 /* do not strip signature */ -} EMailFormatterQuoteFlags; - struct _EMailFormatterQuoteContext { EMailFormatterContext parent; diff --git a/em-format/e-mail-formatter.c b/em-format/e-mail-formatter.c index acb5c65b9d..6e022c1947 100644 --- a/em-format/e-mail-formatter.c +++ b/em-format/e-mail-formatter.c @@ -1158,7 +1158,7 @@ e_mail_formatter_get_text_format_flags (EMailFormatter *formatter) const GdkRGBA * e_mail_formatter_get_color (EMailFormatter *formatter, - EMailFormatterColorType type) + EMailFormatterColor type) { g_return_val_if_fail (E_IS_MAIL_FORMATTER (formatter), NULL); g_return_val_if_fail (type < E_MAIL_FORMATTER_NUM_COLOR_TYPES, NULL); @@ -1168,7 +1168,7 @@ e_mail_formatter_get_color (EMailFormatter *formatter, void e_mail_formatter_set_color (EMailFormatter *formatter, - EMailFormatterColorType type, + EMailFormatterColor type, const GdkRGBA *color) { GdkRGBA *format_color; diff --git a/em-format/e-mail-formatter.h b/em-format/e-mail-formatter.h index ca05e0fa64..ce20c4674d 100644 --- a/em-format/e-mail-formatter.h +++ b/em-format/e-mail-formatter.h @@ -23,6 +23,7 @@ #include <libemail-engine/e-mail-enums.h> #include <em-format/e-mail-extension-registry.h> +#include <em-format/e-mail-formatter-enums.h> #include <em-format/e-mail-part-list.h> /* Standard GObject macros */ @@ -46,38 +47,6 @@ G_BEGIN_DECLS; -typedef enum { - E_MAIL_FORMATTER_MODE_INVALID = -1, - E_MAIL_FORMATTER_MODE_NORMAL = 0, - E_MAIL_FORMATTER_MODE_SOURCE, - E_MAIL_FORMATTER_MODE_RAW, - E_MAIL_FORMATTER_MODE_CID, - E_MAIL_FORMATTER_MODE_PRINTING, - E_MAIL_FORMATTER_MODE_ALL_HEADERS -} EMailFormatterMode; - -typedef enum { - E_MAIL_FORMATTER_HEADER_FLAG_COLLAPSABLE = 1 << 0, - E_MAIL_FORMATTER_HEADER_FLAG_COLLAPSED = 1 << 1, - E_MAIL_FORMATTER_HEADER_FLAG_HTML = 1 << 2, - E_MAIL_FORMATTER_HEADER_FLAG_NOCOLUMNS = 1 << 3, - E_MAIL_FORMATTER_HEADER_FLAG_BOLD = 1 << 4, - E_MAIL_FORMATTER_HEADER_FLAG_NODEC = 1 << 5, - E_MAIL_FORMATTER_HEADER_FLAG_HIDDEN = 1 << 6, - E_MAIL_FORMATTER_HEADER_FLAG_NOLINKS = 1 << 7, - E_MAIL_FORMATTER_HEADER_FLAG_NOELIPSIZE = 1 << 8 -} EMailFormatterHeaderFlags; - -typedef enum { - E_MAIL_FORMATTER_COLOR_BODY, /* header area background */ - E_MAIL_FORMATTER_COLOR_CITATION, /* citation font color */ - E_MAIL_FORMATTER_COLOR_CONTENT, /* message area background */ - E_MAIL_FORMATTER_COLOR_FRAME, /* frame around message area */ - E_MAIL_FORMATTER_COLOR_HEADER, /* header font color */ - E_MAIL_FORMATTER_COLOR_TEXT, /* message font color */ - E_MAIL_FORMATTER_NUM_COLOR_TYPES -} EMailFormatterColorType; - typedef struct _EMailFormatter EMailFormatter; typedef struct _EMailFormatterClass EMailFormatterClass; typedef struct _EMailFormatterPrivate EMailFormatterPrivate; @@ -174,9 +143,9 @@ CamelMimeFilterToHTMLFlags (EMailFormatter *formatter); const GdkRGBA * e_mail_formatter_get_color (EMailFormatter *formatter, - EMailFormatterColorType type); -void e_mail_formatter_set_color (EMailFormatter *efh, - EMailFormatterColorType type, + EMailFormatterColor type); +void e_mail_formatter_set_color (EMailFormatter *formatter, + EMailFormatterColor type, const GdkRGBA *color); void e_mail_formatter_update_style (EMailFormatter *formatter, GtkStateFlags state); diff --git a/em-format/e-mail-parser-extension.h b/em-format/e-mail-parser-extension.h index c011df62ab..840f84dc3c 100644 --- a/em-format/e-mail-parser-extension.h +++ b/em-format/e-mail-parser-extension.h @@ -21,6 +21,7 @@ #include <camel/camel.h> #include <em-format/e-mail-parser.h> +#include <em-format/e-mail-formatter-enums.h> /* Standard GObject macros */ #define E_TYPE_MAIL_PARSER_EXTENSION \ @@ -48,21 +49,6 @@ typedef struct _EMailParserExtensionClass EMailParserExtensionClass; typedef struct _EMailParserExtensionPrivate EMailParserExtensionPrivate; /** - * EMailParserExtensionFlags: - * @E_MAIL_PARSER_EXTENSION_INLINE: - * Don't parse as attachment. - * @E_MAIL_PARSER_EXTENSION_INLINE_DISPOSITION: - * Always expand. - * @E_MAIL_PARSER_EXTENSION_COMPOUND_TYPE: - * Always check what's inside. - **/ -typedef enum { - E_MAIL_PARSER_EXTENSION_INLINE = 1 << 0, - E_MAIL_PARSER_EXTENSION_INLINE_DISPOSITION = 1 << 1, - E_MAIL_PARSER_EXTENSION_COMPOUND_TYPE = 1 << 2 -} EMailParserExtensionFlags; - -/** * EMailParserExtension: * * The #EMailParserExtension is an abstract interface for all extensions for diff --git a/em-format/e-mail-part.h b/em-format/e-mail-part.h index 6ead93b81b..f710f4021a 100644 --- a/em-format/e-mail-part.h +++ b/em-format/e-mail-part.h @@ -24,6 +24,8 @@ #include <e-util/e-util.h> +#include <em-format/e-mail-formatter-enums.h> + /* Standard GObject macros */ #define E_TYPE_MAIL_PART \ (e_mail_part_get_type ()) @@ -49,14 +51,6 @@ typedef struct _EMailPart EMailPart; typedef struct _EMailPartClass EMailPartClass; typedef struct _EMailPartPrivate EMailPartPrivate; -typedef enum { - E_MAIL_PART_VALIDITY_NONE = 0, - E_MAIL_PART_VALIDITY_PGP = 1 << 0, - E_MAIL_PART_VALIDITY_SMIME = 1 << 1, - E_MAIL_PART_VALIDITY_SIGNED = 1 << 2, - E_MAIL_PART_VALIDITY_ENCRYPTED = 1 << 3 -} EMailPartValidityFlags; - typedef struct _EMailPartValidityPair EMailPartValidityPair; struct _EMailPartValidityPair { |