GObject.signal_new
Description: Reference for GObject.signal_new

### Function

# GObjectsignal_new

#### Declaration [src]

    guint
    g_signal_new (
      const gchar* signal_name,
      GType itype,
      GSignalFlags signal_flags,
      guint class_offset,
      GSignalAccumulator accumulator,
      gpointer accu_data,
      GSignalCMarshaller c_marshaller,
      GType return_type,
      guint n_params,
      ...
    )

#### Description [src]

Creates a new signal. (This is usually done in the class initializer.)

A signal name consists of segments consisting of ASCII letters and digits, separated by either the `-` or `_` character. The first character of a signal name must be a letter. Names which violate these rules lead to undefined behaviour. These are the same rules as for property naming (see g_param_spec_internal()).

When registering a signal and looking up a signal, either separator can be used, but they cannot be mixed. Using `-` is considerably more efficient. Using `_` is discouraged.

If 0 is used for `class_offset` subclasses cannot override the class handler in their class_init method by doing super_class->signal_handler = my_signal_handler. Instead they will have to use g_signal_override_class_handler().

If `c_marshaller` is `NULL`, `g_cclosure_marshal_generic()` will be used as the marshaller for this signal. In some simple cases, `g_signal_new()` will use a more optimized c_marshaller and va_marshaller for the signal instead of g_cclosure_marshal_generic().

If `c_marshaller` is non-`NULL`, you need to also specify a va_marshaller using `g_signal_set_va_marshaller()` or the generic va_marshaller will be used.

This function is not directly available to language bindings.

#### Parameters

`signal_name`

  Type: `const gchar*`

  The name for the signal.

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

`itype`

  Type: `GType`

  The type this signal pertains to. It will also pertain to types which are derived from this type.

`signal_flags`

  Type: `GSignalFlags`

  A combination of `GSignalFlags` specifying detail of when the default handler is to be invoked. You should at least specify `G_SIGNAL_RUN_FIRST` or `G_SIGNAL_RUN_LAST`.

`class_offset`

  Type: `guint`

  The offset of the function pointer in the class structure for this type. Used to invoke a class method generically. Pass 0 to not associate a class method slot with this signal.

`accumulator`

  Type: `GSignalAccumulator`

  The accumulator for this signal; may be `NULL`.

  The argument can be `NULL`.

`accu_data`

  Type: `gpointer`

  User data for the `accumulator`.

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

`c_marshaller`

  Type: `GSignalCMarshaller`

  The function to translate arrays of parameter values to signal emissions into C language callback invocations or `NULL`.

  The argument can be `NULL`.

`return_type`

  Type: `GType`

  The type of return value, or `G_TYPE_NONE` for a signal without a return value.

`n_params`

  Type: `guint`

  The number of parameter types to follow.

`...`

  Type: ``

  A list of types, one for each parameter.

#### Return value

Type: `guint`

The signal id.