• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ pk_backend_set_status函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中pk_backend_set_status函数的典型用法代码示例。如果您正苦于以下问题:C++ pk_backend_set_status函数的具体用法?C++ pk_backend_set_status怎么用?C++ pk_backend_set_status使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了pk_backend_set_status函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: backend_download_packages

/**
 * backend_download_packages:
 */
static void
backend_download_packages (PkBackend *backend, gchar **package_ids, const gchar *directory)
{
	guint i;
	guint len;
	const gchar *package_id;
	const gchar *files;
	const char *error;
	slapt_pkg_list_t *installed;
	slapt_pkg_list_t *available;
	slapt_pkg_info_t *pkg;
	const char *summary;
	const char *note = NULL;
	char *filename;

	pk_backend_set_status (backend, PK_STATUS_ENUM_LOADING_CACHE);

	installed = slapt_get_installed_pkgs();
	available = slapt_get_available_pkgs();

	pk_backend_set_status (backend, PK_STATUS_ENUM_DOWNLOAD);
	pk_backend_set_percentage (backend, 0);

	len = g_strv_length (package_ids);
	for (i=0; i<len; i++) {
	    package_id = package_ids[i];
	    pkg = _get_pkg_from_string(package_id, available, installed);
	    if (pkg == NULL) {
		pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_FOUND, "package not found");
		continue;
	    }

	    summary = _get_pkg_summary(pkg);
	    pk_backend_package (backend, PK_INFO_ENUM_DOWNLOADING, package_id, summary);
	    g_free((gpointer) summary);

	    error = slapt_download_pkg(_config, pkg, note);
	    if (error == NULL) {

		filename = slapt_gen_pkg_file_name(_config, pkg);
		files = g_strdup(filename);

		pk_backend_files (backend, package_id, files);

		g_free((gpointer) files);
		free(filename);
	    } else {
		pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_DOWNLOAD_FAILED, error);
	    }
	}

	slapt_free_pkg_list(available);
	slapt_free_pkg_list(installed);

	pk_backend_set_percentage (backend, 100);
	pk_backend_finished (backend);
}
开发者ID:dmacvicar,项目名称:packagekit,代码行数:60,代码来源:pk-backend-slapt.c


示例2: pk_backend_transaction_sig_check

static void
pk_backend_transaction_sig_check (PkBackend *self)
{
	g_return_if_fail (self != NULL);

	pk_backend_set_status (self, PK_STATUS_ENUM_SIG_CHECK);
}
开发者ID:mattdm,项目名称:packagekit-upstream,代码行数:7,代码来源:pk-backend-transaction.c


示例3: backend_get_requires

/**
 * backend_get_requires:
 */
static void
backend_get_requires (PkBackend *backend, PkBitfield filters, gchar **package_ids, gboolean recursive)
{
	guint i;
	guint len;
	const gchar *package_id;
	PkPackageId *pi;

	slapt_pkg_info_t *pkg;

	slapt_pkg_list_t *installed;
	slapt_pkg_list_t *available;

	slapt_pkg_list_t *requires;

	PkInfoEnum state;
	const char *summary;

	installed = slapt_get_installed_pkgs();
	available = slapt_get_available_pkgs();

	pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);

	len = g_strv_length (package_ids);
	for (i=0; i<len; i++) {
	    package_id = package_ids[i];
	    pi = pk_package_id_new_from_string (package_id);
	    if (pi == NULL) {
		pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_ID_INVALID, "invalid package id");
		pk_backend_finished (backend);
		return;
	    }
	    pkg = _get_pkg_from_id(pi, available, installed);
	    pk_package_id_free (pi);
	    if (pkg == NULL) {
		pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_FOUND, "package not found");
		continue;
	    }

	    requires = slapt_is_required_by(_config, available, pkg);

	    for (i = 0; i < requires->pkg_count; i++) {
		pkg = requires->pkgs[i];

		state = pkg->installed ? PK_INFO_ENUM_INSTALLED : PK_INFO_ENUM_AVAILABLE;
		package_id = _get_string_from_pkg(pkg);
		summary = _get_pkg_summary(pkg);
		pk_backend_package (backend, state, package_id, summary);
		g_free((gpointer) summary);
		g_free((gpointer) package_id);
	    }

	    slapt_free_pkg_list(requires);
	}

	slapt_free_pkg_list(available);
	slapt_free_pkg_list(installed);

	pk_backend_finished (backend);
}
开发者ID:AlfredArouna,项目名称:packagekit,代码行数:63,代码来源:pk-backend-slapt.c


