PackageKit Reference Manual |
---|
By default, a packagekit backend operates in a mode where only one activity is done at one time, for example, epiphany is downloaded and then installed. Some backends are able to download or install multiple files at once, and this may need to be conveyed to a GUI tool as a list of variable length, rather than just a package_id and summary.
The function pk_backend_set_simultaneous_mode(TRUE)
is used to turn on
the simultaneous operation, where the backend can control the finished status of the
::Package()
calls.
This is not needed for a typical backend.
For instance, a typical non-simultaneous backend might do:
1. pk_backend_package(DOWNLOADING, "epiphany")
2. pk_backend_package(DOWNLOADING, "nautilus")
3. pk_backend_package(INSTALLING, "epiphany")
4. pk_backend_package(INSTALLING, "nautilus")
5. pk_backend_finished(SUCCESS)
This is translated by the daemon automatically into a coherent sequence that can be used to update a GUI with the correct information. This is done automatically and transparently from the backend. The effective output from the daemon would be:
1. pk_backend_package(DOWNLOADING, "epiphany")
2. pk_backend_package(FINISHED, "epiphany")
pk_backend_package(DOWNLOADING, "nautilus")
3. pk_backend_package(FINISHED, "nautilus")
pk_backend_package(INSTALLING, "epiphany")
4. pk_backend_package(FINISHED, "epiphany")
pk_backend_package(INSTALLING, "nautilus")
5. pk_backend_package(FINISHED, "nautilus")
pk_backend_finished(SUCCESS)
For a simultaneous backend, the backend is in full control of the FINISHED
state of the package actions.
This way it is possible to show the status of multiple packages in the GUI programs.
For instance, a typical simultaneous backend might do:
1. pk_backend_set_simultaneous_mode(TRUE)
2. pk_backend_package(DOWNLOADING, "epiphany")
3. pk_backend_package(DOWNLOADING, "nautilus")
4. pk_backend_package(FINISHED, "nautilus")
pk_backend_package(INSTALLING, "nautilus")
5. pk_backend_package(FINISHED, "epiphany")
pk_backend_package(INSTALLING, "epiphany")
6. pk_backend_package(FINISHED, "nautilus")
7. pk_backend_package(FINISHED, "epiphany")
pk_backend_finished(SUCCESS)