Object Interest
WpObjectInterest
An object interest is a helper that is used in WpObjectManager to declare interest in certain kinds of objects.
Wp.ObjectInterest
An object interest is a helper that is used in Wp.ObjectManager to declare interest in certain kinds of objects.
Wp.ObjectInterest
An object interest is a helper that is used in Wp.ObjectManager to declare interest in certain kinds of objects.
Constructors
wp_object_interest_new
WpObjectInterest * wp_object_interest_new (GType gtype, ... ...)
Creates a new interest that declares interest in objects of the specified gtype, with the constraints specified in the variable arguments.
The variable arguments should be a list of constraints terminated with NULL, where each constraint consists of the following arguments:
- a WpConstraintType: the constraint type
- a
const gchar *
: the subject name - a
const gchar *
: the format string - 0 or more arguments according to the format string
The format string is interpreted as follows:
- the first character is the constraint verb:
- the rest of the characters are interpreted as a GVariant format string, as it would be used in g_variant_new
The rest of this function's arguments up to the start of the next constraint depend on the GVariant format part of the format string and are used to construct a GVariant for the constraint's value argument.
For further reading on the constraint's arguments, see wp_object_interest_add_constraint
For example, this interest matches objects that are descendands of WpProxy with a "bound-id" between 0 and 100 (inclusive), with a pipewire property called "format.dsp" that contains the string "audio" somewhere in the value and with a pipewire property "port.name" being present (with any value):
interest = wp_object_interest_new (WP_TYPE_PROXY,
WP_CONSTRAINT_TYPE_G_PROPERTY, "bound-id", "~(uu)", 0, 100,
WP_CONSTRAINT_TYPE_PW_PROPERTY, "format.dsp", "#s", "*audio*",
WP_CONSTRAINT_TYPE_PW_PROPERTY, "port.name", "+",
NULL);
Parameters:
gtype
–
the type of the object to declare interest in
...
–
a set of constraints, terminated with NULL
the new object interest
wp_object_interest_new_type
WpObjectInterest * wp_object_interest_new_type (GType gtype)
Creates a new interest that declares interest in objects of the specified gtype, without any property constraints. To add property constraints, you can call wp_object_interest_add_constraint afterwards.
Parameters:
gtype
–
the type of the object to declare interest in
the new object interest
Wp.ObjectInterest.new_type
def Wp.ObjectInterest.new_type (gtype):
#python wrapper for 'wp_object_interest_new_type'
Creates a new interest that declares interest in objects of the specified gtype, without any property constraints. To add property constraints, you can call Wp.ObjectInterest.add_constraint afterwards.
Parameters:
gtype
(
GObject.Type
)
–
the type of the object to declare interest in
the new object interest
Wp.ObjectInterest.prototype.new_type
function Wp.ObjectInterest.prototype.new_type(gtype: GObject.Type): {
// javascript wrapper for 'wp_object_interest_new_type'
}
Creates a new interest that declares interest in objects of the specified gtype, without any property constraints. To add property constraints, you can call Wp.ObjectInterest.prototype.add_constraint afterwards.
Parameters:
gtype
(
GObject.Type
)
–
the type of the object to declare interest in
the new object interest
wp_object_interest_new_valist
WpObjectInterest * wp_object_interest_new_valist (GType gtype, va_list* args)
va_list version of wp_object_interest_new
Parameters:
gtype
–
the type of the object to declare interest in
args
–
pointer to va_list containing the constraints
the new object interest
Methods
wp_object_interest_add_constraint
wp_object_interest_add_constraint (WpObjectInterest * self, WpConstraintType type, const gchar * subject, WpConstraintVerb verb, GVariant * value)
Adds a constraint to this interest. Constraints consist of a type, a subject, a verb and, depending on the verb, a value.
Constraints are almost like a spoken language sentence that declare a condition that must be true in order to consider that an object can match this interest. For instance, a constraint can be "pipewire property 'object.id' equals 10". This would be translated to:
wp_object_interest_add_constraint (i,
WP_CONSTRAINT_TYPE_PW_PROPERTY, "object.id",
WP_CONSTRAINT_VERB_EQUALS, g_variant_new_int (10));
Some verbs require a value and some others do not. For those that do, the value must be of a specific type:
- WP_CONSTRAINT_VERB_EQUALS: value can be a string, a (u)int32, a (u)int64, a double or a boolean. The subject value must equal this value for the constraint to be satisfied
- WP_CONSTRAINT_VERB_IN_LIST: value must be a tuple that contains any number of items of the same type; the items can be string, (u)int32, (u)int64 or double. These items make a list that the subject's value will be checked against. If any of the items equals the subject value, the constraint is satisfied
- WP_CONSTRAINT_VERB_IN_RANGE: value must be a tuple that contains exactly 2 numbers of the same type ((u)int32, (u)int64 or double), meaning the minimum and maximum (inclusive) of the range. If the subject value is a number within this range, the constraint is satisfied
- WP_CONSTRAINT_VERB_MATCHES: value must be a string that defines a pattern usable with GPatternSpec. If the subject value matches this pattern, the constraint is satisfied
In case the type of the subject value is not the same type as the one requested by the type of the value, the subject value is converted. For GObject properties, this conversion is done using g_value_transform, so limitations of this function apply. In the case of PipeWire properties, which are always strings, conversion is done as follows:
- to boolean:
"true"
or"1"
means TRUE,"false"
or"0"
means FALSE - to int / uint / int64 / uint64: One of the
strtol()
family of functions is used to convert, using base 10 - to double:
strtod()
is used
This method does not fail if invalid arguments are given. However, wp_object_interest_validate should be called after adding all the constraints on an interest in order to catch errors.
Parameters:
self
–
the object interest
type
–
the constraint type
subject
–
the subject that the constraint applies to
verb
–
the operation that is performed to check the constraint
value
(
[transfer: floating]
[nullable]
)
–
the value to check for
Wp.ObjectInterest.add_constraint
def Wp.ObjectInterest.add_constraint (self, type, subject, verb, value):
#python wrapper for 'wp_object_interest_add_constraint'
Adds a constraint to this interest. Constraints consist of a type, a subject, a verb and, depending on the verb, a value.
Constraints are almost like a spoken language sentence that declare a condition that must be true in order to consider that an object can match this interest. For instance, a constraint can be "pipewire property 'object.id' equals 10". This would be translated to:
wp_object_interest_add_constraint (i,
WP_CONSTRAINT_TYPE_PW_PROPERTY, "object.id",
WP_CONSTRAINT_VERB_EQUALS, g_variant_new_int (10));
Some verbs require a value and some others do not. For those that do, the value must be of a specific type:
- Wp.ConstraintVerb.EQUALS: value can be a string, a (u)int32, a (u)int64, a double or a boolean. The subject value must equal this value for the constraint to be satisfied
- Wp.ConstraintVerb.IN_LIST: value must be a tuple that contains any number of items of the same type; the items can be string, (u)int32, (u)int64 or double. These items make a list that the subject's value will be checked against. If any of the items equals the subject value, the constraint is satisfied
- Wp.ConstraintVerb.IN_RANGE: value must be a tuple that contains exactly 2 numbers of the same type ((u)int32, (u)int64 or double), meaning the minimum and maximum (inclusive) of the range. If the subject value is a number within this range, the constraint is satisfied
- Wp.ConstraintVerb.MATCHES: value must be a string that defines a pattern usable with GLib.PatternSpec. If the subject value matches this pattern, the constraint is satisfied
In case the type of the subject value is not the same type as the one requested by the type of the value, the subject value is converted. For GObject.Object properties, this conversion is done using GObject.Value.transform, so limitations of this function apply. In the case of PipeWire properties, which are always strings, conversion is done as follows:
- to boolean:
"true"
or"1"
means True,"false"
or"0"
means False - to int / uint / int64 / uint64: One of the
strtol()
family of functions is used to convert, using base 10 - to double:
strtod()
is used
This method does not fail if invalid arguments are given. However, Wp.ObjectInterest.validate should be called after adding all the constraints on an interest in order to catch errors.
Parameters:
self
(
Wp.ObjectInterest
)
–
the object interest
type
(
Wp.ConstraintType
)
–
the constraint type
subject
(
str
)
–
the subject that the constraint applies to
verb
(
Wp.ConstraintVerb
)
–
the operation that is performed to check the constraint
value
(
GLib.Variant
)
–
the value to check for
Wp.ObjectInterest.prototype.add_constraint
function Wp.ObjectInterest.prototype.add_constraint(type: Wp.ConstraintType, subject: String, verb: Wp.ConstraintVerb, value: GLib.Variant): {
// javascript wrapper for 'wp_object_interest_add_constraint'
}
Adds a constraint to this interest. Constraints consist of a type, a subject, a verb and, depending on the verb, a value.
Constraints are almost like a spoken language sentence that declare a condition that must be true in order to consider that an object can match this interest. For instance, a constraint can be "pipewire property 'object.id' equals 10". This would be translated to:
wp_object_interest_add_constraint (i,
WP_CONSTRAINT_TYPE_PW_PROPERTY, "object.id",
WP_CONSTRAINT_VERB_EQUALS, g_variant_new_int (10));
Some verbs require a value and some others do not. For those that do, the value must be of a specific type:
- Wp.ConstraintVerb.EQUALS: value can be a string, a (u)int32, a (u)int64, a double or a boolean. The subject value must equal this value for the constraint to be satisfied
- Wp.ConstraintVerb.IN_LIST: value must be a tuple that contains any number of items of the same type; the items can be string, (u)int32, (u)int64 or double. These items make a list that the subject's value will be checked against. If any of the items equals the subject value, the constraint is satisfied
- Wp.ConstraintVerb.IN_RANGE: value must be a tuple that contains exactly 2 numbers of the same type ((u)int32, (u)int64 or double), meaning the minimum and maximum (inclusive) of the range. If the subject value is a number within this range, the constraint is satisfied
- Wp.ConstraintVerb.MATCHES: value must be a string that defines a pattern usable with GLib.PatternSpec. If the subject value matches this pattern, the constraint is satisfied
In case the type of the subject value is not the same type as the one requested by the type of the value, the subject value is converted. For GObject.Object properties, this conversion is done using GObject.Value.prototype.transform, so limitations of this function apply. In the case of PipeWire properties, which are always strings, conversion is done as follows:
- to boolean:
"true"
or"1"
means true,"false"
or"0"
means false - to int / uint / int64 / uint64: One of the
strtol()
family of functions is used to convert, using base 10 - to double:
strtod()
is used
This method does not fail if invalid arguments are given. However, Wp.ObjectInterest.prototype.validate should be called after adding all the constraints on an interest in order to catch errors.
Parameters:
self
(
Wp.ObjectInterest
)
–
the object interest
type
(
Wp.ConstraintType
)
–
the constraint type
subject
(
String
)
–
the subject that the constraint applies to
verb
(
Wp.ConstraintVerb
)
–
the operation that is performed to check the constraint
value
(
GLib.Variant
)
–
the value to check for
wp_object_interest_copy
WpObjectInterest * wp_object_interest_copy (WpObjectInterest * self)
Parameters:
self
–
the object interest to copy
a deep copy of self
Wp.ObjectInterest.copy
def Wp.ObjectInterest.copy (self):
#python wrapper for 'wp_object_interest_copy'
Parameters:
self
(
Wp.ObjectInterest
)
–
the object interest to copy
a deep copy of self
Wp.ObjectInterest.prototype.copy
function Wp.ObjectInterest.prototype.copy(): {
// javascript wrapper for 'wp_object_interest_copy'
}
Parameters:
self
(
Wp.ObjectInterest
)
–
the object interest to copy
a deep copy of self
wp_object_interest_free
wp_object_interest_free (WpObjectInterest * self)
Releases self and all the memory associated with it
Parameters:
self
(
[transfer: full]
)
–
the object interest to free
Wp.ObjectInterest.free
def Wp.ObjectInterest.free (self):
#python wrapper for 'wp_object_interest_free'
Releases self and all the memory associated with it
Parameters:
self
(
Wp.ObjectInterest
)
–
the object interest to free
Wp.ObjectInterest.prototype.free
function Wp.ObjectInterest.prototype.free(): {
// javascript wrapper for 'wp_object_interest_free'
}
Releases self and all the memory associated with it
Parameters:
self
(
Wp.ObjectInterest
)
–
the object interest to free
wp_object_interest_matches
gboolean wp_object_interest_matches (WpObjectInterest * self, gpointer object)
Checks if the specified object matches the type and all the constraints that are described in self
Equivalent to wp_object_interest_matches_full (self, G_OBJECT_TYPE (object), object, NULL, NULL)
Parameters:
self
–
the object interest
object
–
the target object to check for a match
Wp.ObjectInterest.matches
def Wp.ObjectInterest.matches (self, object):
#python wrapper for 'wp_object_interest_matches'
Checks if the specified object matches the type and all the constraints that are described in self
Equivalent to wp_object_interest_matches_full (self, G_OBJECT_TYPE (object), object, NULL, NULL)
Parameters:
self
(
Wp.ObjectInterest
)
–
the object interest
object
(
object
)
–
the target object to check for a match
Wp.ObjectInterest.prototype.matches
function Wp.ObjectInterest.prototype.matches(object: Object): {
// javascript wrapper for 'wp_object_interest_matches'
}
Checks if the specified object matches the type and all the constraints that are described in self
Equivalent to wp_object_interest_matches_full (self, G_OBJECT_TYPE (object), object, NULL, NULL)
Parameters:
self
(
Wp.ObjectInterest
)
–
the object interest
object
(
Object
)
–
the target object to check for a match
wp_object_interest_matches_full
gboolean wp_object_interest_matches_full (WpObjectInterest * self, GType object_type, gpointer object, WpProperties * pw_props, WpProperties * pw_global_props)
A low-level version of wp_object_interest_matches. In this version, the object's type is directly given in object_type and is not inferred from the object. object is only used to check for constraints against GObject properties.
pw_props and pw_global_props are used to check constraints against PipeWire object properties and global properties, respectively.
object, pw_props and pw_global_props may be NULL, but in case there are any constraints that require them, the match will fail. As a special case, if object is not NULL and is a subclass of WpProxy, then pw_props and pw_global_props, if required, will be internally retrieved from object by calling wp_proxy_get_properties and wp_proxy_get_global_properties respectively.
Parameters:
self
–
the object interest
object_type
–
the type to be checked against the interest's type
object
(
[type GObject]
[transfer: none]
[nullable]
)
–
the object to be used for checking constraints of type WP_CONSTRAINT_TYPE_G_PROPERTY
pw_props
(
[transfer: none]
[nullable]
)
–
the properties to be used for checking constraints of type WP_CONSTRAINT_TYPE_PW_PROPERTY
pw_global_props
(
[transfer: none]
[nullable]
)
–
the properties to be used for checking constraints of type WP_CONSTRAINT_TYPE_PW_GLOBAL_PROPERTY
Wp.ObjectInterest.matches_full
def Wp.ObjectInterest.matches_full (self, object_type, object, pw_props, pw_global_props):
#python wrapper for 'wp_object_interest_matches_full'
A low-level version of Wp.ObjectInterest.matches. In this version, the object's type is directly given in object_type and is not inferred from the object. object is only used to check for constraints against GObject.Object properties.
pw_props and pw_global_props are used to check constraints against PipeWire object properties and global properties, respectively.
object, pw_props and pw_global_props may be None, but in case there are any constraints that require them, the match will fail. As a special case, if object is not None and is a subclass of Wp.Proxy, then pw_props and pw_global_props, if required, will be internally retrieved from object by calling Wp.Proxy.get_properties and Wp.Proxy.get_global_properties respectively.
Parameters:
self
(
Wp.ObjectInterest
)
–
the object interest
object_type
(
GObject.Type
)
–
the type to be checked against the interest's type
object
(
GObject.Object
)
–
the object to be used for checking constraints of type Wp.ConstraintType.G_PROPERTY
pw_props
(
Wp.Properties
)
–
the properties to be used for checking constraints of type Wp.ConstraintType.PW_PROPERTY
pw_global_props
(
Wp.Properties
)
–
the properties to be used for checking constraints of type Wp.ConstraintType.PW_GLOBAL_PROPERTY
Wp.ObjectInterest.prototype.matches_full
function Wp.ObjectInterest.prototype.matches_full(object_type: GObject.Type, object: GObject.Object, pw_props: Wp.Properties, pw_global_props: Wp.Properties): {
// javascript wrapper for 'wp_object_interest_matches_full'
}
A low-level version of Wp.ObjectInterest.prototype.matches. In this version, the object's type is directly given in object_type and is not inferred from the object. object is only used to check for constraints against GObject.Object properties.
pw_props and pw_global_props are used to check constraints against PipeWire object properties and global properties, respectively.
object, pw_props and pw_global_props may be null, but in case there are any constraints that require them, the match will fail. As a special case, if object is not null and is a subclass of Wp.Proxy, then pw_props and pw_global_props, if required, will be internally retrieved from object by calling Wp.Proxy.prototype.get_properties and Wp.Proxy.prototype.get_global_properties respectively.
Parameters:
self
(
Wp.ObjectInterest
)
–
the object interest
object_type
(
GObject.Type
)
–
the type to be checked against the interest's type
object
(
GObject.Object
)
–
the object to be used for checking constraints of type Wp.ConstraintType.G_PROPERTY
pw_props
(
Wp.Properties
)
–
the properties to be used for checking constraints of type Wp.ConstraintType.PW_PROPERTY
pw_global_props
(
Wp.Properties
)
–
the properties to be used for checking constraints of type Wp.ConstraintType.PW_GLOBAL_PROPERTY
wp_object_interest_validate
gboolean wp_object_interest_validate (WpObjectInterest * self, GError ** error)
Validates the interest, ensuring that the interest GType is a valid object and that all the constraints have been expressed properly.
Parameters:
self
–
the object interest to validate
error
(
[out]
[optional]
)
–
the error, in case validation failed
Wp.ObjectInterest.validate
@raises(GLib.GError)
def Wp.ObjectInterest.validate (self):
#python wrapper for 'wp_object_interest_validate'
Validates the interest, ensuring that the interest GObject.Type is a valid object and that all the constraints have been expressed properly.
Parameters:
self
(
Wp.ObjectInterest
)
–
the object interest to validate
Wp.ObjectInterest.prototype.validate
function Wp.ObjectInterest.prototype.validate(): {
// javascript wrapper for 'wp_object_interest_validate'
}
Validates the interest, ensuring that the interest GObject.Type is a valid object and that all the constraints have been expressed properly.
Parameters:
self
(
Wp.ObjectInterest
)
–
the object interest to validate
Enumerations
WpConstraintType
Members
WP_CONSTRAINT_TYPE_NONE
(0)
–
invalid constraint type
WP_CONSTRAINT_TYPE_PW_GLOBAL_PROPERTY
(1)
–
constraint applies to a PipeWire global property of the object (the ones returned by wp_proxy_get_global_properties)
WP_CONSTRAINT_TYPE_PW_PROPERTY
(2)
–
constraint applies to a PipeWire property of the object (the ones returned by wp_proxy_get_properties)
WP_CONSTRAINT_TYPE_G_PROPERTY
(3)
–
constraint applies to a GObject property of the object
Wp.ConstraintType
Members
Wp.ConstraintType.NONE
(0)
–
invalid constraint type
Wp.ConstraintType.PW_GLOBAL_PROPERTY
(1)
–
constraint applies to a PipeWire global property of the object (the ones returned by Wp.Proxy.get_global_properties)
Wp.ConstraintType.PW_PROPERTY
(2)
–
constraint applies to a PipeWire property of the object (the ones returned by Wp.Proxy.get_properties)
Wp.ConstraintType.G_PROPERTY
(3)
–
constraint applies to a GObject.Object property of the object
Wp.ConstraintType
Members
Wp.ConstraintType.NONE
(0)
–
invalid constraint type
Wp.ConstraintType.PW_GLOBAL_PROPERTY
(1)
–
constraint applies to a PipeWire global property of the object (the ones returned by Wp.Proxy.prototype.get_global_properties)
Wp.ConstraintType.PW_PROPERTY
(2)
–
constraint applies to a PipeWire property of the object (the ones returned by Wp.Proxy.prototype.get_properties)
Wp.ConstraintType.G_PROPERTY
(3)
–
constraint applies to a GObject.Object property of the object
WpConstraintVerb
Members
WP_CONSTRAINT_VERB_EQUALS
(61)
–
=
the subject's value must equal the
constraint's value
WP_CONSTRAINT_VERB_IN_LIST
(99)
–
c
the subject's value must equal at least
one of the values in the list given as the constraint's value
WP_CONSTRAINT_VERB_IN_RANGE
(126)
–
~
the subject's value must be a number
in the range defined by the constraint's value
WP_CONSTRAINT_VERB_MATCHES
(35)
–
#
the subject's value must match the
pattern specified in the constraint's value
WP_CONSTRAINT_VERB_IS_PRESENT
(43)
–
+
the subject property must exist
WP_CONSTRAINT_VERB_IS_ABSENT
(45)
–
-
the subject property must not exist
Wp.ConstraintVerb
Members
Wp.ConstraintVerb.EQUALS
(61)
–
=
the subject's value must equal the
constraint's value
Wp.ConstraintVerb.IN_LIST
(99)
–
c
the subject's value must equal at least
one of the values in the list given as the constraint's value
Wp.ConstraintVerb.IN_RANGE
(126)
–
~
the subject's value must be a number
in the range defined by the constraint's value
Wp.ConstraintVerb.MATCHES
(35)
–
#
the subject's value must match the
pattern specified in the constraint's value
Wp.ConstraintVerb.IS_PRESENT
(43)
–
+
the subject property must exist
Wp.ConstraintVerb.IS_ABSENT
(45)
–
-
the subject property must not exist
Wp.ConstraintVerb
Members
Wp.ConstraintVerb.EQUALS
(61)
–
=
the subject's value must equal the
constraint's value
Wp.ConstraintVerb.IN_LIST
(99)
–
c
the subject's value must equal at least
one of the values in the list given as the constraint's value
Wp.ConstraintVerb.IN_RANGE
(126)
–
~
the subject's value must be a number
in the range defined by the constraint's value
Wp.ConstraintVerb.MATCHES
(35)
–
#
the subject's value must match the
pattern specified in the constraint's value
Wp.ConstraintVerb.IS_PRESENT
(43)
–
+
the subject property must exist
Wp.ConstraintVerb.IS_ABSENT
(45)
–
-
the subject property must not exist
Constants
WP_TYPE_OBJECT_INTEREST
#define WP_TYPE_OBJECT_INTEREST (wp_object_interest_get_type ())
The results of the search are