Class
FwupdPluginProgress
Description [src]
final class FwupdPlugin.Progress : GObject.Object {
/* No available fields */
}
Objects can use fu_progress_set_percentage()
if the absolute percentage
is known. Percentages should always go up, not down.
Modules usually set the number of steps that are expected using
fu_progress_set_steps()
and then after each section is completed,
the fu_progress_step_done()
function should be called. This will automatically
call fu_progress_set_percentage()
with the correct values.
FuProgress
allows sub-modules to be “chained up” to the parent module
so that as the sub-module progresses, so does the parent.
The child can be reused for each section, and chains can be deep.
To get a child object, you should use fu_progress_get_child()
. and then
use the result in any sub-process. You should ensure that the child
is not re-used without calling fu_progress_step_done().
There are a few nice touches in this module, so that if a module only has one progress step, the child progress is used for parent updates.
static void _do_something(FuProgress *self) { // setup correct number of steps fu_progress_set_steps(self, 2);
// run a sub function
_do_something_else1(fu_progress_get_child(self));
// this section done
fu_progress_step_done(self);
// run another sub function
_do_something_else2(fu_progress_get_child(self));
// this progress done (all complete)
fu_progress_step_done(self);
}
See also: FuDevice
Instance methods
fu_progress_add_step
This sets the step weighting, which you will want to do if one action will take a bigger chunk of time than another.
since: 1.8.2
fu_progress_finished
Called when the step_now sub-task wants to finish early and still complete.
since: 1.7.0
fu_progress_get_child
Monitor a child and proxy back up to the parent with the correct percentage.
since: 1.7.0
fu_progress_get_name
Return the nice name of the progress, which is normally set by the caller.
since: 1.8.2
fu_progress_get_status
Return the status of the progress, which is normally indirectly by fu_progress_add_step().
since: 1.7.0
fu_progress_get_steps
Gets the number of sub-tasks, i.e. how many times the fu_progress_step_done()
function will be called in the loop.
since: 1.7.0
fu_progress_set_percentage_full
Sets the progress completion using the raw progress values.
since: 1.7.0
fu_progress_set_profile
This enables profiling of FuProgress. This may be useful in development,
but be warned; enabling profiling makes FuProgress
very slow.
since: 1.7.0
fu_progress_set_steps
Sets the number of sub-tasks, i.e. how many times the fu_progress_step_done()
function will be called in the loop.
since: 1.7.0
Signals
FwupdPlugin.Progress::percentage-changed
The ::percentage-changed signal is emitted when the tasks completion has changed.
since: 1.7.0
FwupdPlugin.Progress::status-changed
The ::status-changed signal is emitted when the task status has changed.
since: 1.7.0
Signals inherited from GObject (1)
GObject::notify
The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.