本文整理汇总了C++中pk_backend_job_finished函数的典型用法代码示例。如果您正苦于以下问题:C++ pk_backend_job_finished函数的具体用法?C++ pk_backend_job_finished怎么用?C++ pk_backend_job_finished使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pk_backend_job_finished函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pk_backend_finish
gboolean
pk_backend_finish (PkBackend *self, GError *error)
{
gboolean cancelled = FALSE;
g_return_val_if_fail (self != NULL, FALSE);
pk_backend_job_set_allow_cancel (self, FALSE);
g_static_mutex_lock (&mutex);
if (cancellable != NULL) {
cancelled = g_cancellable_is_cancelled (cancellable);
g_object_unref (cancellable);
cancellable = NULL;
}
g_static_mutex_unlock (&mutex);
if (error != NULL) {
pk_backend_error (self, error);
g_error_free (error);
}
if (cancelled) {
pk_backend_job_set_status (self, PK_STATUS_ENUM_CANCEL);
}
pk_backend_job_finished (self);
return (error == NULL);
}
示例2: pk_backend_job_thread_setup
/**
* pk_backend_job_thread_setup:
**/
static gpointer
pk_backend_job_thread_setup (gpointer thread_data)
{
PkBackendJobThreadHelper *helper = (PkBackendJobThreadHelper *) thread_data;
/* run original function with automatic locking */
pk_backend_thread_start (helper->backend, helper->job, helper->func);
helper->func (helper->job, helper->job->priv->params, helper->user_data);
pk_backend_job_finished (helper->job);
pk_backend_thread_stop (helper->backend, helper->job, helper->func);
/* set idle IO priority */
#ifdef PK_BUILD_DAEMON
if (helper->job->priv->background == TRUE) {
g_debug ("setting ioprio class to idle");
pk_ioprio_set_idle (0);
}
#endif
/* unref the thread here as it holds a reference itself and we do
* not need to join() this at any stage */
g_thread_unref (helper->job->priv->thread);
/* destroy helper */
g_object_unref (helper->job);
if (helper->destroy_func != NULL)
helper->destroy_func (helper->user_data);
g_free (helper);
/* no return value */
return NULL;
}
示例3: pk_backend_search_names
/**
* pk_backend_search_names:
*/
void
pk_backend_search_names (PkBackend *backend, PkBackendJob *job, PkBitfield filters, gchar **values)
{
pk_backend_job_error_code (job, PK_ERROR_ENUM_INTERNAL_ERROR,
"Error number 1");
pk_backend_job_finished (job);
}
示例4: pk_backend_upgrade_system
/**
* pk_backend_upgrade_system:
*/
void
pk_backend_upgrade_system (PkBackend *backend, PkBackendJob *job, PkBitfield transaction_flags, const gchar *distro_id, PkUpgradeKindEnum upgrade_kind)
{
pk_backend_job_error_code (job, PK_ERROR_ENUM_INSTALL_ROOT_INVALID,
"Cannot find boot partition");
pk_backend_job_finished (job);
}
示例5: pk_backend_search_name_timeout
/**
* pk_backend_search_name_timeout:
**/
static gboolean
pk_backend_search_name_timeout (gpointer data)
{
PkBackendJob *job = (PkBackendJob *) data;
pk_backend_job_finished (job);
return FALSE;
}
示例6: backend_install_packages_thread
static void
backend_install_packages_thread (PkBackendJob *job, GVariant *params, gpointer user_data)
{
gint err, i;
gchar **package_ids;
gchar **parts;
package_ids = pk_backend_get_strv (backend, "pkids");
err = 0;
for (i = 0; package_ids[i]; i++)
{
pk_backend_job_package (job, PK_INFO_ENUM_INSTALLING, package_ids[i], NULL);
parts = pk_package_id_split (package_ids[i]);
err = opkg_install_package (parts[PK_PACKAGE_ID_NAME], pk_opkg_progress_cb, backend);
if (err)
handle_install_error (backend, err);
g_strfreev (parts);
if (err != 0)
break;
}
pk_backend_job_finished (job);
}
示例7: pk_backend_spawn_exit_cb
static void
pk_backend_spawn_exit_cb (PkSpawn *spawn, PkSpawnExitType exit_enum, PkBackendSpawn *backend_spawn)
{
gboolean ret;
g_return_if_fail (PK_IS_BACKEND_SPAWN (backend_spawn));
/* reset the busy flag */
backend_spawn->priv->is_busy = FALSE;
/* if we force killed the process, set an error */
if (exit_enum == PK_SPAWN_EXIT_TYPE_SIGKILL) {
/* we just call this failed, and set an error */
pk_backend_job_error_code (backend_spawn->priv->job, PK_ERROR_ENUM_PROCESS_KILL,
"Process had to be killed to be cancelled");
}
if (exit_enum == PK_SPAWN_EXIT_TYPE_DISPATCHER_EXIT ||
exit_enum == PK_SPAWN_EXIT_TYPE_DISPATCHER_CHANGED) {
g_debug ("dispatcher exited, nothing to see here");
return;
}
/* only emit if not finished */
if (!backend_spawn->priv->finished) {
g_debug ("script exited without doing finished, tidying up");
ret = pk_backend_job_has_set_error_code (backend_spawn->priv->job);
if (!ret) {
pk_backend_job_error_code (backend_spawn->priv->job,
PK_ERROR_ENUM_INTERNAL_ERROR,
"The backend exited unexpectedly. "
"This is a serious error as the spawned backend did not complete the pending transaction.");
}
pk_backend_job_finished (backend_spawn->priv->job);
}
}
示例8: pk_backend_get_update_detail_thread
static void pk_backend_get_update_detail_thread(PkBackendJob *job, GVariant *params, gpointer user_data) {
guint i;
gchar **pkg_ids;
pk_backend_job_set_status(job, PK_STATUS_ENUM_QUERY);
g_variant_get(params, "(^a&s)", &pkg_ids);
for (i = 0; pkg_ids[i] != NULL; i++) {
pk_backend_job_update_detail (job,
pkg_ids[i],
NULL,
NULL,
NULL,
NULL,
NULL,
PK_RESTART_ENUM_NONE,
NULL,
NULL,
PK_UPDATE_STATE_ENUM_STABLE,
NULL,
NULL);
}
pk_backend_job_finished (job);
}
示例9: pk_backend_repo_enable_thread
static void
pk_backend_repo_enable_thread (PkBackendJob *job, GVariant *params, gpointer user_data)
{
const gchar *repo;
GError *error = NULL;
g_return_val_if_fail (self != NULL, FALSE);
g_return_val_if_fail (disabled != NULL, FALSE);
repo = pk_backend_get_string (self, "repo_id");
if (g_hash_table_remove (disabled, repo)) {
/* reload configuration to preserve ordering */
if (disabled_repos_configure (disabled, &error)) {
pk_backend_repo_list_changed (self);
}
} else {
int code = PM_ERR_DB_NOT_NULL;
g_set_error (&error, ALPM_ERROR, code, "[%s]: %s",
repo, alpm_strerror (code));
}
if (error != NULL) {
pk_backend_error (self, error);
g_error_free (error);
}
pk_backend_job_finished (self);
}
示例10: backend_get_details_thread
/**
* pk_backend_get_details:
*/
static void
backend_get_details_thread (PkBackendJob *job, GVariant *params, gpointer user_data)
{
gchar **package_ids;
gchar **parts;
int group_index;
PkGroupEnum group = 0;
pkg_t *pkg;
gchar *newid;
package_ids = pk_backend_get_strv(backend, "package_ids");
parts = pk_package_id_split (package_ids[0]);
if (!parts)
{
pk_backend_job_error_code (job, PK_ERROR_ENUM_PACKAGE_ID_INVALID, "invalid package id");
pk_backend_job_finished (job);
return;
}
pkg = opkg_find_package (parts[PK_PACKAGE_ID_NAME], parts[PK_PACKAGE_ID_VERSION], parts[PK_PACKAGE_ID_ARCH], parts[PK_PACKAGE_ID_DATA]);
g_strfreev (parts);
if (!pkg)
{
pk_backend_job_error_code (job, PK_ERROR_ENUM_PACKAGE_NOT_FOUND, NULL);
pk_backend_job_finished (job);
return;
}
newid = g_strdup_printf ("%s;%s;%s;%s", pkg->name, pkg->version, pkg->architecture, pkg->src->name);
if (pkg->tags) {
for (group_index = 0; group < PK_GROUP_ENUM_LAST; group_index++) {
group = 1 << group_index;
if (!(group & pk_backend_get_groups(backend))) continue;
if (opkg_check_tag(pkg, (const gchar *)pk_group_enum_to_string(group)))
break;
}
}
pk_backend_job_details (job, newid, NULL, NULL, group, pkg->description, NULL, pkg->size);
g_free (newid);
pk_backend_job_finished (job);
}
示例11: pk_backend_remove_packages
/**
* pk_backend_remove_packages:
*/
void
pk_backend_remove_packages (PkBackend *backend, PkBackendJob *job,
PkBitfield transaction_flags,
gchar **package_ids,
gboolean allow_deps,
gboolean autoremove)
{
pk_backend_job_finished (job);
}
示例12: pk_backend_repo_enable
/**
* pk_backend_repo_enable:
*/
static void
pk_backend_repo_enable (PkBackend *backend, PkBackendJob *job, const gchar *rid, gboolean enabled)
{
pk_backend_job_set_status (job, PK_STATUS_ENUM_QUERY);
box_repos_enable_repo(rid, enabled);
pk_backend_job_finished (job);
}
示例13: pk_backend_update_packages
/**
* pk_backend_update_packages:
*/
static void
pk_backend_update_packages (PkBackend *backend, PkBackendJob *job, gboolean only_trusted, gchar **package_ids)
{
/* check network state */
if (!pk_backend_is_online (backend)) {
pk_backend_job_error_code (job, PK_ERROR_ENUM_NO_NETWORK, "Cannot update when offline");
pk_backend_job_finished (job);
return;
}
pk_backend_job_thread_create (job, backend_update_packages_thread, NULL, NULL);
}
示例14: pk_backend_repo_set_data
/**
* pk_backend_repo_set_data:
*/
static void
pk_backend_repo_set_data (PkBackend *backend, PkBackendJob *job, const gchar *rid, const gchar *parameter, const gchar *value)
{
pk_backend_job_set_status (job, PK_STATUS_ENUM_QUERY);
if (!box_repos_set_param (rid, parameter, value)) {
g_warning ("Cannot set PARAMETER '%s' TO '%s' for REPO '%s'", parameter, value, rid);
}
pk_backend_job_finished (job);
}
示例15: pk_backend_search_names_thread
/**
* pk_backend_search_names_thread:
*/
static void
pk_backend_search_names_thread (PkBackendJob *job, GVariant *params, gpointer user_data)
{
GTimer *timer;
guint percentage;
PkBitfield filters;
gchar *filters_text;
gchar **search;
g_variant_get (params, "(t^a&s)",
&filters,
&search);
filters_text = pk_filter_bitfield_to_string (filters);
g_debug ("started task (%p) search=%s filters=%s", job, search[0], filters_text);
g_free (filters_text);
pk_backend_job_set_status (job, PK_STATUS_ENUM_QUERY);
timer = g_timer_new ();
percentage = 0;
do {
/* now is a good time to see if we should cancel the thread */
if (is_cancelled) {
pk_backend_job_error_code (job, PK_ERROR_ENUM_TRANSACTION_CANCELLED,
"The thread was stopped successfully");
pk_backend_job_finished (job);
return;
}
pk_backend_job_set_percentage (job, percentage);
percentage += 10;
g_usleep (1000*100);
} while (percentage < 100);
g_timer_destroy (timer);
pk_backend_job_set_percentage (job, 100);
g_debug ("exited task (%p)", job);
pk_backend_job_package (job, PK_INFO_ENUM_INSTALLED,
"glib2;2.14.0;i386;fedora", "The GLib library");
pk_backend_job_package (job, PK_INFO_ENUM_INSTALLED,
"gtk2;gtk2-2.11.6-6.fc8;i386;fedora", "GTK+ Libraries for GIMP");
pk_backend_job_finished (job);
}