Constructor

GObjectObjectnew_with_properties

Declaration

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

Description

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

Parameters

object_type GType
 

The object type to instantiate.

n_properties guint
 

The number of properties.

names 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.
values 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

Returns: GObject
 

A new instance of object_type.

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