EBackend.SourceRegistryServer.find_extension

### Method

# EBackend SourceRegistryServerfind_extension

since: 3.8

#### Declaration [src]

    ESource*
    e_source_registry_server_find_extension (
      ESourceRegistryServer* server,
      ESource* source,
      const gchar* extension_name
    )

#### Description [src]

Examines `source` and its ancestors and returns the “deepest” `ESource` having an `ESourceExtension` with the given `extension_name`. If neither `source` nor any of its ancestors have such an extension, the function returns `NULL`.

This function is useful in cases when an `ESourceExtension` is meant to apply to both the `ESource` it belongs to and the `ESource`‘s descendants.

A common example is the `ESourceCollection` extension, where descendants of an `ESource` having an `ESourceCollection` extension are implied to be members of that collection. In that example, this function can be used to test whether `source` is a member of a collection.

The returned `ESource` is referenced for thread-safety and must be unreferenced with `g_object_unref()` when finished with it.

Note the function returns the `ESource` containing the `ESourceExtension` instead of the `ESourceExtension` itself because extension instances are not to be referenced directly (see e_source_get_extension()).

Available since: 3.8

#### Parameters

`source`

  Type: `ESource`

  An `ESource`.

  The data is owned by the caller of the method.

`extension_name`

  Type: `const gchar*`

  The extension name to find.

  The data is owned by the caller of the method.
  The value is a NUL terminated UTF-8 string.

#### Return value

Type: `ESource`

An `ESource`, or `NULL` if no match was found.

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