## EAlertSink

EAlertSink — an interface to handle alerts

## Functions

void | e_alert_sink_submit_alert ()
void | (*EAlertSinkThreadJobFunc) ()
struct _EActivity * | e_alert_sink_submit_thread_job ()
void | e_alert_sink_thread_job_set_alert_ident ()
void | e_alert_sink_thread_job_set_alert_arg_0 ()

## Types and Values

| EAlertSinkThreadJobData

## Object Hierarchy

        GInterface
        ╰── EAlertSink

## Includes

    #include <e-util/e-util.h>

## Description

A widget that implements EAlertSink means it can handle EAlerts, usually by displaying them to the user.

## Functions

### e_alert_sink_submit_alert ()

    void
    e_alert_sink_submit_alert (EAlertSink *alert_sink,
                               EAlert *alert);

This function is a place to pass EAlert objects. Beyond that it has no well-defined behavior. It's up to the widget implementing the EAlertSink interface to decide what to do with them.

#### Parameters

alert_sink | an EAlertSink |
alert | an EAlert |

### EAlertSinkThreadJobFunc ()

    void
    (*EAlertSinkThreadJobFunc) (EAlertSinkThreadJobData *job_data,
                                gpointer user_data,
                                GCancellable *cancellable,
                                GError **error);

### e_alert_sink_submit_thread_job ()

    struct _EActivity *
    e_alert_sink_submit_thread_job (EAlertSink *alert_sink,
                                    const gchar *description,
                                    const gchar *alert_ident,
                                    const gchar *alert_arg_0,
                                    EAlertSinkThreadJobFunc func,
                                    gpointer user_data,
                                    GDestroyNotify free_user_data);

Runs the `func` in a dedicated thread. Any error is propagated to UI. The cancellable passed into the `func` is a CamelOperation, thus the caller can overwrite progress and description message on it.

#### Parameters

alert_sink | an EAlertSink instance |
description | user-friendly description of the job, to be shown in UI |
alert_ident | in case of an error, this alert identificator is used for EAlert construction |
alert_arg_0 | in case of an error, use this string as the first argument to the EAlert construction; the second argument is the actual error message; can be NULL, in which case only the error message is passed to the EAlert construction. | [allow-none]
func | function to be run in a dedicated thread |
user_data | custom data passed into `func` ; can be NULL. | [allow-none]
free_user_data | function to be called on `user_data` , when the job is over; can be NULL. | [allow-none]

#### Returns

Newly created EActivity on success. The caller is responsible to `g_object_unref()` it when done with it.

Note: The `free_user_data` , if set, is called in the main thread.

Note: This function should be called only from the main thread.

[transfer full]

Since: 3.16

### e_alert_sink_thread_job_set_alert_ident ()

    void
    e_alert_sink_thread_job_set_alert_ident
                                   (EAlertSinkThreadJobData *job_data,
                                    const gchar *alert_ident);

Change an alert identificator to be used for error reporting. This can be used within a thread function at `e_alert_sink_submit_thread_job()`, to overwrite the default error message, in case of a need to more fine-tuned infomation to a user being available.

See: e_alert_sink_thread_job_set_alert_arg_0

#### Parameters

job_data | Thread job data, as passed to a thread function specified at `e_alert_sink_submit_thread_job()` |
alert_ident | A new alert identificator to use; cannot be NULL |

Since: 3.16

### e_alert_sink_thread_job_set_alert_arg_0 ()

    void
    e_alert_sink_thread_job_set_alert_arg_0
                                   (EAlertSinkThreadJobData *job_data,
                                    const gchar *alert_arg_0);

Change an argument 0 for an alert to be used for error reporting. This can be used within a thread function at `e_alert_sink_submit_thread_job()`, to overwrite the default argument 0 of the erorr message. It might be usually used with combination of `e_alert_sink_thread_job_set_alert_ident()`.

#### Parameters

job_data | Thread job data, as passed to a thread function specified at `e_alert_sink_submit_thread_job()` |
alert_arg_0 | A new argument 0 of the alert; can be NULL, to unset the previously set value. | [allow-none]

Since: 3.16

## Types and Values

### EAlertSinkThreadJobData

    typedef struct _EAlertSinkThreadJobData EAlertSinkThreadJobData;