### Function

# GLib Source new

#### Declaration [src]

    GSource*
    g_source_new (
      GSourceFuncs* source_funcs,
      guint struct_size
    )

#### Description [src]

Creates a new `GSource` structure. The size is specified to allow creating structures derived from `GSource` that contain additional data. The size passed in must be at least `sizeof (GSource)`.

The source will not initially be associated with any `GMainContext` and must be added to one with `g_source_attach()` before it will be executed.

#### Parameters

`source_funcs`

  Type: `GSourceFuncs`

  Structure containing functions that implement the sources behavior.

  The data is owned by the caller of the function.

`struct_size`

  Type: `guint`

  Size of the `GSource` structure to create.

#### Return value

Type: `GSource`

The newly-created `GSource`.

The caller of the function takes ownership of the data, and is responsible for freeing it.