示例4: pk_backend_transaction_upgrade_start

static void
pk_backend_transaction_upgrade_start (PkBackend *self, alpm_pkg_t *pkg,
				      alpm_pkg_t *old)
{
	PkRoleEnum role;
	PkStatusEnum state;
	PkInfoEnum info;

	g_return_if_fail (self != NULL);
	g_return_if_fail (pkg != NULL);

	role = pk_backend_get_role (self);
	if (role == PK_ROLE_ENUM_INSTALL_FILES ||
	    role == PK_ROLE_ENUM_SIMULATE_INSTALL_FILES) {
		state = PK_STATUS_ENUM_INSTALL;
		info = PK_INFO_ENUM_INSTALLING;
	} else {
		state = PK_STATUS_ENUM_UPDATE;
		info = PK_INFO_ENUM_UPDATING;
	}

	pk_backend_set_status (self, state);
	pk_backend_pkg (self, pkg, info);
	pk_backend_output_start (self, pkg);
}
开发者ID:AOSC-Dev,项目名称:PackageKit,代码行数:25,代码来源:pk-backend-transaction.c


示例5: backend_get_depends_requires_thread

static gboolean
backend_get_depends_requires_thread (PkBackend *backend)
{
	GList *list = NULL;
	sqlite3 *db;
	gchar **package_ids;
	int deps_type;
        gchar **package_id_data;

	db = db_open ();
	package_ids = pk_backend_get_strv (backend, "package_ids");
	deps_type = pk_backend_get_uint (backend, "type");
	/* FIXME: support multiple packages */
	package_id_data = pk_package_id_split (package_ids[0]);

	pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);

	if (deps_type == DEPS_TYPE_DEPENDS)
		list = box_db_repos_get_depends (db, package_id_data[PK_PACKAGE_ID_NAME]);
	else if (deps_type == DEPS_TYPE_REQUIRES)
		list = box_db_repos_get_requires (db, package_id_data[PK_PACKAGE_ID_NAME]);

	add_packages_from_list (backend, list, FALSE);
	box_db_repos_package_list_free (list);

	db_close (db);

	pk_backend_finished (backend);
	return TRUE;
}
开发者ID:AlfredArouna,项目名称:packagekit,代码行数:30,代码来源:pk-backend-box.c


示例6: backend_update_packages

/**
 * backend_update_packages:
 */
static void
backend_update_packages (PkBackend *backend, gboolean only_trusted, gchar **package_ids)
{
	guint i;
	guint len;
	const gchar *package_id;
	int ret;

	slapt_pkg_list_t *installed;
	slapt_pkg_list_t *available;
	const gchar *search;
	slapt_pkg_list_t *results = NULL;
	slapt_transaction_t *transaction;
	slapt_pkg_info_t *pkg;
	slapt_pkg_info_t *oldpkg;

	/* FIXME: support only_trusted */

	pk_backend_set_status (backend, PK_STATUS_ENUM_UPDATE);
	pk_backend_set_percentage (backend, 0);

	installed = slapt_get_installed_pkgs();
	available = slapt_get_available_pkgs();

	transaction = slapt_init_transaction();

	len = g_strv_length (package_ids);
	for (i=0; i<len; i++) {
	    package_id = package_ids[i];
	    pkg = _get_pkg_from_string(package_id, available, installed);
	    if (pkg == NULL) {
		pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_FOUND, "package not found");
		continue;
	    }
	    oldpkg = NULL;
	    search = g_strdup_printf("^%s$", pkg->name);
	    results = slapt_search_pkg_list(installed, search);
	    g_free((gpointer) search);
	    if (results->pkg_count > 0) {
		oldpkg = results->pkgs[0];
	    } else {
		continue;
	    }

	    slapt_add_upgrade_to_transaction(transaction, oldpkg, pkg);
	}

	ret = slapt_handle_transaction(_config, transaction);
	if (ret != 0) {
	    pk_backend_error_code (backend, PK_ERROR_ENUM_TRANSACTION_ERROR, "install failed");
	}

	slapt_free_transaction(transaction);

	slapt_free_pkg_list(available);
	slapt_free_pkg_list(installed);

	pk_backend_set_percentage (backend, 100);
	pk_backend_finished (backend);
}
开发者ID:dmacvicar,项目名称:packagekit,代码行数:63,代码来源:pk-backend-slapt.c


