WpObject¶
digraph inheritance { rankdir=LR; GObject -> WpObject; }-
struct
WpObject
¶ Base class for objects that have activatable features.
GObject Properties
-
struct
_WpObjectClass
¶ Public Members
-
GObjectClass
parent_class
¶
-
WpObjectFeatures
get_supported_features)
(WpObject *self)¶
-
guint
activate_get_next_step)
(WpObject *self, WpFeatureActivationTransition *transition, guint step, WpObjectFeatures missing)¶
-
void
activate_execute_step)
(WpObject *self, WpFeatureActivationTransition *transition, guint step, WpObjectFeatures missing)¶
-
void
deactivate)
(WpObject *self, WpObjectFeatures features)¶
-
GObjectClass
-
typedef guint
WpObjectFeatures
¶ Flags that specify functionality that is available on this class.
Use wp_object_activate() to enable more features, wp_object_get_supported_features() to see which features are supported and wp_object_get_active_features() to find out which features are already enabled. Features can also be deactivated later using wp_object_deactivate().
Actual feature flags are to be specified by subclasses and their interfaces. WP_OBJECT_FEATURES_ALL is a special value that can be used to activate all the supported features in any given object.
-
const WpObjectFeatures WP_OBJECT_FEATURES_ALL =
0xffffffff
¶ Special value that can be used to activate all the supported features in any given object.
-
WpCore*
wp_object_get_core
(WpObject * self)¶ Gets the core associated with this object.
- Return
- (transfer full): the core associated with this object
- Parameters
self
: the object
-
WpObjectFeatures
wp_object_get_active_features
(WpObject * self)¶ Gets the active features of this object.
- Return
- A bitset containing the active features of this object
- Parameters
self
: the object
-
WpObjectFeatures
wp_object_get_supported_features
(WpObject * self)¶ Gets the supported features of this object.
- Return
- A bitset containing the supported features of this object; note that supported features may change at runtime
- Parameters
self
: the object
-
void
wp_object_activate
(WpObject * self, WpObjectFeatures features, GCancellable * cancellable, GAsyncReadyCallback callback, gpointer user_data)¶ Callback version of wp_object_activate_closure()
- Parameters
self
: the objectfeatures
: the features to enablecancellable
: (nullable): a cancellable for the async operationcallback
: (scope async): a function to call when activation is completeuser_data
: (closure): data for callback
-
void
wp_object_activate_closure
(WpObject * self, WpObjectFeatures features, GCancellable * cancellable, GClosure * closure)¶ Activates the requested features and invokes closure when this is done. features may contain unsupported or already active features. The operation will filter them and activate only ones that are supported and inactive.
If multiple calls to this method is done, the operations will be executed one after the other to ensure features only get activated once.
- Note
- closure may be invoked in sync while this method is being called, if there are no features to activate.
- Parameters
self
: the objectfeatures
: the features to enablecancellable
: (nullable): a cancellable for the async operationclosure
: (transfer full): the closure to use when activation is completed
-
gboolean
wp_object_activate_finish
(WpObject * self, GAsyncResult * res, GError ** error)¶ Finishes the async operation that was started with wp_object_activate()
- Return
- TRUE if the requested features were activated, FALSE if there was an error
- Parameters
self
: the objectres
: the async operation resulterror
: (out) (optional): the error of the operation, if any
-
void
wp_object_deactivate
(WpObject * self, WpObjectFeatures features)¶ Deactivates the given features, leaving the object in the state it was before they were enabled.
This is seldom needed to call manually, but it can be used to save resources if some features are no longer needed.
- Parameters
self
: the objectfeatures
: the features to deactivate
-
void
wp_object_abort_activation
(WpObject * self, const gchar * msg)¶ Aborts the current object activation by returning a transition error if any transitions are pending.
This is usually used to stop any pending activation if an error happened.
- Since
- 0.4.6
- Parameters
self
: the objectmsg
: the message used in the transition error
-
void
wp_object_update_features
(WpObject * self, WpObjectFeatures activated, WpObjectFeatures deactivated)¶ Allows subclasses to update the currently active features.
activated should contain new features and deactivated should contain features that were just deactivated. Calling this method also advances the activation transitions.
- Remark
- Private method to be called by subclasses only.
- Parameters
self
: the objectactivated
: the features that were activated, or 0deactivated
: the features that were deactivated, or 0
-
WP_TYPE_OBJECT
(wp_object_get_type ())¶ The WpObject GType.