Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_file/filelist.c
| Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | |||||
| return ICON_FILE_BLEND; | return ICON_FILE_BLEND; | ||||
| } | } | ||||
| else if (is_main) { | else if (is_main) { | ||||
| /* Do not return icon for folders if icons are not 'main' draw type | /* Do not return icon for folders if icons are not 'main' draw type | ||||
| * (e.g. when used over previews). */ | * (e.g. when used over previews). */ | ||||
| return (file->attributes & FILE_ATTR_ANY_LINK) ? ICON_FOLDER_REDIRECT : ICON_FILE_FOLDER; | return (file->attributes & FILE_ATTR_ANY_LINK) ? ICON_FOLDER_REDIRECT : ICON_FILE_FOLDER; | ||||
| } | } | ||||
| else { | else { | ||||
| /* If this path is in System list then use that icon. */ | |||||
| /* If this path is in System list or path cache then use that icon. */ | |||||
| struct FSMenu *fsmenu = ED_fsmenu_get(); | struct FSMenu *fsmenu = ED_fsmenu_get(); | ||||
| FSMenuEntry *tfsm = ED_fsmenu_get_category(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS); | FSMenuCategory categories[] = { | ||||
brecht: Don't abbreviate variable names unnecessarily. | |||||
| char fullpath[FILE_MAX_LIBEXTRA]; | FS_CATEGORY_SYSTEM_BOOKMARKS, | ||||
| BLI_join_dirfile(fullpath, sizeof(fullpath), root, file->relpath); | FS_CATEGORY_OTHER, | ||||
| BLI_add_slash(fullpath); | }; | ||||
| for (; tfsm; tfsm = tfsm->next) { | for (int i = 0; i < ARRAY_SIZE(categories); i++) { | ||||
| if (STREQ(tfsm->path, fullpath)) { | FSMenuEntry *tfsm = ED_fsmenu_get_category(fsmenu, categories[i]); | ||||
Not Done Inline ActionsJust structure this as a regular for loop, no need for confusing reverse iteration. for (int i = 0; i < ARRAY_SIZE(categories); i++) brecht: Just structure this as a regular for loop, no need for confusing reverse iteration.
```
for… | |||||
| /* Never want a little folder inside a large one. */ | char fullpath[FILE_MAX_LIBEXTRA]; | ||||
| return (tfsm->icon == ICON_FILE_FOLDER) ? ICON_NONE : tfsm->icon; | BLI_join_dirfile(fullpath, sizeof(fullpath), root, file->relpath); | ||||
| BLI_add_slash(fullpath); | |||||
| for (; tfsm; tfsm = tfsm->next) { | |||||
| if (STREQ(tfsm->path, fullpath)) { | |||||
| /* Never want a little folder inside a large one. */ | |||||
| return (tfsm->icon == ICON_FILE_FOLDER) ? ICON_NONE : tfsm->icon; | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| if (file->attributes & FILE_ATTR_ANY_LINK) { | if (file->attributes & FILE_ATTR_ANY_LINK) { | ||||
| return ICON_LOOP_FORWARDS; | return ICON_LOOP_FORWARDS; | ||||
| } | } | ||||
| else if (file->attributes & FILE_ATTR_OFFLINE) { | else if (file->attributes & FILE_ATTR_OFFLINE) { | ||||
| ▲ Show 20 Lines • Show All 92 Lines • Show Last 20 Lines | |||||
Don't abbreviate variable names unnecessarily.