示例7: pk_backend_transaction_test_commit

static void
pk_backend_transaction_test_commit (PkBackend *self)
{
	g_return_if_fail (self != NULL);

	pk_backend_set_status (self, PK_STATUS_ENUM_TEST_COMMIT);
}
开发者ID:AOSC-Dev,项目名称:PackageKit,代码行数:7,代码来源:pk-backend-transaction.c


示例8: backend_get_packages_thread

static gboolean
backend_get_packages_thread (PkBackend *backend)
{
	PkBitfield filters;
	GList *list = NULL;
	sqlite3 *db = NULL;

	filters = pk_backend_get_uint (backend, "filters");

	pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);

	pk_backend_set_percentage (backend, PK_BACKEND_PERCENTAGE_INVALID);

	db = db_open();

	if ((pk_bitfield_contain (filters, PK_FILTER_ENUM_INSTALLED) &&
	     pk_bitfield_contain (filters, PK_FILTER_ENUM_NOT_INSTALLED)) ||
	    (!pk_bitfield_contain (filters, PK_FILTER_ENUM_INSTALLED) &&
	     !pk_bitfield_contain (filters, PK_FILTER_ENUM_NOT_INSTALLED))) {
		list = box_db_repos_packages_search_all (db, NULL, 0);
	} else if (pk_bitfield_contain (filters, PK_FILTER_ENUM_INSTALLED)) {
		list = box_db_repos_packages_search_installed (db, NULL, 0);
	} else if (pk_bitfield_contain (filters, PK_FILTER_ENUM_NOT_INSTALLED)) {
		list = box_db_repos_packages_search_available (db, NULL, 0);
	}

	add_packages_from_list (backend, list, FALSE);
	box_db_repos_package_list_free (list);

	db_close(db);
	pk_backend_finished (backend);
	return TRUE;
}
开发者ID:AlfredArouna,项目名称:packagekit,代码行数:33,代码来源:pk-backend-box.c


示例9: pk_backend_transaction_setup

static void
pk_backend_transaction_setup (PkBackend *self)
{
	g_return_if_fail (self != NULL);

	pk_backend_set_status (self, PK_STATUS_ENUM_SETUP);
}
开发者ID:mattdm,项目名称:packagekit-upstream,代码行数:7,代码来源:pk-backend-transaction.c


示例10: pk_backend_transaction_download

static void
pk_backend_transaction_download (PkBackend *self)
{
	g_return_if_fail (self != NULL);

	pk_backend_set_status (self, PK_STATUS_ENUM_DOWNLOAD);
}
开发者ID:mattdm,项目名称:packagekit-upstream,代码行数:7,代码来源:pk-backend-transaction.c


示例11: pk_backend_transaction_dep_resolve

static void
pk_backend_transaction_dep_resolve (PkBackend *self)
{
	g_return_if_fail (self != NULL);

	pk_backend_set_status (self, PK_STATUS_ENUM_DEP_RESOLVE);
}
开发者ID:AOSC-Dev,项目名称:PackageKit,代码行数:7,代码来源:pk-backend-transaction.c


示例12: pk_backend_transaction_repackaging

static void
pk_backend_transaction_repackaging (PkBackend *self)
{
	g_return_if_fail (self != NULL);

	pk_backend_set_status (self, PK_STATUS_ENUM_REPACKAGING);
}
开发者ID:mattdm,项目名称:packagekit-upstream,代码行数:7,代码来源:pk-backend-transaction.c


