## GcrCollection GcrCollection — A collection of objects. |

## Functions

guint | gcr_collection_get_length ()
GList * | gcr_collection_get_objects ()
gboolean | gcr_collection_contains ()
void | gcr_collection_emit_added ()
void | gcr_collection_emit_removed ()

## Signals

void | added | Run Last
void | removed | Run Last

## Types and Values

| GcrCollection

## Object Hierarchy

        GInterface
        ╰── GcrCollection

## Prerequisites

GcrCollection requires GObject.

## Known Implementations

GcrCollection is implemented by GcrFilterCollection, GcrSimpleCollection and GcrUnionCollection.

## Description

A GcrCollection is used to group a set of objects. This is an abstract interface which can be used to determine which objects show up in a selector or other user interface element.

Use `gcr_simple_collection_new()` to create a concrete implementation of this interface which you can add objects to.

## Functions

### gcr_collection_get_length ()

    guint
    gcr_collection_get_length (GcrCollection *self);

Get the number of objects in this collection.

#### Parameters

self | The collection |

#### Returns

The number of objects.

### gcr_collection_get_objects ()

    GList *
    gcr_collection_get_objects (GcrCollection *self);

Get a list of the objects in this collection.

#### Parameters

self | The collection |

#### Returns

a list of the objects in this collection, which should be freed with `g_list_free()`.

[transfer container][element-type GObject.Object]

### gcr_collection_contains ()

    gboolean
    gcr_collection_contains (GcrCollection *self,
                             GObject *object);

Check whether the collection contains an object or not.

#### Parameters

self | the collection |
object | object to check |

#### Returns

whether the collection contains this object

### gcr_collection_emit_added ()

    void
    gcr_collection_emit_added (GcrCollection *self,
                               GObject *object);

Emit the “added” signal for the given object. This function is used by implementors of this interface.

#### Parameters

self | The collection |
object | The object that was added |

### gcr_collection_emit_removed ()

    void
    gcr_collection_emit_removed (GcrCollection *self,
                                 GObject *object);

Emit the “removed” signal for the given object. This function is used by implementors of this interface.

#### Parameters

self | The collection |
object | The object that was removed |

## Types and Values

### GcrCollection

    typedef struct _GcrCollection GcrCollection;

A GcrCollection is used to group a set of objects.

## Signal Details

### The `“added”` signal

    void
    user_function (GcrCollection *self,
                   GObject       *object,
                   gpointer       user_data)

This signal is emitted when an object is added to the collection.

#### Parameters

self | the collection |
object | object that was added. | [type GObject.Object]
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“removed”` signal

    void
    user_function (GcrCollection *self,
                   GObject       *object,
                   gpointer       user_data)

This signal is emitted when an object is removed from the collection.

#### Parameters

self | the collection |
object | object that was removed. | [type GObject.Object]
user_data | user data set when the signal handler was connected. |

Flags: Run Last