## EMailFormatterExtension

EMailFormatterExtension

## Synopsis

    struct              EMailFormatterExtension;
    gboolean            e_mail_formatter_extension_format   (EMailFormatterExtension *extension,
                                                             EMailFormatter *formatter,
                                                             EMailFormatterContext *context,
                                                             EMailPart *part,
                                                             CamelStream *stream,
                                                             GCancellable *cancellable);
    gboolean            e_mail_formatter_extension_has_widget
                                                            (EMailFormatterExtension *extension);
    GtkWidget *         e_mail_formatter_extension_get_widget
                                                            (EMailFormatterExtension *extension,
                                                             EMailPartList *context,
                                                             EMailPart *part,
                                                             GHashTable *params);

## Object Hierarchy

      GObject
       +----EMailFormatterExtension
             +----EMailFormatterPrintExtension
             +----EMailFormatterQuoteExtension

## Description

## Details

### struct EMailFormatterExtension

    struct EMailFormatterExtension;

The EMailFormatterExtension is an abstract class for all extensions for EMailFormatter.

### e_mail_formatter_extension_format ()

    gboolean            e_mail_formatter_extension_format   (EMailFormatterExtension *extension,
                                                             EMailFormatter *formatter,
                                                             EMailFormatterContext *context,
                                                             EMailPart *part,
                                                             CamelStream *stream,
                                                             GCancellable *cancellable);

A virtual function reimplemented in all mail formatter extensions. The function formats `part`, generated HTML (or other format that can be displayed to user) and writes it to the `stream`.

When the function is unable to format the `part` (either because it's broken or because it is a different mimetype then the extension is specialized for), the function will return `FALSE` indicating the EMailFormatter, that it should pick another extension.

Implementation of this function must be thread-safe.

`extension` : | an EMailFormatterExtension
`formatter` : | an EMailFormatter
`context` : | an EMailFormatterContext
`part` : | a EMailPart to be formatter
`stream` : | a CamelStream to which the output should be written
`cancellable` : | (allow-none) a GCancellable
Returns : | Returns `TRUE` when the `part` was successfully formatted and data were written to the `stream`, `FALSE` otherwise.

### e_mail_formatter_extension_has_widget ()

    gboolean            e_mail_formatter_extension_has_widget
                                                            (EMailFormatterExtension *extension);

Returns whether the extension can provide a GtkWidget.

`extension` : | an EMailFormatterExtension
Returns : | Returns `TRUE` when `extension` reimplements `get_widget()`, `FALSE` otherwise.

### e_mail_formatter_extension_get_widget ()

    GtkWidget *         e_mail_formatter_extension_get_widget
                                                            (EMailFormatterExtension *extension,
                                                             EMailPartList *context,
                                                             EMailPart *part,
                                                             GHashTable *params);

A virtual function reimplemented in some mail formatter extensions. The function should construct a GtkWidget for given `part`. The `params` hash table can contain additional parameters listed in the &lt;object&gt; HTML element that has requested the widget.

When `bind_dom_func` is not `NULL`, the callee will set a callback function which should be called when the webpage is completely rendered to setup bindings between DOM events and the widget.

`extension` : | an EMailFormatterExtension
`part` : | an EMailPart
`params` : | a GHashTable
Returns : | Returns a GtkWidget or `NULL`, when error occurs or given `extension` does not reimplement this method.