EDataCal.CalMetaBackend.save_component_sync
Description: Reference for EDataCal.CalMetaBackend.save_component_sync

### Virtual Method

# EDataCal CalMetaBackendsave_component_sync

since: 3.26

#### Declaration [src]

    gboolean
    save_component_sync (
      ECalMetaBackend* meta_backend,
      gboolean overwrite_existing,
      EConflictResolution conflict_resolution,
      const GSList* instances,
      const gchar* extra,
      ECalOperationFlags opflags,
      gchar** out_new_uid,
      gchar** out_new_extra,
      GCancellable* cancellable,
      GError** error
    )

#### Description [src]

Saves one component into the remote side. The `instances` contain the master object and all the detached instances of the same component (all have the same UID). When the `overwrite_existing` is `TRUE`, then the descendant can overwrite an object with the same UID on the remote side (usually used for modify). The `conflict_resolution` defines what to do when the remote side had made any changes to the object since the last update.

The descendant can use `e_cal_meta_backend_merge_instances()` to merge the instances into one VCALENDAR component, which will contain also used time zones.

The components in `instances` have already converted locally stored attachments into inline attachments, thus it’s not needed to call `e_cal_meta_backend_inline_local_attachments_sync()` by the descendant.

The `out_new_uid` can be populated with a UID of the saved component as the server assigned it to it. This UID, if set, is loaded from the remote side afterwards, also to see whether any changes had been made to the component by the remote side.

The `out_new_extra` can be populated with a new extra data to save with the component. Left it `NULL`, to keep the same value as the `extra`.

The descendant can use an #E_CLIENT_ERROR_OUT_OF_SYNC error to indicate that the save failed due to made changes on the remote side, and let the `meta_backend` to resolve this conflict based on the `conflict_resolution` on its own. The #E_CLIENT_ERROR_OUT_OF_SYNC error should not be used when the descendant is able to resolve the conflicts itself.

It is mandatory to implement this virtual method by the writable descendant.

Available since: 3.26

#### Parameters

`overwrite_existing`

  Type: `gboolean`

  `TRUE` when can overwrite existing components, `FALSE` otherwise.

`conflict_resolution`

  Type: `EConflictResolution`

  One of `EConflictResolution`, what to do on conflicts.

`instances`

  Type: A list of `None`

  Instances of the component to save.

  The data is owned by the caller of the method.

`extra`

  Type: `const gchar*`

  Extra data saved with the components in an `ECalCache`.

  The argument can be `NULL`.
  The data is owned by the caller of the method.
  The value is a NUL terminated UTF-8 string.

`opflags`

  Type: `ECalOperationFlags`

  Bit-or of `ECalOperationFlags`.

`out_new_uid`

  Type: `gchar**`

  Return location for the UID of the saved component.

  The argument will be set by the function.
  The caller of the method takes ownership of the returned data, and is responsible for freeing it.
  The value is a NUL terminated UTF-8 string.

`out_new_extra`

  Type: `gchar**`

  Return location for the extra data to store with the component.

  The argument will be set by the function.
  The caller of the method takes ownership of the returned data, and is responsible for freeing it.
  The value is a NUL terminated UTF-8 string.

`cancellable`

  Type: `GCancellable`

  Optional `GCancellable` object, or `NULL`.

  The argument can be `NULL`.
  The data is owned by the caller of the method.

`error`

  Type: `GError **`

  The return location for a recoverable error.

  The argument can be `NULL`.
  If the return location is not `NULL`, then you must initialize it to a `NULL` `GError*`.
  The argument will be left initialized to `NULL` by the virtual function if there are no errors.
  In case of error, the argument will be set to a newly allocated `GError`; the caller will take ownership of the data, and be responsible for freeing it.

#### Return value

Type: `gboolean`

Whether succeeded.