## ESourceMailSignature

ESourceMailSignature — ESource extension for email signatures

## Synopsis

    #include <libedataserver/libedataserver.h>

    #define             E_SOURCE_EXTENSION_MAIL_SIGNATURE
    struct              ESourceMailSignature;
    struct              ESourceMailSignatureClass;
    GFile *             e_source_mail_signature_get_file    (ESourceMailSignature *extension);
    const gchar *       e_source_mail_signature_get_mime_type
                                                            (ESourceMailSignature *extension);
    gchar *             e_source_mail_signature_dup_mime_type
                                                            (ESourceMailSignature *extension);
    void                e_source_mail_signature_set_mime_type
                                                            (ESourceMailSignature *extension,
                                                             const gchar *mime_type);
    gboolean            e_source_mail_signature_load_sync   (ESource *source,
                                                             gchar **contents,
                                                             gsize *length,
                                                             GCancellable *cancellable,
                                                             GError **error);
    void                e_source_mail_signature_load        (ESource *source,
                                                             gint io_priority,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            e_source_mail_signature_load_finish (ESource *source,
                                                             GAsyncResult *result,
                                                             gchar **contents,
                                                             gsize *length,
                                                             GError **error);
    gboolean            e_source_mail_signature_replace_sync
                                                            (ESource *source,
                                                             const gchar *contents,
                                                             gsize length,
                                                             GCancellable *cancellable,
                                                             GError **error);
    void                e_source_mail_signature_replace     (ESource *source,
                                                             const gchar *contents,
                                                             gsize length,
                                                             gint io_priority,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            e_source_mail_signature_replace_finish
                                                            (ESource *source,
                                                             GAsyncResult *result,
                                                             GError **error);
    gboolean            e_source_mail_signature_symlink_sync
                                                            (ESource *source,
                                                             const gchar *symlink_target,
                                                             GCancellable *cancellable,
                                                             GError **error);
    void                e_source_mail_signature_symlink     (ESource *source,
                                                             const gchar *symlink_target,
                                                             gint io_priority,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            e_source_mail_signature_symlink_finish
                                                            (ESource *source,
                                                             GAsyncResult *result,
                                                             GError **error);

## Description

The ESourceMailSignature extension refers to a personalized email signature.

Access the extension as follows:

    1
    2
    3
    4
    5

    #include <libedataserver/libedataserver.h>

    ESourceMailSignature *extension;

    extension = e_source_get_extension (source, E_SOURCE_EXTENSION_MAIL_SIGNATURE);

## Details

### E_SOURCE_EXTENSION_MAIL_SIGNATURE

    #define E_SOURCE_EXTENSION_MAIL_SIGNATURE "Mail Signature"

Pass this extension name to `e_source_get_extension()` to access ESourceMailSignature. This is also used as a group name in key files.

Since 3.6

### struct ESourceMailSignature

    struct ESourceMailSignature {
    	ESourceExtension parent;
    	ESourceMailSignaturePrivate *priv;
    };

Contains only private data that should be read and manipulated using the function below.

Since 3.6

### struct ESourceMailSignatureClass

    struct ESourceMailSignatureClass {
    	ESourceExtensionClass parent_class;
    };

### e_source_mail_signature_get_file ()

    GFile *             e_source_mail_signature_get_file    (ESourceMailSignature *extension);

Returns a GFile instance pointing to the signature file for `extension`. The signature file may be a regular file containing the static signature content, or it may be a symbolic link to an executable file that produces the signature content.

`e_source_mail_signature_load()` uses this to load the signature content.

`extension` : | an ESourceMailSignature
Returns : | a GFile. [transfer none]

Since 3.6

### e_source_mail_signature_get_mime_type ()

    const gchar *       e_source_mail_signature_get_mime_type
                                                            (ESourceMailSignature *extension);

Returns the MIME type of the signature content for `extension`, or `NULL` if it has not yet been determined.

`e_source_mail_signature_load()` sets this automatically if the MIME type has not yet been determined.

`extension` : | an ESourceMailSignature
Returns : | the MIME type of the signature content, or `NULL`

Since 3.6

### e_source_mail_signature_dup_mime_type ()

    gchar *             e_source_mail_signature_dup_mime_type
                                                            (ESourceMailSignature *extension);

Thread-safe variation of `e_source_mail_signature_get_mime_type()`. Use this function when accessing `extension` from multiple threads.

The returned string should be freed with `g_free()` when no longer needed.

`extension` : | an ESourceMailSignature
Returns : | a newly-allocated copy of "mime-type"

Since 3.6

### e_source_mail_signature_set_mime_type ()

    void                e_source_mail_signature_set_mime_type
                                                            (ESourceMailSignature *extension,
                                                             const gchar *mime_type);

Sets the MIME type of the signature content for `extension`.

`e_source_mail_signature_load()` sets this automatically if the MIME type has not yet been determined.

The internal copy of `mime_type` is automatically stripped of leading and trailing whitespace. If the resulting string is empty, `NULL` is set instead.

`extension` : | an ESourceMailSignature
`mime_type` : | a MIME type, or `NULL`. [allow-none]

Since 3.6

### e_source_mail_signature_load_sync ()

    gboolean            e_source_mail_signature_load_sync   (ESource *source,
                                                             gchar **contents,
                                                             gsize *length,
                                                             GCancellable *cancellable,
                                                             GError **error);

Loads a signature from the signature file for `source`, which is given by `e_source_mail_signature_get_file()`. The signature contents are placed in `contents`, and `length` is set to the size of the `contents` string. The `contents` string should be freed with `g_free()` when no longer needed.

If the signature file is executable, it will be executed and its output captured as the email signature content. If the signature file is not executable, the email signature content is read directly from the file.

`source` : | an ESource
`contents` : | return location for the signature content
`length` : | return location for the length of the signature content, or `NULL` if the length is not needed. [allow-none]
`cancellable` : | optional GCancellable object, or `NULL`. [allow-none]
`error` : | return location for a GError, or `NULL`
Returns : | `TRUE` on success, `FALSE` on failure

Since 3.6

### e_source_mail_signature_load ()

    void                e_source_mail_signature_load        (ESource *source,
                                                             gint io_priority,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Asynchronously loads a signature from the signature file for `source`, which is given by `e_source_mail_signature_get_file()`.

If the signature file is executable, it will be executed and its output captured as the email signature content. If the signature file is not executable, the email signature content is read directly from the file.

When the operation is finished, `callback` will be called. You can then call `e_source_mail_signature_load_finish()` to get the result of the operation.

`source` : | an ESource
`io_priority` : | the I/O priority of the request
`cancellable` : | optional GCancellable object, or `NULL`. [allow-none]
`callback` : | a GAsyncReadyCallback to call when the request is satisfied. [scope async]
`user_data` : | data to pass to the callback function. [closure]

Since 3.6

### e_source_mail_signature_load_finish ()

    gboolean            e_source_mail_signature_load_finish (ESource *source,
                                                             GAsyncResult *result,
                                                             gchar **contents,
                                                             gsize *length,
                                                             GError **error);

Finishes an operation started with `e_source_mail_signature_load()`. The signature file contents are placed in `contents`, and `length` is set to the size of the `contents` string. The `contents` string should be freed with `g_free()` when no longer needed.

`source` : | an ESource
`result` : | a GAsyncResult
`contents` : | return location for the signature content
`length` : | return location for the length of the signature content, or `NULL` if the length is not needed. [allow-none]
`error` : | return location for a GError, or `NULL`
Returns : | `TRUE` on success, `FALSE` on failure

Since 3.6

### e_source_mail_signature_replace_sync ()

    gboolean            e_source_mail_signature_replace_sync
                                                            (ESource *source,
                                                             const gchar *contents,
                                                             gsize length,
                                                             GCancellable *cancellable,
                                                             GError **error);

Replaces the signature file for `source` with the given `contents` of `length` bytes. The signature file for `source` is given by `e_source_mail_signature_get_file()`.

`source` : | an ESource
`contents` : | the signature contents
`length` : | the length of `contents` in bytes
`cancellable` : | optional GCancellable object, or `NULL`. [allow-none]
`error` : | return location for a GError, or `NULL`
Returns : | `TRUE` on success, `FALSE` on failure

Since 3.6

### e_source_mail_signature_replace ()

    void                e_source_mail_signature_replace     (ESource *source,
                                                             const gchar *contents,
                                                             gsize length,
                                                             gint io_priority,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Asynchrously replaces the signature file for `source` with the given `contents` of `length` bytes. The signature file for `source` is given by `e_source_mail_signature_get_file()`.

When the operation is finished, `callback` will be called. You can then call `e_source_mail_signature_replace_finish()` to get the result of the operation.

`source` : | an ESource
`contents` : | the signature contents
`length` : | the length of `contents` in bytes
`io_priority` : | the I/O priority of the request
`cancellable` : | optional GCancellable object, or `NULL`. [allow-none]
`callback` : | a GAsyncReadyCallback to call when the request is satisfied. [scope async]
`user_data` : | data to pass to the callback function. [closure]

Since 3.6

### e_source_mail_signature_replace_finish ()

    gboolean            e_source_mail_signature_replace_finish
                                                            (ESource *source,
                                                             GAsyncResult *result,
                                                             GError **error);

Finishes an operation started with `e_source_mail_signature_replace()`.

`source` : | an ESource
`result` : | a GAsyncResult
`error` : | return location for a GError, or `NULL`
Returns : | `TRUE` on success, `FALSE` on failure

Since 3.6

### e_source_mail_signature_symlink_sync ()

    gboolean            e_source_mail_signature_symlink_sync
                                                            (ESource *source,
                                                             const gchar *symlink_target,
                                                             GCancellable *cancellable,
                                                             GError **error);

Replaces the signature file for `source` with a symbolic link to `symlink_target`, which should be an executable file that prints a mail signature to standard output. The signature file for `source` is given by `e_source_mail_signature_get_file()`.

`source` : | an ESource
`symlink_target` : | executable filename to link to
`cancellable` : | optional GCancellable object, or `NULL`. [allow-none]
`error` : | return location for a GError, or `NULL`
Returns : | `TRUE` on success, `FALSE` on failure

Since 3.6

### e_source_mail_signature_symlink ()

    void                e_source_mail_signature_symlink     (ESource *source,
                                                             const gchar *symlink_target,
                                                             gint io_priority,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Asynchronously replaces the signature file for `source` with a symbolic link to `symlink_target`, which should be an executable file that prints a mail signature to standard output. The signature file for `source` is given by `e_source_mail_signature_get_file()`.

When the operation is finished, `callback` will be called. You can then call `e_source_mail_signature_symlink_finish()` to get the result of the operation.

`source` : | an ESource
`symlink_target` : | executable filename to link to
`io_priority` : | the I/O priority of the request
`cancellable` : | optional GCancellable object, or `NULL`. [allow-none]
`callback` : | a GAsyncReadyCallback to call when the request is satisfied. [scope async]
`user_data` : | data to pass to the callback function. [closure]

Since 3.6

### e_source_mail_signature_symlink_finish ()

    gboolean            e_source_mail_signature_symlink_finish
                                                            (ESource *source,
                                                             GAsyncResult *result,
                                                             GError **error);

Finishes an operation started with `e_source_mail_signature_symlink()`.

`source` : | an ESource
`result` : | a GAsyncResult
`error` : | return location for a GError, or `NULL`
Returns : | `TRUE` on success, `FALSE` on failure

Since 3.6