packagekit/docs/migration-glib-to-glib2.txt
Richard Hughes b8edbb09f7 Switch to a 100% GObject design in packagekit-glib2, and get rid of the typedef'd PkItemX structures
This allows packagekit-glib2 to be trivially bound by other runtimes
and also allows us to add properties in the future without breaking ABI.
2009-10-22 12:04:44 +01:00

41 lines
2.2 KiB
Plaintext

Migration from glib to glib2
This document will explain how to migrate client code and backends from packagekit-glib to
packagekit-glib2.
The following is a conversion table that may be helpful:
________________________________________________________________________________________________
| packagekit-glib | packagekit-glib2 |
|_______________________________________________|_______________________________________________|
| | |
| #include <packagekit-glib/packagekit.h> | #include <packagekit-glib2/packagekit.h> |
| PkTaskListItem | PkTransactionList -- see client/pk-monitor.c |
| PkConnection | <nothing> -- signal moved to PkControl |
| pk_client_cancel | g_cancellable_cancel() |
| pk_service_pack_set_filename | <nothing> -- now an asynchronous method |
| pk_package_ids_from_array | pk_ptr_array_to_strv |
| PkPackageId | Just a gchar * of the package_id |
| pk_package_id_new_from_string | " " |
| pk_package_id_get_name | pk_package_id_split() [PK_PACKAGE_ID_NAME] |
| pk_package_id_get_version | pk_package_id_split() [PK_PACKAGE_ID_VERSION] |
| pk_package_id_get_arch | pk_package_id_split() [PK_PACKAGE_ID_ARCH] |
| pk_package_id_get_data | pk_package_id_split() [PK_PACKAGE_ID_DATA] |
| PkPackageObj | PkPackage |
| pk_package_obj_new_from_data() | pk_item_package_new() |
| PkObjList | GPtrArray |
| obj (as in structure references) | item |
| | |
|_______________________________________________|_______________________________________________|
The biggest differences in the glib to glib2 migration is that all the PkClient and
PkControl methods are available with asyncronous versions. This means that where
possible GUI clients should try to defer processing results until after they have
setup the windows. This will make the applications feel "faster" to startup.
Also see the documentation for PkTask. It's designed to make a lot of the interactions
a lot easier, especially when writing GUI and text mode clients that use PackageKit.
Please bear in mind that although glib is still shipped and supported, it will be removed
in PackageKit 0.6.x, and code will need to be converted by then.