static void backend_get_details_thread(PkBackendJob *job, GVariant *params, gpointer user_data) { gchar **package_ids; PkRoleEnum role; role = pk_backend_job_get_role(job); g_variant_get(params, "(^a&s)", &package_ids); AptIntf *apt = static_cast<AptIntf*>(pk_backend_job_get_user_data(job)); if (!apt->init()) { g_debug ("Failed to create apt cache"); return; } if (package_ids == NULL) { pk_backend_job_error_code(job, PK_ERROR_ENUM_PACKAGE_ID_INVALID, "Invalid package id"); return; } pk_backend_job_set_status(job, PK_STATUS_ENUM_QUERY); PkgList pkgs = apt->resolvePackageIds(package_ids); if (role == PK_ROLE_ENUM_GET_UPDATE_DETAIL) { apt->emitUpdateDetails(pkgs); } else { apt->emitDetails(pkgs); } }
static void backend_get_details_thread(PkBackendJob *job, GVariant *params, gpointer user_data) { gchar **package_ids = nullptr; gchar **files = nullptr; PkRoleEnum role; role = pk_backend_job_get_role(job); if (role == PK_ROLE_ENUM_GET_DETAILS_LOCAL) { g_variant_get(params, "(^a&s)", &files); } else { g_variant_get(params, "(^a&s)", &package_ids); } AptIntf *apt = static_cast<AptIntf*>(pk_backend_job_get_user_data(job)); if (!apt->init(files)) { g_debug ("Failed to create apt cache"); return; } pk_backend_job_set_status(job, PK_STATUS_ENUM_QUERY); PkgList pkgs; if (role == PK_ROLE_ENUM_GET_DETAILS_LOCAL) { pkgs = apt->resolveLocalFiles(files); } else { pkgs = apt->resolvePackageIds(package_ids); } if (role == PK_ROLE_ENUM_GET_UPDATE_DETAIL) { apt->emitUpdateDetails(pkgs); } else { apt->emitDetails(pkgs); } }