@new


Description:

public static Object @new (Type type, ...)

Creates a new instance of a Object subtype and sets its properties.

Construction parameters (see g_param_construct, g_param_construct_only ) which are not explicitly specified are set to their default values. Any private data for the object is guaranteed to be initialized with zeros, as per g_type_create_instance.

Note that in C, small integer types in variable argument lists are promoted up to int or Signal as appropriate, and read back accordingly. int is 32 bits on every platform on which GLib is currently supported. This means that you can use C expressions of type int with @new and properties of type int or Signal or smaller. Specifically, you can use integer literals with these property types.

When using property types of int64 or uint64, you must ensure that the value that you provide is 64 bit. This means that you should use a cast or make use of the g_gint64_constant or g_guint64_constant macros.

Similarly, float is promoted to double, so you must ensure that the value you provide is a double, even for a property of type float.

Since GLib 2.72, all Objects are guaranteed to be aligned to at least the alignment of the largest basic GLib type (typically this is uint64 or double). If you need larger alignment for an element in a Object, you should allocate it on the heap (aligned), or arrange for your Object to be appropriately padded.

Parameters:

...

the value of the first property, followed optionally by more name/value pairs, followed by null

first_property_name

the name of the first property

object_type

the type id of the Object subtype to instantiate

Returns:

a new instance of object_type




2022 vala-language.org