示例13: backend_remove_packages

/**
 * backend_remove_packages:
 */
static void
backend_remove_packages (PkBackend *backend, gchar **package_ids, gboolean allow_deps, gboolean autoremove)
{
	guint i;
	guint len;
	gchar *pi;
	int ret;

	slapt_pkg_list_t *installed;
	slapt_pkg_list_t *available;
	slapt_transaction_t *transaction;
	slapt_pkg_info_t *pkg;

	/* FIXME: support only_trusted */

	pk_backend_set_status (backend, PK_STATUS_ENUM_REMOVE);
	pk_backend_set_percentage (backend, 0);

	installed = slapt_get_installed_pkgs();
	available = slapt_get_available_pkgs();

	transaction = slapt_init_transaction();

	len = g_strv_length (package_ids);
	for (i=0; i<len; i++) {
	    pi = package_ids[i];
	    if (pi == NULL) {
		pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_ID_INVALID, "invalid package id");
		pk_backend_finished (backend);
		return;
	    }
	    pkg = _get_pkg_from_id(pi, installed, NULL);
	    if (pkg == NULL) {
		pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_FOUND, "package not found");
		continue;
	    }

	    if (!pkg->installed) {
		char *pkgname = slapt_stringify_pkg(pkg);
		pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_INSTALLED, "package %s not installed", pkgname);
		free(pkgname);
		continue;
	    }

	    slapt_add_remove_to_transaction(transaction, pkg);
	}

	ret = slapt_handle_transaction(_config, transaction);
	if (ret != 0) {
	    pk_backend_error_code (backend, PK_ERROR_ENUM_TRANSACTION_ERROR, "remove failed");
	}

	slapt_free_transaction(transaction);

	slapt_free_pkg_list(available);
	slapt_free_pkg_list(installed);

	pk_backend_set_percentage (backend, 100);
	pk_backend_finished (backend);
}
开发者ID:dmacvicar,项目名称:packagekit,代码行数:63,代码来源:pk-backend-slapt.c


示例14: backend_get_details_thread

static gboolean
backend_get_details_thread (PkBackend *backend)
{
	PackageSearch *ps;
	GList *list;
	sqlite3 *db;
	gchar **package_ids;
	gchar **package_id_data;

	package_ids = pk_backend_get_strv (backend, "package_ids");
	/* FIXME: support multiple packages */
	package_id_data = pk_package_id_split (package_ids[0]);

	db = db_open ();

	pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);

	/* only one element is returned */
	list = box_db_repos_packages_search_by_data (db, package_id_data[PK_PACKAGE_ID_NAME], package_id_data[PK_PACKAGE_ID_VERSION]);

	if (list == NULL) {
		pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_ID_INVALID, "cannot find package by id");
		db_close (db);
		return FALSE;
	}
	ps = (PackageSearch*) list->data;

	pk_backend_details (backend, package_ids[0], "unknown", PK_GROUP_ENUM_OTHER, ps->description, "", 0);

	box_db_repos_package_list_free (list);

	db_close (db);
	pk_backend_finished (backend);
	return TRUE;
}
开发者ID:AlfredArouna,项目名称:packagekit,代码行数:35,代码来源:pk-backend-box.c


示例15: backend_refresh_cache

/**
 * backend_refresh_cache:
 */
static void
backend_refresh_cache (PkBackend *backend, gboolean force)
{
	pk_backend_set_status (backend, PK_STATUS_ENUM_REFRESH_CACHE);
	pk_backend_set_percentage (backend, PK_BACKEND_PERCENTAGE_INVALID);

	pk_backend_thread_create (backend, backend_refresh_cache_thread);
}
开发者ID:AlfredArouna,项目名称:packagekit,代码行数:11,代码来源:pk-backend-opkg.c


示例16: backend_get_updates

