e-file-utils: Evolution Utilities Reference Manual

## e-file-utils e-file-utils |

## Functions

EActivity * | e_file_replace_contents_async ()
gboolean | e_file_replace_contents_finish ()

## Description

## Functions

### e_file_replace_contents_async ()

    EActivity *
    e_file_replace_contents_async (GFile *file,
                                   const gchar *contents,
                                   gsize length,
                                   const gchar *etag,
                                   gboolean make_backup,
                                   GFileCreateFlags flags,
                                   GAsyncReadyCallback callback,
                                   gpointer user_data);

This is a wrapper for `g_file_replace_contents_async()` that also returns an EActivity to track the file operation. Cancelling the activity will cancel the file operation. See `g_file_replace_contents_async()` for more details.

#### Parameters

file | input GFile |
contents | string of contents to replace the file with |
length | the length of `contents` in bytes |
etag | a new entity tag for the `file` , or `NULL` |
make_backup | `TRUE` if a backup should be created |
flags | a set of GFileCreateFlags |
callback | a GAsyncReadyCallback to call when the request is satisfied |
user_data | the data to pass to the callback function |

#### Returns

an EActivity for the file operation

### e_file_replace_contents_finish ()

    gboolean
    e_file_replace_contents_finish (GFile *file,
                                    GAsyncResult *result,
                                    gchar **new_etag,
                                    GError **error);

Finishes an asynchronous replace of the given `file` . See `e_file_replace_contents_async()`. Sets `new_etag` to the new entity tag for the document, if present. Free it with `g_free()` when it is no longer needed.

#### Parameters

file | input GFile |
result | a GAsyncResult |
new_etag | return location for a new entity tag |
error | return location for a GError, or `NULL` |

#### Returns

`TRUE` on success, `FALSE` on failure