示例#1
0
文件: mainwnd.c 项目: sba1/simplemail
void main_refresh_folders(void)
{
	int row = 0;
	struct folder *f;
	char text[folders_width + 1];

	for (f = folder_first(); f; f = folder_next(f))
	{
		unsigned int level;
		unsigned int i;

		level = folder_level(f);
		if (level > 10)
		{
			level = 10;
		}

		if (f == main_active_folder)
		{
			text[0] = '*';
		} else
		{
			text[0] = ' ';
		}

		for (i = 0; i < level; i++)
		{
			text[1+i] = ' ';
		}

		mystrlcpy(&text[level + 1], folder_name(f), sizeof(text) - 2);
		mvwprintw(folders_wnd, row++, 0 , text);
	}
	wrefresh(folders_wnd);
}
示例#2
0
static struct firmware *get_from_uuid(const char *uuid)
{
	struct folder *folder = folder_find(FIRMWARES_FOLDER_NAME);
	struct folder_entity *entity = NULL;
	struct firmware *firmware;

	for (entity = folder_next(folder, entity);
			entity != NULL;
			entity = folder_next(folder, entity)) {
		firmware = firmware_from_entity(entity);
		if (ut_string_match(uuid, firmware_get_uuid(firmware)))
			return firmware;
	}

	return NULL;
}
示例#3
0
文件: mainwnd.c 项目: sba1/simplemail
static void main_folder_next(void)
{
	if (!main_active_folder)
	{
		main_active_folder = folder_first();
	} else
	{
		main_active_folder = folder_next(main_active_folder);
	}
	main_refresh_folders();
	callback_folder_active();
}
示例#4
0
static struct folder_entity *find_entity(const struct folder *folder,
		const char *identifier)
{
	struct folder_entity *entity = NULL;

	while ((entity = folder_next(folder, entity)))
		if (ut_string_match(identifier, folder_entity_get_sha1(entity))
				|| ut_string_match(identifier, entity->name))
			return entity;

	return NULL;
}
示例#5
0
static int get_from_path(struct firmware **dst, const char *path)
{
	struct folder *folder = folder_find(FIRMWARES_FOLDER_NAME);
	struct folder_entity *entity = NULL;
	struct firmware *firmware;
	char __attribute__((cleanup(ut_string_free))) *real_path = NULL;

	real_path = realpath(path, NULL);
	if (real_path == NULL)
		return -errno;
	for (entity = folder_next(folder, entity);
			entity != NULL;
			entity = folder_next(folder, entity)) {
		firmware = firmware_from_entity(entity);
		if (ut_string_match(real_path, firmware_get_path(firmware))) {
			*dst = firmware;
			break;
		}
	}

	return 0;
}
示例#6
0
STATIC ASM LONG move_strobj(REG(a0,struct Hook *h),REG(a2,Object *list), REG(a1,Object *str))
{
	char *s;
	struct folder *f;
/* TODO: This shouldn't happen over the plain text
 * (different folders could have the same name) */
	get(str,MUIA_Text_Contents,&s);

	for (f=folder_first();f;f=folder_next(f))
	{
		if (!strcmp(f->name,s))
		{
			set(filter_folder_list, MUIA_FolderTreelist_Active, f);
			break;
		}
	}
	return 1;
}