| Top |
| void | gpropz_auto_get_property () |
| void | gpropz_auto_set_property () |
| void | gpropz_class_init_property_functions () |
| void | gpropz_bind_property_full () |
| void | gpropz_install_property_full () |
| #define | gpropz_bind_property() |
| #define | gpropz_bind_property_private() |
| #define | gpropz_install_property() |
| #define | gpropz_install_property_private() |
| #define | GPROPZ_DEFINE_RO() |
| #define | GPROPZ_DEFINE_RW() |
| #define | GPROPZ_VERSION |
| GpropzValueFilter | |
| extern GpropzValueFilter | gpropz_obj_ref_filter |
void gpropz_auto_get_property (GObject *object,guint prop_id,GValue *value,GParamSpec *spec);
This function may be placed in GObjectClass.get_property in order to use gpropz's automated getter.
void gpropz_auto_set_property (GObject *object,guint prop_id,const GValue *value,GParamSpec *spec);
This function may be placed in GObjectClass.get_property in order to use gpropz's automated setter.
void
gpropz_class_init_property_functions (GObjectClass *object_class);
Set's the object_class
's get_property and set_property attributes to
gpropz_auto_get_property() and gpropz_auto_set_property(), respectively.
void gpropz_bind_property_full (gsize struct_offset,guint prop_id,GParamSpec *pspec,GpropzValueFilter *filter);
Binds the member located at struct_offset
within the object to the GObject property passed
in prop_id
and pspec
. This means that gpropz_auto_set_property() and
gpropz_auto_get_property() will automatically write to / read from this location in the
object structure. filter
specifies a GpropzValueFilter that will be applied to the property,
meaning that any writes or reads will go through GpropzValueFilter.set_filter and
GpropzValueFilter.get_filter, respectively, instead of being directly written to the object.
In most cases, you want to use gpropz_bind_property() or gpropz_bind_property_private()
instead, or the auto-install functions gpropz_install_property() and
gpropz_install_property_private().
void gpropz_install_property_full (GObjectClass *object_class,gsize struct_offset,guint prop_id,GParamSpec *pspec,GpropzValueFilter *filter);
Shorthand for calling g_object_class_install_property() and gpropz_install_property_full()
in succession.
#define gpropz_bind_property(TypeName, member_name, prop_id, pspec, filter)
Shorthand for gpropz_bind_property_full() that passes offsetof (TypeName
, member_name
)
as the structure offset to use.
#define gpropz_bind_property_private(TypeName, member_name, prop_id, pspec, filter)
Shorthand for gpropz_bind_property_full() that passes G_PRIVATE_OFFSET
(TypeName
, member_name
) as the structure offset to use.
#define gpropz_install_property(klass, TypeName, member_name, prop_id, pspec, filter)
Shorthand for gpropz_install_property_full() that passes offsetof (TypeName
, member_name
)
as the structure offset to use.
#define gpropz_install_property_private(klass, TypeName, member_name, prop_id, pspec, filter)
Shorthand for gpropz_install_property_full() that passes G_PRIVATE_OFFSET (TypeName
,
member_name
) as the structure offset to use.
#define GPROPZ_DEFINE_RO(member_type, TypeName, type_name, method_name, pspec)
Automatically defines a C getter function to get the given property.
member_type |
The property's type. |
|
TypeName |
The PascalCase name of your class. |
|
type_name |
The snake_case name of your class. |
|
method_name |
The name of the getter, e.g. if this "my_prop", then the generated getter will be named type_name_get_my_prop. This name does not have to be the same as the property's name. |
|
pspec |
A global instance of the GParamSpec that represents the property to get. |
#define GPROPZ_DEFINE_RW(member_type, TypeName, type_name, method_name, pspec)
Identical to GPROPZ_DEFINE_RO(), but defines a setter as well.
typedef struct {
void (*get_filter) (GObject *object,
gconstpointer prop,
guint prop_id,
gpointer target,
GParamSpec *pspec);
void (*set_filter) (GObject *object,
gpointer prop,
guint prop_id,
gconstpointer source,
GParamSpec *pspec);
} GpropzValueFilter;
A "filter" is a pair of get/set functions that override gpropz's magic getters and setters with their own, custom versions. Unlike the normal GObject set_property / get_property functions, these take raw pointers instead of GValue instances, because they are also for the auto-generated, property-specific C getters and setters, and we want to avoid constructing GValue instances every time.
Filters also allow you to have a different property type than you tell GLib; simply convert between the types in the filter functions.
extern GpropzValueFilter gpropz_obj_ref_filter;
A default filter that calls g_object_ref() on the input for both get_filter and set_filter.
If you only want one of the two behaviors, use gpropz_obj_ref_filter.get_filter or
gpropz_obj_ref_filter.set_filter to build your own filter structure.