1 /* 2 * e-mail-formatter-extension.h 3 * 4 * This program is free software; you can redistribute it and/or modify it 5 * under the terms of the GNU Lesser General Public License as published by 6 * the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful, but 9 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 10 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 11 * for more details. 12 * 13 * You should have received a copy of the GNU Lesser General Public License 14 * along with this program; if not, see <http://www.gnu.org/licenses/>. 15 * 16 */ 17 18 #ifndef E_MAIL_FORMATTER_EXTENSION_H 19 #define E_MAIL_FORMATTER_EXTENSION_H 20 21 #include <gtk/gtk.h> 22 #include <camel/camel.h> 23 #include <em-format/e-mail-part.h> 24 #include <em-format/e-mail-formatter.h> 25 26 /* Standard GObject macros */ 27 #define E_TYPE_MAIL_FORMATTER_EXTENSION \ 28 (e_mail_formatter_extension_get_type ()) 29 #define E_MAIL_FORMATTER_EXTENSION(obj) \ 30 (G_TYPE_CHECK_INSTANCE_CAST \ 31 ((obj), E_TYPE_MAIL_FORMATTER_EXTENSION, EMailFormatterExtension)) 32 #define E_MAIL_FORMATTER_EXTENSION_CLASS(cls) \ 33 (G_TYPE_CHECK_CLASS_CAST \ 34 ((cls), E_TYPE_MAIL_FORMATTER_EXTENSION, EMailFormatterExtensionClass)) 35 #define E_IS_MAIL_FORMATTER_EXTENSION(obj) \ 36 (G_TYPE_CHECK_INSTANCE_TYPE \ 37 ((obj), E_TYPE_MAIL_FORMATTER_EXTENSION)) 38 #define E_IS_MAIL_FORMATTER_EXTENSION_CLASS(cls) \ 39 (G_TYPE_CHECK_CLASS_TYPE \ 40 ((cls), E_TYPE_MAIL_FORMATTER_EXTENSION)) 41 #define E_MAIL_FORMATTER_EXTENSION_GET_CLASS(obj) \ 42 (G_TYPE_INSTANCE_GET_CLASS \ 43 ((obj), E_TYPE_MAIL_FORMATTER_EXTENSION, EMailFormatterExtensionClass)) 44 45 G_BEGIN_DECLS 46 47 /** 48 * EMailFormatterExtension: 49 * 50 * The #EMailFormatterExtension is an abstract class for all extensions for 51 * #EMailFormatter. 52 */ 53 typedef struct _EMailFormatterExtension EMailFormatterExtension; 54 typedef struct _EMailFormatterExtensionClass EMailFormatterExtensionClass; 55 typedef struct _EMailFormatterExtensionPrivate EMailFormatterExtensionPrivate; 56 57 struct _EMailFormatterExtension { 58 GObject parent; 59 EMailFormatterExtensionPrivate *priv; 60 }; 61 62 struct _EMailFormatterExtensionClass { 63 GObjectClass parent_class; 64 65 /* This is a short name for the extension (optional). */ 66 const gchar *display_name; 67 68 /* This is a longer description of the extension (optional). */ 69 const gchar *description; 70 71 /* This is a NULL-terminated array of supported MIME types. 72 * The MIME types can be exact (e.g. "text/plain") or use a 73 * wildcard (e.g. "text/ *"). */ 74 const gchar **mime_types; 75 76 /* This is used to prioritize extensions with identical MIME 77 * types. Lower values win. Defaults to G_PRIORITY_DEFAULT. */ 78 gint priority; 79 80 gboolean (*format) (EMailFormatterExtension *extension, 81 EMailFormatter *formatter, 82 EMailFormatterContext *context, 83 EMailPart *part, 84 GOutputStream *stream, 85 GCancellable *cancellable); 86 }; 87 88 GType e_mail_formatter_extension_get_type 89 (void) G_GNUC_CONST; 90 gboolean e_mail_formatter_extension_format 91 (EMailFormatterExtension *extension, 92 EMailFormatter *formatter, 93 EMailFormatterContext *context, 94 EMailPart *part, 95 GOutputStream *stream, 96 GCancellable *cancellable); 97 98 G_END_DECLS 99 100 #endif /* E_MAIL_FORMATTER_EXTENSION_H */ 101