Constructor

GObjectObjectnew_with_properties

since: 2.54

Declaration [src]

GObject*
g_object_new_with_properties (
  GType object_type,
  guint n_properties,
  const char** names,
  const GValue* values
)

Description [src]

Creates a new instance of a GObject subtype and sets its properties using the provided arrays. Both arrays must have exactly n_properties elements, and the names and values correspond by index.

Construction parameters (see G_PARAM_CONSTRUCT, G_PARAM_CONSTRUCT_ONLY) which are not explicitly specified are set to their default values.

Available since: 2.54

This constructor is not directly available to language bindings.

Parameters

object_type

Type: GType

The object type to instantiate.

n_properties

Type: guint

The number of properties.

names

Type: An array of char*

The names of each property to be set.

The length of the array is specified in the n_properties argument.
The data is owned by the caller of the function.
Each element is a NUL terminated UTF-8 string.
values

Type: An array of GValue

The values of each property to be set.

The length of the array is specified in the n_properties argument.
The data is owned by the caller of the function.

Return value

Type: GObject

A new instance of object_type.

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