aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-format-html.h
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@src.gnome.org>2009-02-19 09:36:04 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2009-02-19 09:36:04 +0800
commitfd564be3203400024147469faaa7de0884861566 (patch)
tree80e69ff89307a7393193520e0f2fe51cdc21540e /mail/em-format-html.h
parent7ed5f59771262651ee8b0d29a123e43a6ac0b6c6 (diff)
downloadgsoc2013-evolution-fd564be3203400024147469faaa7de0884861566.tar
gsoc2013-evolution-fd564be3203400024147469faaa7de0884861566.tar.gz
gsoc2013-evolution-fd564be3203400024147469faaa7de0884861566.tar.bz2
gsoc2013-evolution-fd564be3203400024147469faaa7de0884861566.tar.lz
gsoc2013-evolution-fd564be3203400024147469faaa7de0884861566.tar.xz
gsoc2013-evolution-fd564be3203400024147469faaa7de0884861566.tar.zst
gsoc2013-evolution-fd564be3203400024147469faaa7de0884861566.zip
Clean up the EMFormat stack. Add some GObject properties to bind to.
Add some handy color conversion functions to e-util. svn path=/branches/kill-bonobo/; revision=37290
Diffstat (limited to 'mail/em-format-html.h')
-rw-r--r--mail/em-format-html.h183
1 files changed, 120 insertions, 63 deletions
diff --git a/mail/em-format-html.h b/mail/em-format-html.h
index a74432fdd9..33d60ae19a 100644
--- a/mail/em-format-html.h
+++ b/mail/em-format-html.h
@@ -25,24 +25,42 @@
Concrete class for formatting mails to html
*/
-#ifndef _EM_FORMAT_HTML_H
-#define _EM_FORMAT_HTML_H
-
-#include "mail/em-format.h"
+#ifndef EM_FORMAT_HTML_H
+#define EM_FORMAT_HTML_H
+
+#include <mail/em-format.h>
+#include <mail/mail-config.h>
+#include <camel/camel-medium.h>
+#include <camel/camel-mime-part.h>
+#include <camel/camel-stream.h>
+#include <camel/camel-url.h>
+#include <gtkhtml/gtkhtml.h>
+#include <gtkhtml/gtkhtml-embedded.h>
+
+/* Standard GObject macros */
+#define EM_TYPE_FORMAT_HTML \
+ (em_format_html_get_type ())
+#define EM_FORMAT_HTML(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), EM_TYPE_FORMAT_HTML, EMFormatHTML))
+#define EM_FORMAT_HTML_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), EM_TYPE_FORMAT_HTML, EMFormatHTMLClass))
+#define EM_IS_FORMAT_HTML(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), EM_TYPE_FORMAT_HTML))
+#define EM_IS_FORMAT_HTML_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), EM_TYPE_FORMAT_HTML))
+#define EM_FORMAT_HTML_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), EM_TYPE_FORMAT_HTML, EMFormatHTMLClass))
+
+G_BEGIN_DECLS
typedef struct _EMFormatHTML EMFormatHTML;
typedef struct _EMFormatHTMLClass EMFormatHTMLClass;
-
-#if 0
-struct _EMFormatHTMLHandler {
- EFrormatHandler base;
-};
-#endif
-
-struct _GtkHTMLEmbedded;
-struct _CamelMimePart;
-struct _CamelMedium;
-struct _CamelStream;
+typedef struct _EMFormatHTMLPrivate EMFormatHTMLPrivate;
enum _em_format_html_header_flags {
EM_FORMAT_HTML_HEADER_TO = 1<<0,
@@ -55,9 +73,19 @@ typedef enum {
EM_FORMAT_HTML_STATE_RENDERING
} EMFormatHTMLState;
-/* A HTMLJob will be executed in another thread, in sequence,
+typedef enum {
+ EM_FORMAT_HTML_COLOR_BODY, /* header area background */
+ EM_FORMAT_HTML_COLOR_CITATION, /* citation font color */
+ EM_FORMAT_HTML_COLOR_CONTENT, /* message area background */
+ EM_FORMAT_HTML_COLOR_FRAME, /* frame around message area */
+ EM_FORMAT_HTML_COLOR_HEADER, /* header font color */
+ EM_FORMAT_HTML_COLOR_TEXT, /* message font color */
+ EM_FORMAT_HTML_NUM_COLOR_TYPES
+} EMFormatHTMLColorType;
+
+/* A HTMLJob will be executed in another thread, in sequence.
It's job is to write to its stream, close it if successful,
- then exit */
+ then exit. */
typedef struct _EMFormatHTMLJob EMFormatHTMLJob;
@@ -85,21 +113,21 @@ typedef struct _EMFormatHTMLJob EMFormatHTMLJob;
* may be used to allocate these.
**/
struct _EMFormatHTMLJob {
- struct _EMFormatHTMLJob *next;
- struct _EMFormatHTMLJob *prev;
+ EMFormatHTMLJob *next;
+ EMFormatHTMLJob *prev;
EMFormatHTML *format;
- struct _CamelStream *stream;
+ CamelStream *stream;
/* We need to track the state of the visibility tree at
the point this uri was generated */
struct _EMFormatPURITree *puri_level;
- struct _CamelURL *base;
+ CamelURL *base;
- void (*callback)(struct _EMFormatHTMLJob *job, int cancelled);
+ void (*callback)(EMFormatHTMLJob *job, int cancelled);
union {
char *uri;
- struct _CamelMedium *msg;
+ CamelMedium *msg;
EMFormatPURI *puri;
struct _EMFormatPURITree *puri_level;
void *data;
@@ -109,7 +137,7 @@ struct _EMFormatHTMLJob {
/* Pending object (classid: url) */
typedef struct _EMFormatHTMLPObject EMFormatHTMLPObject;
-typedef gboolean (*EMFormatHTMLPObjectFunc)(EMFormatHTML *md, struct _GtkHTMLEmbedded *eb, EMFormatHTMLPObject *pobject);
+typedef gboolean (*EMFormatHTMLPObjectFunc)(EMFormatHTML *md, GtkHTMLEmbedded *eb, EMFormatHTMLPObject *pobject);
/**
* struct _EMFormatHTMLPObject - Pending object.
@@ -130,16 +158,16 @@ typedef gboolean (*EMFormatHTMLPObjectFunc)(EMFormatHTML *md, struct _GtkHTMLEmb
* em_format_html_add_pobject() may be used to allocate these.
**/
struct _EMFormatHTMLPObject {
- struct _EMFormatHTMLPObject *next;
- struct _EMFormatHTMLPObject *prev;
+ EMFormatHTMLPObject *next;
+ EMFormatHTMLPObject *prev;
- void (*free)(struct _EMFormatHTMLPObject *);
- struct _EMFormatHTML *format;
+ void (*free)(EMFormatHTMLPObject *);
+ EMFormatHTML *format;
char *classid;
EMFormatHTMLPObjectFunc func;
- struct _CamelMimePart *part;
+ CamelMimePart *part;
};
#define EM_FORMAT_HTML_HEADER_NOCOLUMNS (EM_FORMAT_HEADER_LAST)
@@ -178,26 +206,16 @@ struct _EMFormatHTMLPObject {
* multipart/related objects and inline images.
**/
struct _EMFormatHTML {
- EMFormat format;
+ EMFormat parent;
+ EMFormatHTMLPrivate *priv;
- struct _EMFormatHTMLPrivate *priv;
-
- struct _GtkHTML *html;
+ GtkHTML *html;
EDList pending_object_list;
GSList *headers;
guint32 text_html_flags; /* default flags for text to html conversion */
- guint32 body_colour; /* header box colour */
- guint32 header_colour;
- guint32 text_colour;
- guint32 frame_colour;
- guint32 content_colour;
- guint32 citation_colour;
- unsigned int load_http:2;
- unsigned int load_http_now:1;
- unsigned int mark_citations:1;
unsigned int simple_headers:1; /* simple header format, no box/table */
unsigned int hide_headers:1; /* no headers at all */
unsigned int show_icon:1; /* show an icon when the sender used Evo */
@@ -207,30 +225,69 @@ struct _EMFormatHTML {
};
struct _EMFormatHTMLClass {
- EMFormatClass format_class;
-
+ EMFormatClass parent_class;
};
-GType em_format_html_get_type(void);
-EMFormatHTML *em_format_html_new(void);
-
-void em_format_html_load_http(EMFormatHTML *emf);
-
-void em_format_html_set_load_http(EMFormatHTML *emf, int style);
-void em_format_html_set_mark_citations(EMFormatHTML *emf, int state, guint32 citation_colour);
+GType em_format_html_get_type (void);
+EMFormatHTML * em_format_html_new (void);
+void em_format_html_load_images (EMFormatHTML *efh);
+void em_format_html_get_color (EMFormatHTML *efh,
+ EMFormatHTMLColorType type,
+ GdkColor *color);
+void em_format_html_set_color (EMFormatHTML *efh,
+ EMFormatHTMLColorType type,
+ const GdkColor *color);
+MailConfigHTTPMode
+ em_format_html_get_image_loading_policy
+ (EMFormatHTML *efh);
+void em_format_html_set_image_loading_policy
+ (EMFormatHTML *efh,
+ MailConfigHTTPMode policy);
+gboolean em_format_html_get_mark_citations
+ (EMFormatHTML *efh);
+void em_format_html_set_mark_citations
+ (EMFormatHTML *efh,
+ gboolean mark_citations);
+gboolean em_format_html_get_only_local_photos
+ (EMFormatHTML *efh);
+void em_format_html_set_only_local_photos
+ (EMFormatHTML *efh,
+ gboolean only_local_photos);
+gboolean em_format_html_get_show_sender_photo
+ (EMFormatHTML *efh);
+void em_format_html_set_show_sender_photo
+ (EMFormatHTML *efh,
+ gboolean show_sender_photo);
/* retrieves a pseudo-part icon wrapper for a file */
-struct _CamelMimePart *em_format_html_file_part(EMFormatHTML *efh, const char *mime_type, const char *filename);
+CamelMimePart * em_format_html_file_part (EMFormatHTML *efh,
+ const gchar *mime_type,
+ const gchar *filename);
/* for implementers */
-EMFormatHTMLPObject *em_format_html_add_pobject(EMFormatHTML *efh, size_t size, const char *classid, struct _CamelMimePart *part, EMFormatHTMLPObjectFunc func);
-EMFormatHTMLPObject *em_format_html_find_pobject(EMFormatHTML *emf, const char *classid);
-EMFormatHTMLPObject *em_format_html_find_pobject_func(EMFormatHTML *emf, struct _CamelMimePart *part, EMFormatHTMLPObjectFunc func);
-void em_format_html_remove_pobject(EMFormatHTML *emf, EMFormatHTMLPObject *pobject);
-void em_format_html_clear_pobject(EMFormatHTML *emf);
-
-EMFormatHTMLJob *em_format_html_job_new(EMFormatHTML *emfh, void (*callback)(struct _EMFormatHTMLJob *job, int cancelled), void *data)
-;
-void em_format_html_job_queue(EMFormatHTML *emfh, struct _EMFormatHTMLJob *job);
-
-#endif /* ! EM_FORMAT_HTML_H */
+EMFormatHTMLPObject *
+ em_format_html_add_pobject (EMFormatHTML *efh,
+ size_t size,
+ const char *classid,
+ CamelMimePart *part,
+ EMFormatHTMLPObjectFunc func);
+EMFormatHTMLPObject *
+ em_format_html_find_pobject (EMFormatHTML *efh,
+ const char *classid);
+EMFormatHTMLPObject *
+ em_format_html_find_pobject_func(EMFormatHTML *efh,
+ CamelMimePart *part,
+ EMFormatHTMLPObjectFunc func);
+void em_format_html_remove_pobject (EMFormatHTML *efh,
+ EMFormatHTMLPObject *pobject);
+void em_format_html_clear_pobject (EMFormatHTML *efh);
+EMFormatHTMLJob *
+ em_format_html_job_new (EMFormatHTML *efh,
+ void (*callback)(EMFormatHTMLJob *job, int cancelled),
+ void *data);
+void em_format_html_job_queue (EMFormatHTML *efh,
+ EMFormatHTMLJob *job);
+
+G_END_DECLS
+
+#endif /* EM_FORMAT_HTML_H */