Exemple #1
0
void Index::removeApplication(const std::string &entryId)
{
	for (std::map<std::string, std::list<DesktopEntry*> >::iterator type = applicationsCache_.begin(); type != applicationsCache_.end(); ++type)
	{
		removeFromType(type->first, entryId);
	}
}
Exemple #2
0
void Index::processMimeApps(const std::string &path)
{
	ConfigReader config(path);
	std::vector<std::string> types;

	types = config.keys("Added Associations");

	for (std::vector<std::string>::size_type i = 0; i < types.size(); ++i)
	{
		std::vector<std::string> identifiers = split(config.value("Added Associations", types.at(i)), ';');

		for (int j = identifiers.size()-1; j >= 0; --j)
		{
			if (knownApplications_.count(identifiers[j]) > 0)
			{
				addToType(types[i], knownApplications_.at(identifiers[j]));
			}
		}
	}

	types = config.keys("Removed Associations");

	for (std::vector<std::string>::size_type i = 0; i < types.size(); ++i)
	{
		std::vector<std::string> identifiers = split(config.value("Removed Associations", types.at(i)), ';');

		for (std::vector<std::string>::size_type j = 0; j < identifiers.size(); ++j)
		{
			removeFromType(types[i], identifiers[j]);
		}
	}
}
Exemple #3
0
void Index::processMimeApps(const std::string &path)
{
	ConfigReader config(path);
	std::vector<std::string> types;

	types = config.keys("Added Associations");

	for (std::vector<std::string>::size_type i = 0; i < types.size(); ++i)
	{
		std::vector<std::string> identifiers = split(config.value("Added Associations", types.at(i)), ';');

		for (std::vector<std::string>::reverse_iterator it = identifiers.rbegin(); it != identifiers.rend(); ++it)
		{
			if (knownApplications_.find(*it) != knownApplications_.end())
			{
				addToType(types[i], knownApplications_.at(*it));
			}
		}
	}

	types = config.keys("Removed Associations");

	for (std::vector<std::string>::size_type i = 0; i < types.size(); ++i)
	{
		std::vector<std::string> identifiers = split(config.value("Removed Associations", types.at(i)), ';');

		for (std::vector<std::string>::size_type j = 0; j < identifiers.size(); ++j)
		{
			removeFromType(types[i], identifiers[j]);
		}
	}
}
Exemple #4
0
void Index::addToType(const std::string &type, DesktopEntry *entry)
{
	if (applicationsCache_.count(type) > 0)
	{
		removeFromType(type, entry->identifier());
	}

	applicationsCache_[type].push_front(entry);
}
Exemple #5
0
void Index::addToType(const std::string &type, DesktopEntry *entry)
{
	if (applicationsCache_.find(type) != applicationsCache_.end())
	{
		removeFromType(type, entry->identifier());
	}

	applicationsCache_[type].push_front(entry);
	entry->types_.push_back(type);
}