CamelOperation: Camel Reference Manual

## CamelOperation CamelOperation |

## Functions

GCancellable * | camel_operation_new ()
GCancellable * | camel_operation_new_proxy ()
void | camel_operation_cancel_all ()
void | camel_operation_push_message ()
void | camel_operation_pop_message ()
void | camel_operation_progress ()

## Signals

void | pop-message | Run Last
void | progress | Run Last
void | push-message | Run Last
void | status | Run Last

## Object Hierarchy

        GObject
        ╰── GCancellable
            ╰── CamelOperation

## Description

## Functions

### camel_operation_new ()

    GCancellable *
    camel_operation_new (void);

Create a new camel operation handle. Camel operation handles can be used in a multithreaded application (or a single operation handle can be used in a non threaded appliation) to cancel running operations and to obtain notification messages of the internal status of messages.

#### Returns

A new operation handle.

[transfer full]

### camel_operation_new_proxy ()

    GCancellable *
    camel_operation_new_proxy (GCancellable *cancellable);

Proxies the `cancellable` in a way that if it is cancelled, then the returned cancellable is also cancelled, but when the returned cancellable is cancelled, then it doesn't influence the original cancellable. Other CamelOperation actions being done on the returned cancellable are also propagated to the `cancellable` .

The passed-in `cancellable` can be `NULL`, in which case a plain CamelOperation is returned.

This is useful when some operation can be cancelled from elsewhere (like by a user), but also by the code on its own, when it doesn't make sense to cancel also any larger operation to which the passed-in cancellable belongs.

#### Parameters

cancellable | a GCancellable to proxy. | [nullable]

#### Returns

A new operation handle, proxying `cancellable` .

[transfer full]

Since: 3.24

### camel_operation_cancel_all ()

    void
    camel_operation_cancel_all (void);

Cancel all outstanding operations.

### camel_operation_push_message ()

    void
    camel_operation_push_message (GCancellable *cancellable,
                                  const gchar *format,
                                  ...);

Call this function to describe an operation being performed. Call `camel_operation_progress()` to report progress on the operation. Call `camel_operation_pop_message()` when the operation is complete.

This function only works if `cancellable` is a CamelOperation cast as a GCancellable. If `cancellable` is a plain GCancellable or `NULL`, the function does nothing and returns silently.

#### Parameters

cancellable | a GCancellable or `NULL` |
format | a standard `printf()` format string |
... | the parameters to insert into the format string |

### camel_operation_pop_message ()

    void
    camel_operation_pop_message (GCancellable *cancellable);

Pops the most recently pushed message.

This function only works if `cancellable` is a CamelOperation cast as a GCancellable. If `cancellable` is a plain GCancellable or `NULL`, the function does nothing and returns silently.

#### Parameters

cancellable | a GCancellable |

### camel_operation_progress ()

    void
    camel_operation_progress (GCancellable *cancellable,
                              gint percent);

Report progress on the current operation. `percent` reports the current percentage of completion, which should be in the range of 0 to 100.

This function only works if `cancellable` is a CamelOperation cast as a GCancellable. If `cancellable` is a plain GCancellable or `NULL`, the function does nothing and returns silently.

#### Parameters

cancellable | a GCancellable or `NULL` |
percent | percent complete, 0 to 100. |

## Signal Details

### The `“pop-message”` signal

    void
    user_function (CamelOperation *cameloperation,
                   gpointer        user_data)

Flags: Run Last

### The `“progress”` signal

    void
    user_function (CamelOperation *cameloperation,
                   int             arg1,
                   gpointer        user_data)

Flags: Run Last

### The `“push-message”` signal

    void
    user_function (CamelOperation *cameloperation,
                   char           *arg1,
                   gpointer        user_data)

Flags: Run Last

### The `“status”` signal

    void
    user_function (CamelOperation *cameloperation,
                   char           *arg1,
                   int             arg2,
                   gpointer        user_data)

Flags: Run Last