static void
backend_get_updates (PkBackend *backend, PkBitfield filters)
{
	pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
	pk_backend_set_percentage (backend, PK_BACKEND_PERCENTAGE_INVALID);

	pk_backend_thread_create (backend, backend_get_updates_thread);
}
开发者ID:AlfredArouna,项目名称:packagekit,代码行数:8,代码来源:pk-backend-opkg.c


示例17: backend_update_system

static void
backend_update_system (PkBackend *backend, gboolean only_trusted)
{
	pk_backend_set_status (backend, PK_STATUS_ENUM_UPDATE);
	pk_backend_set_percentage (backend, PK_BACKEND_PERCENTAGE_INVALID);

	pk_backend_thread_create (backend, backend_update_system_thread);
}
开发者ID:AlfredArouna,项目名称:packagekit,代码行数:8,代码来源:pk-backend-opkg.c


示例18: backend_refresh_cache

/**
 * backend_refresh_cache:
 */
static void
backend_refresh_cache (PkBackend *backend, gboolean force)
{
	pk_backend_set_allow_cancel (backend, TRUE);
	pk_backend_set_status (backend, PK_STATUS_ENUM_REFRESH_CACHE);
	slapt_update_pkg_cache(_config);
	pk_backend_finished (backend);
}
开发者ID:dmacvicar,项目名称:packagekit,代码行数:11,代码来源:pk-backend-slapt.c


示例19: backend_refresh_cache_thread

/**
 * backend_refresh_cache_thread:
 */
static gboolean
backend_refresh_cache_thread (PkBackend *backend)
{
	pk_backend_set_allow_cancel (backend, true);

	aptcc *m_apt = new aptcc(backend, _cancel);
	pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
	if (m_apt->init()) {
		egg_debug ("Failed to create apt cache");
		delete m_apt;
		pk_backend_finished (backend);
		return false;
	}

	pk_backend_set_status (backend, PK_STATUS_ENUM_REFRESH_CACHE);
	// Lock the list directory
	FileFd Lock;
	if (_config->FindB("Debug::NoLocking", false) == false)
	{
		Lock.Fd(GetLock(_config->FindDir("Dir::State::Lists") + "lock"));
		if (_error->PendingError() == true) {
			pk_backend_error_code (backend, PK_ERROR_ENUM_CANNOT_GET_LOCK, "Unable to lock the list directory");
			delete m_apt;
			pk_backend_finished (backend);
			return false;
	// 	 return _error->Error(_("Unable to lock the list directory"));
		}
	}
	// Create the progress
	AcqPackageKitStatus Stat(m_apt, backend, _cancel);

	// do the work
	if (_config->FindB("APT::Get::Download",true) == true) {
		ListUpdate(Stat, *m_apt->packageSourceList);
	}

	// Rebuild the cache.
	pkgCacheFile Cache;
	OpTextProgress Prog(*_config);
	if (Cache.BuildCaches(Prog, true) == false) {
		if (_error->PendingError() == true) {
			show_errors(backend, PK_ERROR_ENUM_CANNOT_GET_LOCK);
		}
		delete m_apt;
		pk_backend_finished (backend);
		return false;
	}

	// missing gpg signature would appear here
	// TODO we need a better enum
	if (_error->PendingError() == false && _error->empty() == false) {
		show_warnings(backend, PK_MESSAGE_ENUM_UNTRUSTED_PACKAGE);
	}

	pk_backend_finished (backend);
	delete m_apt;
	return true;
}
开发者ID:zodman,项目名称:PackageKit,代码行数:61,代码来源:pk-backend-aptcc.cpp


示例20: backend_repo_enable

/**
 * backend_repo_enable:
 **/
void
backend_repo_enable (PkBackend *backend, const gchar *repo, gboolean enabled)
{
	g_return_if_fail (backend != NULL);
	g_return_if_fail (repo != NULL);

	pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
	pk_backend_thread_create (backend, backend_repo_enable_thread);
}
开发者ID:AlfredArouna,项目名称:packagekit,代码行数:12,代码来源:backend-repos.c



注:本文中的pk_backend_set_status函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ pk_filter_bitfield_to_string函数代码示例发布时间:2022-05-30
下一篇:
C++ pk_backend_job_finished函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap