本文整理汇总了C++中PK_IS_BACKEND_JOB函数的典型用法代码示例。如果您正苦于以下问题:C++ PK_IS_BACKEND_JOB函数的具体用法?C++ PK_IS_BACKEND_JOB怎么用?C++ PK_IS_BACKEND_JOB使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PK_IS_BACKEND_JOB函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pk_backend_job_require_restart
/**
* pk_backend_job_require_restart:
**/
void
pk_backend_job_require_restart (PkBackendJob *job,
PkRestartEnum restart,
const gchar *package_id)
{
_cleanup_object_unref_ PkRequireRestart *item = NULL;
g_return_if_fail (PK_IS_BACKEND_JOB (job));
/* have we already set an error? */
if (job->priv->set_error) {
g_warning ("already set error: require-restart %s", pk_restart_enum_to_string (restart));
return;
}
/* check we are valid */
if (!pk_package_id_check (package_id)) {
g_warning ("package_id invalid and cannot be processed: %s", package_id);
return;
}
/* form PkRequireRestart struct */
item = pk_require_restart_new ();
g_object_set (item,
"restart", restart,
"package-id", package_id,
NULL);
/* emit */
pk_backend_job_call_vfunc (job,
PK_BACKEND_SIGNAL_REQUIRE_RESTART,
g_object_ref (item),
g_object_unref);
}
示例2: pk_backend_job_set_transaction_flags
/**
* pk_backend_job_set_transaction_flags:
**/
void
pk_backend_job_set_transaction_flags (PkBackendJob *job,
PkBitfield transaction_flags)
{
g_return_if_fail (PK_IS_BACKEND_JOB (job));
job->priv->transaction_flags = transaction_flags;
}
示例3: pk_backend_job_thread_create
/**
* pk_backend_job_thread_create:
* @func: (scope call):
**/
gboolean
pk_backend_job_thread_create (PkBackendJob *job,
PkBackendJobThreadFunc func,
gpointer user_data,
GDestroyNotify destroy_func)
{
PkBackendJobThreadHelper *helper = NULL;
g_return_val_if_fail (PK_IS_BACKEND_JOB (job), FALSE);
g_return_val_if_fail (func != NULL, FALSE);
g_return_val_if_fail (pk_is_thread_default (), FALSE);
/* create a helper object to allow us to call a _setup() function */
helper = g_new0 (PkBackendJobThreadHelper, 1);
helper->job = g_object_ref (job);
helper->backend = job->priv->backend;
helper->func = func;
helper->user_data = user_data;
/* create a thread and unref it immediately as we do not need to join()
* this at any stage */
g_thread_unref (g_thread_new ("PK-Backend",
pk_backend_job_thread_setup,
helper));
return TRUE;
}
示例4: pk_backend_job_thread_create
/**
* pk_backend_job_thread_create:
* @func: (scope call):
**/
gboolean
pk_backend_job_thread_create (PkBackendJob *job,
PkBackendJobThreadFunc func,
gpointer user_data,
GDestroyNotify destroy_func)
{
PkBackendJobThreadHelper *helper = NULL;
g_return_val_if_fail (PK_IS_BACKEND_JOB (job), FALSE);
g_return_val_if_fail (func != NULL, FALSE);
g_return_val_if_fail (pk_is_thread_default (), FALSE);
if (job->priv->thread != NULL) {
g_warning ("already has thread");
return FALSE;
}
/* create a helper object to allow us to call a _setup() function */
helper = g_new0 (PkBackendJobThreadHelper, 1);
helper->job = g_object_ref (job);
helper->backend = job->priv->backend;
helper->func = func;
helper->user_data = user_data;
/* create a thread */
job->priv->thread = g_thread_new ("PK-Backend",
pk_backend_job_thread_setup,
helper);
if (job->priv->thread == NULL) {
g_warning ("failed to create thread");
return FALSE;
}
return TRUE;
}
示例5: pk_backend_job_set_download_size_remaining
/**
* pk_backend_job_set_download_size_remaining:
**/
void
pk_backend_job_set_download_size_remaining (PkBackendJob *job, guint64 download_size_remaining)
{
guint64 *tmp;
g_return_if_fail (PK_IS_BACKEND_JOB (job));
/* have we already set an error? */
if (job->priv->set_error) {
g_warning ("already set error: download-size-remaining");
return;
}
/* set the same twice? */
if (job->priv->download_size_remaining == download_size_remaining)
return;
/* set new value */
job->priv->download_size_remaining = download_size_remaining;
/* we can't squash a 64bit value into a pointer on a 32bit arch */
tmp = g_new0 (guint64, 1);
*tmp = download_size_remaining;
pk_backend_job_call_vfunc (job,
PK_BACKEND_SIGNAL_DOWNLOAD_SIZE_REMAINING,
tmp,
g_free);
}
示例6: pk_backend_job_category
/**
* pk_backend_job_category:
**/
void
pk_backend_job_category (PkBackendJob *job,
const gchar *parent_id,
const gchar *cat_id,
const gchar *name,
const gchar *summary,
const gchar *icon)
{
_cleanup_object_unref_ PkCategory *item = NULL;
g_return_if_fail (PK_IS_BACKEND_JOB (job));
g_return_if_fail (cat_id != NULL);
/* have we already set an error? */
if (job->priv->set_error) {
g_warning ("already set error: category %s", cat_id);
return;
}
/* form PkCategory struct */
item = pk_category_new ();
g_object_set (item,
"parent-id", parent_id,
"cat-id", cat_id,
"name", name,
"summary", summary,
"icon", icon,
NULL);
/* emit */
pk_backend_job_call_vfunc (job,
PK_BACKEND_SIGNAL_CATEGORY,
g_object_ref (item),
g_object_unref);
}
示例7: pk_backend_job_error_code
/**
* pk_backend_job_error_code:
**/
void
pk_backend_job_error_code (PkBackendJob *job,
PkErrorEnum error_code,
const gchar *format, ...)
{
va_list args;
gboolean need_untrusted;
_cleanup_free_ gchar *buffer = NULL;
_cleanup_object_unref_ PkError *error = NULL;
g_return_if_fail (PK_IS_BACKEND_JOB (job));
va_start (args, format);
buffer = g_strdup_vprintf (format, args);
va_end (args);
/* did we set a duplicate error? (we can override LOCK_REQUIRED errors,
* so the transaction list can fail transactions) */
if (job->priv->set_error) {
if (job->priv->last_error_code == PK_ERROR_ENUM_LOCK_REQUIRED) {
/* reset the exit status, we're resetting the error now */
job->priv->exit = PK_EXIT_ENUM_UNKNOWN;
job->priv->finished = FALSE;
} else {
g_warning ("More than one error emitted! You tried to set '%s'", buffer);
return;
}
}
job->priv->set_error = TRUE;
/* some error codes have a different exit code */
need_untrusted = pk_backend_job_error_code_is_need_untrusted (error_code);
if (need_untrusted)
pk_backend_job_set_exit_code (job, PK_EXIT_ENUM_NEED_UNTRUSTED);
else if (error_code == PK_ERROR_ENUM_CANCELLED_PRIORITY)
pk_backend_job_set_exit_code (job, PK_EXIT_ENUM_CANCELLED_PRIORITY);
else if (job->priv->exit == PK_EXIT_ENUM_UNKNOWN)
pk_backend_job_set_exit_code (job, PK_EXIT_ENUM_FAILED);
/* set the hint that RepairSystem is needed */
if (error_code == PK_ERROR_ENUM_UNFINISHED_TRANSACTION) {
pk_backend_job_set_exit_code (job, PK_EXIT_ENUM_REPAIR_REQUIRED);
}
/* save so we can check the parallel failure later */
job->priv->last_error_code = error_code;
/* form PkError struct */
error = pk_error_new ();
g_object_set (error,
"code", error_code,
"details", buffer,
NULL);
/* emit */
pk_backend_job_call_vfunc (job,
PK_BACKEND_SIGNAL_ERROR_CODE,
g_object_ref (error),
g_object_unref);
}
示例8: pk_backend_job_media_change_required
/**
* pk_backend_job_media_change_required:
**/
void
pk_backend_job_media_change_required (PkBackendJob *job,
PkMediaTypeEnum media_type,
const gchar *media_id,
const gchar *media_text)
{
_cleanup_object_unref_ PkMediaChangeRequired *item = NULL;
g_return_if_fail (PK_IS_BACKEND_JOB (job));
g_return_if_fail (media_id != NULL);
g_return_if_fail (media_text != NULL);
/* have we already set an error? */
if (job->priv->set_error) {
g_warning ("already set error: media change required");
return;
}
/* form PkMediaChangeRequired struct */
item = pk_media_change_required_new ();
g_object_set (item,
"media-type", media_type,
"media-id", media_id,
"media-text", media_text,
NULL);
/* emit */
pk_backend_job_call_vfunc (job,
PK_BACKEND_SIGNAL_MEDIA_CHANGE_REQUIRED,
g_object_ref (item),
g_object_unref);
}
示例9: pk_backend_job_repo_detail
/**
* pk_backend_job_repo_detail:
**/
void
pk_backend_job_repo_detail (PkBackendJob *job,
const gchar *repo_id,
const gchar *description,
gboolean enabled)
{
_cleanup_object_unref_ PkRepoDetail *item = NULL;
g_return_if_fail (PK_IS_BACKEND_JOB (job));
g_return_if_fail (repo_id != NULL);
/* have we already set an error? */
if (job->priv->set_error) {
g_warning ("already set error: repo-detail %s", repo_id);
return;
}
/* form PkRepoDetail struct */
item = pk_repo_detail_new ();
g_object_set (item,
"repo-id", repo_id,
"description", description,
"enabled", enabled,
NULL);
/* emit */
pk_backend_job_call_vfunc (job,
PK_BACKEND_SIGNAL_REPO_DETAIL,
g_object_ref (item),
g_object_unref);
}
示例10: pk_backend_job_set_item_progress
/**
* pk_backend_job_set_item_progress:
**/
void
pk_backend_job_set_item_progress (PkBackendJob *job,
const gchar *package_id,
PkStatusEnum status,
guint percentage)
{
PkItemProgress *item;
g_return_if_fail (PK_IS_BACKEND_JOB (job));
/* have we already set an error? */
if (job->priv->set_error) {
g_warning ("already set error: item-progress %i", percentage);
return;
}
/* invalid number? */
if (percentage > 100 && percentage != PK_BACKEND_PERCENTAGE_INVALID) {
g_debug ("invalid number %i", percentage);
return;
}
/* emit */
item = g_object_new (PK_TYPE_ITEM_PROGRESS,
"package-id", package_id,
"status", status,
"percentage", percentage,
NULL);
pk_backend_job_call_vfunc (job,
PK_BACKEND_SIGNAL_ITEM_PROGRESS,
g_object_ref (item),
g_object_unref);
g_object_unref (item);
}
示例11: pk_backend_job_distro_upgrade
/**
* pk_backend_job_distro_upgrade:
**/
void
pk_backend_job_distro_upgrade (PkBackendJob *job,
PkDistroUpgradeEnum state,
const gchar *name,
const gchar *summary)
{
_cleanup_object_unref_ PkDistroUpgrade *item = NULL;
g_return_if_fail (PK_IS_BACKEND_JOB (job));
g_return_if_fail (state != PK_DISTRO_UPGRADE_ENUM_UNKNOWN);
g_return_if_fail (name != NULL);
g_return_if_fail (summary != NULL);
/* have we already set an error? */
if (job->priv->set_error) {
g_warning ("already set error: distro-upgrade");
return;
}
/* form PkDistroUpgrade struct */
item = pk_distro_upgrade_new ();
g_object_set (item,
"state", state,
"name", name,
"summary", summary,
NULL);
/* emit */
pk_backend_job_call_vfunc (job,
PK_BACKEND_SIGNAL_DISTRO_UPGRADE,
g_object_ref (item),
g_object_unref);
}
示例12: pk_backend_job_set_parameters
/**
* pk_backend_job_set_parameters:
**/
void
pk_backend_job_set_parameters (PkBackendJob *job, GVariant *params)
{
g_return_if_fail (PK_IS_BACKEND_JOB (job));
g_return_if_fail (params != NULL);
job->priv->params = g_variant_ref_sink (params);
}
示例13: pk_backend_job_set_cmdline
/**
* pk_backend_job_set_cmdline:
**/
void
pk_backend_job_set_cmdline (PkBackendJob *job, const gchar *cmdline)
{
g_return_if_fail (PK_IS_BACKEND_JOB (job));
g_free (job->priv->cmdline);
job->priv->cmdline = g_strdup (cmdline);
g_debug ("install cmdline now %s", job->priv->cmdline);
}
示例14: pk_backend_job_set_status
/**
* pk_backend_job_set_status:
**/
void
pk_backend_job_set_status (PkBackendJob *job, PkStatusEnum status)
{
g_return_if_fail (PK_IS_BACKEND_JOB (job));
/* already this? */
if (job->priv->status == status)
return;
/* have we already set an error? */
if (job->priv->set_error && status != PK_STATUS_ENUM_FINISHED) {
g_warning ("already set error: status %s",
pk_status_enum_to_string (status));
return;
}
/* backends don't do this */
if (status == PK_STATUS_ENUM_WAIT) {
g_warning ("backend tried to status WAIT");
return;
}
/* do we have to enumate a running call? */
if (status != PK_STATUS_ENUM_RUNNING && status != PK_STATUS_ENUM_SETUP) {
if (job->priv->status == PK_STATUS_ENUM_SETUP) {
/* emit */
pk_backend_job_call_vfunc (job,
PK_BACKEND_SIGNAL_STATUS_CHANGED,
GUINT_TO_POINTER (PK_STATUS_ENUM_RUNNING),
NULL);
}
}
job->priv->status = status;
/* don't emit some states when simulating */
if (pk_bitfield_contain (job->priv->transaction_flags,
PK_TRANSACTION_FLAG_ENUM_SIMULATE)) {
switch (status) {
case PK_STATUS_ENUM_DOWNLOAD:
case PK_STATUS_ENUM_UPDATE:
case PK_STATUS_ENUM_INSTALL:
case PK_STATUS_ENUM_REMOVE:
case PK_STATUS_ENUM_CLEANUP:
case PK_STATUS_ENUM_OBSOLETE:
return;
default:
break;
}
}
/* emit */
pk_backend_job_call_vfunc (job,
PK_BACKEND_SIGNAL_STATUS_CHANGED,
GUINT_TO_POINTER (status),
NULL);
}
示例15: pk_backend_job_set_uid
/**
* pk_backend_job_set_uid:
**/
void
pk_backend_job_set_uid (PkBackendJob *job, guint uid)
{
g_return_if_fail (PK_IS_BACKEND_JOB (job));
if (job->priv->uid == uid)
return;
job->priv->uid = uid;
g_debug ("install uid now %i", job->priv->uid);
}