当前位置: 首页>>代码示例>>C++>>正文


C++ pk_backend_finished函数代码示例

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


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

示例1: backend_update_package_thread

/**
 * backend_update_package:
 */
static gboolean
backend_update_package_thread (PkBackend *backend)
{
        gchar **parts;
	gint err = 0;
	const gchar *package_id;

	/* FIXME: support only_trusted */
	package_id = pk_backend_get_string (backend, "pkgid");
	parts = pk_package_id_split (package_id);

	if (!parts)
	{
		pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_FOUND,
				"Package not found");
		pk_backend_finished (backend);
		return FALSE;
	}

	err = opkg_upgrade_package (parts[PK_PACKAGE_ID_NAME], pk_opkg_progress_cb, backend);
	if (err)
		handle_install_error (backend, err);

	g_strfreev (parts);
	pk_backend_finished (backend);
	return (err != 0);
}
开发者ID:AlfredArouna,项目名称:packagekit,代码行数:30,代码来源:pk-backend-opkg.c

示例2: 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

示例3: 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

示例4: 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

示例5: backend_get_details

/**
 * backend_get_details:
 */
static void
backend_get_details (PkBackend *backend, gchar **package_ids)
{
	guint i;
	guint len;
	const gchar *package_id;
	gchar *pi;
	const gchar *license = "";
	const gchar *homepage = "";
	const gchar *description;
	PkGroupEnum group;

	slapt_pkg_list_t *installed;
	slapt_pkg_list_t *available;
	slapt_pkg_info_t *pkg;
	const char *category;

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

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

	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, available, installed);
	    if (pkg == NULL) {
		pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_FOUND, "package not found");
		continue;
	    }

	    category = _get_pkg_category(pkg);
	    group = _get_pkg_group(category);

	    package_id = _get_string_from_pkg(pkg);
	    description = g_strstrip((gchar*) _get_pkg_description(pkg));

	    pk_backend_details (backend, package_id,
		license, group, description, homepage, pkg->size_c * 1024);

	    g_free((gpointer) description);
	    g_free((gpointer) package_id);
	}

	slapt_free_pkg_list(available);
	slapt_free_pkg_list(installed);

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

示例6: backend_get_files_thread

static gboolean
backend_get_files_thread (PkBackend *backend)
{
	gchar **package_ids;
	gchar *pi;

	package_ids = pk_backend_get_strv (backend, "package_ids");
	if (package_ids == NULL) {
		pk_backend_error_code (backend,
				       PK_ERROR_ENUM_PACKAGE_ID_INVALID,
				       "Invalid package id");
		pk_backend_finished (backend);
		return false;
	}

	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_QUERY);
	for (uint i = 0; i < g_strv_length(package_ids); i++) {
		pi = package_ids[i];
		if (pk_package_id_check(pi) == false) {
			pk_backend_error_code (backend,
					       PK_ERROR_ENUM_PACKAGE_ID_INVALID,
					       pi);
			delete m_apt;
			pk_backend_finished (backend);
			return false;
		}

		pair<pkgCache::PkgIterator, pkgCache::VerIterator> pkg_ver;
		pkg_ver = m_apt->find_package_id(pi);
		if (pkg_ver.second.end() == true)
		{
			pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_FOUND, "Couldn't find package");
			delete m_apt;
			pk_backend_finished (backend);
			return false;
		}

		emit_files (backend, pi);
	}

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

示例7: backend_search_file_thread

static gboolean
backend_search_file_thread (PkBackend *backend)
{
	const gchar *search;
	PkBitfield filters;

	search = pk_backend_get_string (backend, "search");
	filters = (PkBitfield) pk_backend_get_uint (backend, "filters");

	pk_backend_set_allow_cancel (backend, true);

	// as we can only search for installed files lets avoid the opposite
	if (!pk_bitfield_contain (filters, PK_FILTER_ENUM_NOT_INSTALLED)) {
		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_QUERY);
		vector<string> packages = search_file (backend, search, _cancel);
		vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> > output;
		for(vector<string>::iterator i = packages.begin();
		    i != packages.end(); ++i)
		{
			if (_cancel) {
			    break;
			}
			pkgCache::PkgIterator pkg = m_apt->packageCache->FindPkg(i->c_str());
			pkgCache::VerIterator ver = m_apt->find_ver(pkg);
			if (ver.end() == true)
			{
				continue;
			}
			output.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, ver));
		}
		// It's faster to emmit the packages here rather than in the matching part
		m_apt->emit_packages(output, filters);

		delete m_apt;
	}

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

示例8: backend_search_name

/**
 * backend_search_name:
 */
static void
backend_search_name (PkBackend *backend, PkBitfield filters, const gchar *search)
{
	pk_backend_error_code (backend, PK_ERROR_ENUM_INTERNAL_ERROR,
			       "Error number 1");
	pk_backend_finished (backend);
}
开发者ID:zodman,项目名称:PackageKit,代码行数:10,代码来源:pk-backend-test-fail.c

示例9: pk_backend_search_names

/**
 * pk_backend_search_names:
 */
void
pk_backend_search_names (PkBackend *backend, PkBitfield filters, gchar **values)
{
	pk_backend_error_code (backend, PK_ERROR_ENUM_INTERNAL_ERROR,
			       "Error number 1");
	pk_backend_finished (backend);
}
开发者ID:AlfredArouna,项目名称:packagekit,代码行数:10,代码来源:pk-backend-test-fail.c

示例10: backend_get_updates_thread

static gboolean
backend_get_updates_thread (PkBackend *backend)
{
	opkg_list_upgradable_packages (pk_opkg_list_upgradable_cb, backend);
	pk_backend_finished (backend);
	return TRUE;
}
开发者ID:AlfredArouna,项目名称:packagekit,代码行数:7,代码来源:pk-backend-opkg.c

示例11: backend_install_packages_thread

static gboolean
backend_install_packages_thread (PkBackend *backend)
{
	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_package (backend, 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_finished (backend);
	return (err == 0);
}
开发者ID:AlfredArouna,项目名称:packagekit,代码行数:29,代码来源:pk-backend-opkg.c

示例12: backend_search_name_timeout

/**
 * backend_search_name_timeout:
 **/
static gboolean
backend_search_name_timeout (gpointer data)
{
	PkBackend *backend = (PkBackend *) data;
	pk_backend_finished (backend);
	return FALSE;
}
开发者ID:zodman,项目名称:PackageKit,代码行数:10,代码来源:pk-backend-test-succeed.c

示例13: 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

示例14: 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

示例15: 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


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