WpTransition
A transition is an asynchronous operation, like GTask, that contains an internal state machine, where a series of 'steps' are executed in order to complete the operation.
For every step, get_next_step() is called in order to determine the next step to execute. Afterwards, execute_step() is called to perform any actions necessary to complete this step. When execution of the step is done, the operation's code must call wp_transition_advance in order to continue to the next step. If an error occurs, the operation's code must call wp_transition_return_error instead, in which case the transition completes immediately and wp_transition_had_error returns TRUE.
Typically, every step will start an asynchronous operation. Although is is possible, the WpTransition base class does not expect execute_step() to call wp_transition_advance directly. Instead, it is expected that wp_transition_advance will be called from the callback that the step's asyncrhonous operation will call when it is completed.
Constructors
wp_transition_new
WpTransition * wp_transition_new (GType type, gpointer source_object, GCancellable * cancellable, GAsyncReadyCallback callback, gpointer callback_data)
Creates a WpTransition acting on source_object. When the transition is done, callback will be invoked.
The transition does not automatically start executing steps. You must call wp_transition_advance after creating it in order to start it.
Note that the transition is automatically unref'ed after the callback has been executed. If you wish to keep an additional reference on it, you need to ref it explicitly.
Parameters:
type
–
the GType of the WpTransition subclass to instantiate
cancellable
(
[nullable]
)
–
optional GCancellable
callback
(
[scope async]
)
–
callback_data
(
[closure]
)
–
user data passed to callback
the new transition
Wp.Transition.new
def Wp.Transition.new (type, source_object, cancellable, callback, *callback_data):
#python wrapper for 'wp_transition_new'
Creates a Wp.Transition acting on source_object. When the transition is done, callback will be invoked.
The transition does not automatically start executing steps. You must call Wp.Transition.advance after creating it in order to start it.
Note that the transition is automatically unref'ed after the callback has been executed. If you wish to keep an additional reference on it, you need to ref it explicitly.
Parameters:
type
(
GObject.Type
)
–
the GObject.Type of the Wp.Transition subclass to instantiate
source_object
(
GObject.Object
)
–
the GObject.Object that owns this task, or None
cancellable
(
Gio.Cancellable
)
–
optional Gio.Cancellable
callback
(
Gio.AsyncReadyCallback
)
–
callback_data
(
variadic
)
–
user data passed to callback
the new transition
Wp.Transition.prototype.new
function Wp.Transition.prototype.new(type: GObject.Type, source_object: GObject.Object, cancellable: Gio.Cancellable, callback: Gio.AsyncReadyCallback, callback_data: Object): {
// javascript wrapper for 'wp_transition_new'
}
Creates a Wp.Transition acting on source_object. When the transition is done, callback will be invoked.
The transition does not automatically start executing steps. You must call Wp.Transition.prototype.advance after creating it in order to start it.
Note that the transition is automatically unref'ed after the callback has been executed. If you wish to keep an additional reference on it, you need to ref it explicitly.
Parameters:
type
(
GObject.Type
)
–
the GObject.Type of the Wp.Transition subclass to instantiate
source_object
(
GObject.Object
)
–
the GObject.Object that owns this task, or null
cancellable
(
Gio.Cancellable
)
–
optional Gio.Cancellable
callback
(
Gio.AsyncReadyCallback
)
–
callback_data
(
Object
)
–
user data passed to callback
the new transition
wp_transition_new_closure
WpTransition * wp_transition_new_closure (GType type, gpointer source_object, GCancellable * cancellable, GClosure * closure)
Creates a WpTransition acting on source_object. When the transition is done, closure will be invoked.
The transition does not automatically start executing steps. You must call wp_transition_advance after creating it in order to start it.
Note that the transition is automatically unref'ed after the closure has been executed. If you wish to keep an additional reference on it, you need to ref it explicitly.
Parameters:
type
–
the GType of the WpTransition subclass to instantiate
cancellable
(
[nullable]
)
–
optional GCancellable
closure
(
[nullable]
)
–
a GAsyncReadyCallback wrapped in a GClosure
the new transition
Wp.Transition.new_closure
def Wp.Transition.new_closure (type, source_object, cancellable, closure):
#python wrapper for 'wp_transition_new_closure'
Creates a Wp.Transition acting on source_object. When the transition is done, closure will be invoked.
The transition does not automatically start executing steps. You must call Wp.Transition.advance after creating it in order to start it.
Note that the transition is automatically unref'ed after the closure has been executed. If you wish to keep an additional reference on it, you need to ref it explicitly.
Parameters:
type
(
GObject.Type
)
–
the GObject.Type of the Wp.Transition subclass to instantiate
source_object
(
GObject.Object
)
–
the GObject.Object that owns this task, or None
cancellable
(
Gio.Cancellable
)
–
optional Gio.Cancellable
closure
(
GObject.Closure
)
–
a Gio.AsyncReadyCallback wrapped in a GObject.Closure
the new transition
Wp.Transition.prototype.new_closure
function Wp.Transition.prototype.new_closure(type: GObject.Type, source_object: GObject.Object, cancellable: Gio.Cancellable, closure: GObject.Closure): {
// javascript wrapper for 'wp_transition_new_closure'
}
Creates a Wp.Transition acting on source_object. When the transition is done, closure will be invoked.
The transition does not automatically start executing steps. You must call Wp.Transition.prototype.advance after creating it in order to start it.
Note that the transition is automatically unref'ed after the closure has been executed. If you wish to keep an additional reference on it, you need to ref it explicitly.
Parameters:
type
(
GObject.Type
)
–
the GObject.Type of the Wp.Transition subclass to instantiate
source_object
(
GObject.Object
)
–
the GObject.Object that owns this task, or null
cancellable
(
Gio.Cancellable
)
–
optional Gio.Cancellable
closure
(
GObject.Closure
)
–
a Gio.AsyncReadyCallback wrapped in a GObject.Closure
the new transition
Methods
wp_transition_advance
wp_transition_advance (WpTransition * self)
Advances the transition to the next step.
This initially calls get_next_step() in order to determine what the next step is. If get_next_step() returns a step different than the previous one, it calls execute_step() to execute it.
The very first time that get_next_step() is called, its step parameter equals WP_TRANSITION_STEP_NONE.
When get_next_step() returns WP_TRANSITION_STEP_NONE, this function completes the transition, calling the transition's callback and then unref-ing the transition.
When get_next_step() returns WP_TRANSITION_STEP_ERROR, this function calls wp_transition_return_error, unless it has already been called directly by get_next_step().
In error conditions, execute_step() is called once with step being WP_TRANSITION_STEP_ERROR, allowing the implementation to rollback any changes or cancel underlying jobs, if necessary.
Parameters:
self
–
the transition
Wp.Transition.advance
def Wp.Transition.advance (self):
#python wrapper for 'wp_transition_advance'
Advances the transition to the next step.
This initially calls do_get_next_step() in order to determine what the next step is. If do_get_next_step() returns a step different than the previous one, it calls do_execute_step() to execute it.
The very first time that do_get_next_step() is called, its step parameter equals Wp.TransitionStep.NONE.
When do_get_next_step() returns Wp.TransitionStep.NONE, this function completes the transition, calling the transition's callback and then unref-ing the transition.
When do_get_next_step() returns Wp.TransitionStep.ERROR, this function calls Wp.Transition.return_error, unless it has already been called directly by do_get_next_step().
In error conditions, do_execute_step() is called once with step being Wp.TransitionStep.ERROR, allowing the implementation to rollback any changes or cancel underlying jobs, if necessary.
Parameters:
self
(
Wp.Transition
)
–
the transition
Wp.Transition.prototype.advance
function Wp.Transition.prototype.advance(): {
// javascript wrapper for 'wp_transition_advance'
}
Advances the transition to the next step.
This initially calls vfunc_get_next_step() in order to determine what the next step is. If vfunc_get_next_step() returns a step different than the previous one, it calls vfunc_execute_step() to execute it.
The very first time that vfunc_get_next_step() is called, its step parameter equals Wp.TransitionStep.NONE.
When vfunc_get_next_step() returns Wp.TransitionStep.NONE, this function completes the transition, calling the transition's callback and then unref-ing the transition.
When vfunc_get_next_step() returns Wp.TransitionStep.ERROR, this function calls Wp.Transition.prototype.return_error, unless it has already been called directly by vfunc_get_next_step().
In error conditions, vfunc_execute_step() is called once with step being Wp.TransitionStep.ERROR, allowing the implementation to rollback any changes or cancel underlying jobs, if necessary.
Parameters:
self
(
Wp.Transition
)
–
the transition
wp_transition_get_completed
gboolean wp_transition_get_completed (WpTransition * self)
Parameters:
self
–
the transition
Wp.Transition.get_completed
def Wp.Transition.get_completed (self):
#python wrapper for 'wp_transition_get_completed'
Parameters:
self
(
Wp.Transition
)
–
the transition
Wp.Transition.prototype.get_completed
function Wp.Transition.prototype.get_completed(): {
// javascript wrapper for 'wp_transition_get_completed'
}
Parameters:
self
(
Wp.Transition
)
–
the transition
wp_transition_get_data
gpointer wp_transition_get_data (WpTransition * self)
Gets self 's data. See wp_transition_set_data.
Parameters:
self
–
the transition
the transition's data
Wp.Transition.get_data
def Wp.Transition.get_data (self):
#python wrapper for 'wp_transition_get_data'
Gets self 's data. See Wp.Transition.set_data.
Parameters:
self
(
Wp.Transition
)
–
the transition
the transition's data
Wp.Transition.prototype.get_data
function Wp.Transition.prototype.get_data(): {
// javascript wrapper for 'wp_transition_get_data'
}
Gets self 's data. See Wp.Transition.prototype.set_data.
Parameters:
self
(
Wp.Transition
)
–
the transition
the transition's data
wp_transition_get_source_object
gpointer wp_transition_get_source_object (WpTransition * self)
Gets the source object from the transition. Like g_async_result_get_source_object, but does not ref the object.
Parameters:
self
–
the transition
the source object
Wp.Transition.get_source_object
def Wp.Transition.get_source_object (self):
#python wrapper for 'wp_transition_get_source_object'
Gets the source object from the transition. Like Gio.AsyncResult.get_source_object, but does not ref the object.
Parameters:
self
(
Wp.Transition
)
–
the transition
the source object
Wp.Transition.prototype.get_source_object
function Wp.Transition.prototype.get_source_object(): {
// javascript wrapper for 'wp_transition_get_source_object'
}
Gets the source object from the transition. Like Gio.AsyncResult.prototype.get_source_object, but does not ref the object.
Parameters:
self
(
Wp.Transition
)
–
the transition
the source object
wp_transition_get_source_tag
gpointer wp_transition_get_source_tag (WpTransition * self)
Gets self 's source tag. See wp_transition_set_source_tag.
Parameters:
self
–
the transition
the transition's source tag
Wp.Transition.get_source_tag
def Wp.Transition.get_source_tag (self):
#python wrapper for 'wp_transition_get_source_tag'
Gets self 's source tag. See Wp.Transition.set_source_tag.
Parameters:
self
(
Wp.Transition
)
–
the transition
the transition's source tag
Wp.Transition.prototype.get_source_tag
function Wp.Transition.prototype.get_source_tag(): {
// javascript wrapper for 'wp_transition_get_source_tag'
}
Gets self 's source tag. See Wp.Transition.prototype.set_source_tag.
Parameters:
self
(
Wp.Transition
)
–
the transition
the transition's source tag
wp_transition_had_error
gboolean wp_transition_had_error (WpTransition * self)
Parameters:
self
–
the transition
Wp.Transition.had_error
def Wp.Transition.had_error (self):
#python wrapper for 'wp_transition_had_error'
Parameters:
self
(
Wp.Transition
)
–
the transition
Wp.Transition.prototype.had_error
function Wp.Transition.prototype.had_error(): {
// javascript wrapper for 'wp_transition_had_error'
}
Parameters:
self
(
Wp.Transition
)
–
the transition
wp_transition_is_tagged
gboolean wp_transition_is_tagged (WpTransition * self, gpointer tag)
Checks if self has the given tag (generally a function pointer indicating the function self was created by).
Parameters:
self
–
the transition
tag
–
a tag
TRUE if self has the indicated tag , FALSE if not.
Wp.Transition.is_tagged
def Wp.Transition.is_tagged (self, tag):
#python wrapper for 'wp_transition_is_tagged'
Checks if self has the given tag (generally a function pointer indicating the function self was created by).
TRUE if self has the indicated tag , FALSE if not.
Wp.Transition.prototype.is_tagged
function Wp.Transition.prototype.is_tagged(tag: Object): {
// javascript wrapper for 'wp_transition_is_tagged'
}
Checks if self has the given tag (generally a function pointer indicating the function self was created by).
TRUE if self has the indicated tag , FALSE if not.
wp_transition_return_error
wp_transition_return_error (WpTransition * self, GError * error)
Completes the transition with an error. This can be called anytime from within any virtual function or an async job handler.
Note that in most cases this will also unref the transition, so it is not safe to access it after this function has been called.
Wp.Transition.return_error
def Wp.Transition.return_error (self, error):
#python wrapper for 'wp_transition_return_error'
Completes the transition with an error. This can be called anytime from within any virtual function or an async job handler.
Note that in most cases this will also unref the transition, so it is not safe to access it after this function has been called.
Wp.Transition.prototype.return_error
function Wp.Transition.prototype.return_error(error: GLib.Error): {
// javascript wrapper for 'wp_transition_return_error'
}
Completes the transition with an error. This can be called anytime from within any virtual function or an async job handler.
Note that in most cases this will also unref the transition, so it is not safe to access it after this function has been called.
wp_transition_set_data
wp_transition_set_data (WpTransition * self, gpointer data, GDestroyNotify data_destroy)
Sets self 's data (freeing the existing data, if any). This can be an arbitrary user structure that holds data associated with this transition.
Parameters:
self
–
the transition
data
(
[nullable]
)
–
transition-specific user data
data_destroy
(
[nullable]
)
–
GDestroyNotify for data
Wp.Transition.set_data
def Wp.Transition.set_data (self, data, data_destroy):
#python wrapper for 'wp_transition_set_data'
Sets self 's data (freeing the existing data, if any). This can be an arbitrary user structure that holds data associated with this transition.
Parameters:
self
(
Wp.Transition
)
–
the transition
data
(
object
)
–
transition-specific user data
data_destroy
(
GLib.DestroyNotify
)
–
GLib.DestroyNotify for data
Wp.Transition.prototype.set_data
function Wp.Transition.prototype.set_data(data: Object, data_destroy: GLib.DestroyNotify): {
// javascript wrapper for 'wp_transition_set_data'
}
Sets self 's data (freeing the existing data, if any). This can be an arbitrary user structure that holds data associated with this transition.
Parameters:
self
(
Wp.Transition
)
–
the transition
data
(
Object
)
–
transition-specific user data
data_destroy
(
GLib.DestroyNotify
)
–
GLib.DestroyNotify for data
wp_transition_set_source_tag
wp_transition_set_source_tag (WpTransition * self, gpointer tag)
Sets self 's source tag. You can use this to tag a transition's return value with a particular pointer (usually a pointer to the function doing the tagging) and then later check it using wp_transition_get_source_tag (or g_async_result_is_tagged) in the transition's "finish" function, to figure out if the response came from a particular place.
Parameters:
self
–
the transition
tag
–
an opaque pointer indicating the source of this transition
Wp.Transition.set_source_tag
def Wp.Transition.set_source_tag (self, tag):
#python wrapper for 'wp_transition_set_source_tag'
Sets self 's source tag. You can use this to tag a transition's return value with a particular pointer (usually a pointer to the function doing the tagging) and then later check it using Wp.Transition.get_source_tag (or Gio.AsyncResult.is_tagged) in the transition's "finish" function, to figure out if the response came from a particular place.
Parameters:
self
(
Wp.Transition
)
–
the transition
tag
(
object
)
–
an opaque pointer indicating the source of this transition
Wp.Transition.prototype.set_source_tag
function Wp.Transition.prototype.set_source_tag(tag: Object): {
// javascript wrapper for 'wp_transition_set_source_tag'
}
Sets self 's source tag. You can use this to tag a transition's return value with a particular pointer (usually a pointer to the function doing the tagging) and then later check it using Wp.Transition.prototype.get_source_tag (or Gio.AsyncResult.prototype.is_tagged) in the transition's "finish" function, to figure out if the response came from a particular place.
Parameters:
self
(
Wp.Transition
)
–
the transition
tag
(
Object
)
–
an opaque pointer indicating the source of this transition
Functions
wp_transition_finish
gboolean wp_transition_finish (GAsyncResult * res, GError ** error)
This is meant to be called from within the GAsyncReadyCallback that was specified in wp_transition_new. It returns the final return status of the transition and its error, if there was one.
Parameters:
res
–
a transition, as a GAsyncResult
error
(
[out]
[optional]
)
–
a location to return the transition's error, if any
Wp.Transition.finish
@raises(GLib.GError)
def Wp.Transition.finish (res):
#python wrapper for 'wp_transition_finish'
This is meant to be called from within the Gio.AsyncReadyCallback that was specified in Wp.Transition.new. It returns the final return status of the transition and its error, if there was one.
Parameters:
res
(
Gio.AsyncResult
)
–
a transition, as a Gio.AsyncResult
Wp.Transition.prototype.finish
function Wp.Transition.prototype.finish(res: Gio.AsyncResult): {
// javascript wrapper for 'wp_transition_finish'
}
This is meant to be called from within the Gio.AsyncReadyCallback that was specified in Wp.Transition.prototype.new. It returns the final return status of the transition and its error, if there was one.
Parameters:
res
(
Gio.AsyncResult
)
–
a transition, as a Gio.AsyncResult
Properties
Virtual Methods
execute_step
execute_step (WpTransition * transition, guint step)
Parameters:
transition
–
step
–
do_execute_step
def do_execute_step (transition, step):
#python implementation of the 'execute_step' virtual method
Parameters:
transition
(
Wp.Transition
)
–
step
(
int
)
–
vfunc_execute_step
function vfunc_execute_step(transition: Wp.Transition, step: Number): {
// javascript implementation of the 'execute_step' virtual method
}
See Wp.Transition.prototype.advance
Parameters:
transition
(
Wp.Transition
)
–
step
(
Number
)
–
get_next_step
guint get_next_step (WpTransition * transition, guint step)
Parameters:
transition
–
step
–
do_get_next_step
def do_get_next_step (transition, step):
#python implementation of the 'get_next_step' virtual method
Parameters:
transition
(
Wp.Transition
)
–
step
(
int
)
–
vfunc_get_next_step
function vfunc_get_next_step(transition: Wp.Transition, step: Number): {
// javascript implementation of the 'get_next_step' virtual method
}
See Wp.Transition.prototype.advance
Parameters:
transition
(
Wp.Transition
)
–
step
(
Number
)
–
Enumerations
WpTransitionStep
Members
WP_TRANSITION_STEP_NONE
(0)
–
the initial and final step of the transition
WP_TRANSITION_STEP_ERROR
(1)
–
returned by get_next_step() in case of an error
WP_TRANSITION_STEP_CUSTOM_START
(16)
–
starting value for steps defined in subclasses
Wp.TransitionStep
Members
Wp.TransitionStep.NONE
(0)
–
the initial and final step of the transition
Wp.TransitionStep.ERROR
(1)
–
returned by do_get_next_step() in case of an error
Wp.TransitionStep.CUSTOM_START
(16)
–
starting value for steps defined in subclasses
Wp.TransitionStep
Members
Wp.TransitionStep.NONE
(0)
–
the initial and final step of the transition
Wp.TransitionStep.ERROR
(1)
–
returned by vfunc_get_next_step() in case of an error
Wp.TransitionStep.CUSTOM_START
(16)
–
starting value for steps defined in subclasses
Constants
The results of the search are