Object
Object Hierarchy:
Description:
[ CCode ( get_value_function = "g_value_get_object" , marshaller_type_name = "OBJECT" , param_spec_function = "g_param_spec_object" , ref_function = "g_object_ref" , set_value_function = "g_value_set_object" , take_value_function = "g_value_take_object" , unref_function = "g_object_unref" ) ]
public class Object
public class Object
The base object type.
All the fields in the `GObject` structure are private to the implementation and should never be accessed directly.
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. This guarantee applies to the Object (or derived)
struct, the ObjectClass (or derived) struct, and any private data allocated by
G_ADD_PRIVATE
.
All known sub-classes:
Namespace: GLib
Package: gobject-2.0
Content:
Static methods:
- public static Object @new (Type type, ...)
Creates a new instance of a Object subtype and sets its properties.
- public static unowned ParamSpec? interface_find_property (TypeInterface g_iface, string property_name)
Find the ParamSpec with the given name for an interface.
- public static void interface_install_property (TypeInterface g_iface, ParamSpec pspec)
Add a property to an interface; this is only useful for interfaces that are added to GObject-derived types.
- public static (unowned ParamSpec)[] interface_list_properties (TypeInterface g_iface)
Lists the properties of an interface.
- public static Object new_valist (Type type, string? firstprop, va_list var_args)
Creates a new instance of a Object subtype and sets its properties.
- public static Object new_with_properties (Type object_type, string[] names, Value[] values)
Creates a new instance of a Object subtype and sets its properties using the provided arrays.
- public static Object newv (Type type, Parameter[] parameters)
Creates a new instance of a Object subtype and sets its properties.
Creation methods:
- public Object (...)
Methods:
- public void @get (string first_property_name, ...)
Gets properties of an object.
- public unowned Object @ref ()
Increases the reference count of this.
- public void @set (string first_property_name, ...)
Sets properties on an object.
- public void add_toggle_ref (ToggleNotify notify)
Increases the reference count of the object by one and sets a callback to be called when all other references to the object are dropped, or when this is already the last reference to the object and another reference is established.
- public void add_weak_pointer (void** weak_pointer_location)
Adds a weak reference from weak_pointer to this to indicate that the pointer located at
weak_pointer_location
is only valid during the lifetime of this. - public unowned Binding bind_property (string source_property, Object target, string target_property, BindingFlags flags = DEFAULT, owned BindingTransformFunc? transform_to = null, owned BindingTransformFunc? transform_from = null)
Creates a binding between
source_property
on this andtarget_property
ontarget
, allowing you to set the transformation functions to be used by the binding. - public unowned Object connect (string signal_spec, ...)
A convenience function to connect multiple signals at once.
- public virtual void constructed ()
- public void disconnect (ulong handler_id)
- public virtual void dispose ()
Releases all references to other objects.
- public T dup_data<T> (string key, DuplicateFunc<T> dup_func)
This is a variant of get_data which returns a 'duplicate' of the value.
- public T dup_qdata<T> (Quark quark, DuplicateFunc<T> dup_func)
This is a variant of get_qdata which returns a 'duplicate' of the value.
- public void force_floating ()
This function is intended for Object implementations to re-enforce a floating object reference.
- public void freeze_notify ()
Increases the freeze count on this.
- public unowned ObjectClass get_class ()
- public unowned T get_data<T> (string key)
Gets a named field from the objects table of associations (see
g_object_set_data
). - public void get_property (string property_name, ref Value value)
Gets a property of an object.
- public unowned T get_qdata<T> (Quark quark)
This function gets back user data pointers stored via
g_object_set_qdata
. - public Type get_type ()
- public void getv (string[] names, Value[] values)
Gets
names.length
properties for an this. - public bool is_floating ()
Checks whether this has a floating reference.
- public void notify_property (string property_name)
- public unowned Object ref_sink ()
Increase the reference count of this, and possibly remove the floating reference, if this has a floating reference.
- public void remove_toggle_ref (ToggleNotify notify)
Removes a reference added with add_toggle_ref.
- public void remove_weak_pointer (void** weak_pointer_location)
Removes a weak reference from this that was previously added using add_weak_pointer.
- public bool replace_data<G,T> (string key, G oldval, owned T newval, out DestroyNotify? old_destroy)
Compares the user data for the key
key
on this witholdval
, and if they are the same, replacesoldval
withnewval
. - public bool replace_qdata<G,T> (Quark quark, G oldval, owned T newval, out DestroyNotify? old_destroy)
Compares the user data for the key
quark
on this witholdval
, and if they are the same, replacesoldval
withnewval
. - public void set_data<T> (string key, owned T data)
- public void set_data_full (string key, void* data, DestroyNotify? destroy)
Like
g_object_set_data
except it adds notification for when the association is destroyed, either by setting it to a different value or when the object is destroyed. - public void set_property (string property_name, Value value)
Sets a property on an object.
- public void set_qdata<T> (Quark quark, owned T data)
- public void set_qdata_full (Quark quark, void* data, DestroyNotify? destroy)
This function works like
g_object_set_qdata
, but in addition, a void (*destroy) (gpointer) function may be specified which is called withdata
as argument when the this is finalized, or the data is being overwritten by a call tog_object_set_qdata
with the samequark
. - public void set_valist (string first_property_name, va_list var_args)
Sets properties on an object.
- public void setv (string[] names, Value[] values)
Sets
names.length
properties for an this. - public T steal_data<T> (string key)
Remove a specified datum from the object's data associations, without invoking the association's destroy handler.
- public T steal_qdata<T> (Quark quark)
This function gets back user data pointers stored via
g_object_set_qdata
and removes thedata
from object without invoking itsdestroy
function (if any was set ). - public void thaw_notify ()
Reverts the effect of a previous call to freeze_notify.
- public void unref ()
Decreases the reference count of this.
- public void watch_closure (Closure closure)
This function essentially limits the life time of the
closure
to the life time of the object. - public void weak_ref (WeakNotify notify)
Adds a weak reference callback to an object.
- public void weak_unref (WeakNotify notify)
Removes a weak reference callback to an object.
Signals:
- public virtual signal void notify (ParamSpec pspec)
The notify signal is emitted on an object when one of its properties has its value set through set_property, @set, et al.