static PkPackageId* _get_id_from_pkg(slapt_pkg_info_t *pkg) { PkPackageId *pi; gchar **fields; const gchar *version; const char *data; fields = g_strsplit(pkg->version, "-", 3); version = g_strdup_printf("%s-%s", fields[0], fields[2]); data = pkg->installed ? "installed" : "available"; /* TODO: source */ pi = pk_package_id_new_from_list(pkg->name, version, fields[1], data); g_free((gpointer) version); g_strfreev(fields); return pi; }
/** * pk_package_id_copy: * @id: the %PkPackageId structure to copy * * Copies into a new #PkPackageId object. * * Return value: a new #PkPackageId object **/ PkPackageId * pk_package_id_copy (const PkPackageId *id) { return pk_package_id_new_from_list (id->name, id->version, id->arch, id->data); }