ECal.Client.connect_sync
Description: Reference for ECal.Client.connect_sync

### Function

# ECal Clientconnect_sync

since: 3.8

#### Declaration [src]

    EClient*
    e_cal_client_connect_sync (
      ESource* source,
      ECalClientSourceType source_type,
      guint32 wait_for_connected_seconds,
      GCancellable* cancellable,
      GError** error
    )

#### Description [src]

Creates a new `ECalClient` for `source` and `source_type`. If an error occurs, the function will set `error` and return `FALSE`.

The `wait_for_connected_seconds` argument had been added since 3.16, to let the caller decide how long to wait for the backend to fully connect to its (possibly remote) data store. This is required due to a change in the authentication process, which is fully asynchronous and done on the client side, while not every client is supposed to response to authentication requests. In case the backend will not connect within the set interval, then it is opened in an offline mode. A special value -1 can be used to not wait for the connected state at all.

Unlike with e_cal_client_new(), there is no need to call `e_client_open_sync()` after obtaining the `ECalClient`.

For error handling convenience, any error message returned by this function will have a descriptive prefix that includes the display name of `source`.

Available since: 3.8

#### Parameters

`source`

  Type: `ESource`

  An `ESource`.

  The data is owned by the caller of the function.

`source_type`

  Type: `ECalClientSourceType`

  Source type of the calendar.

`wait_for_connected_seconds`

  Type: `guint32`

  Timeout, in seconds, to wait for the backend to be fully connected.

`cancellable`

  Type: `GCancellable`

  Optional `GCancellable` object, or `NULL`.

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

`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 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: `EClient`

A new `ECalClient`, or `NULL`.

The caller of the function takes ownership of the data, and is responsible for freeing it.
The return value can be `NULL`.