Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarley Acheson <harley.acheson@gmail.com>2020-01-28 20:10:50 +0300
committerHarley Acheson <harley.acheson@gmail.com>2020-01-28 20:10:50 +0300
commit1af8e0cc6c47b43bf9c94a3f845961f4d22cb34e (patch)
tree71f58cda860c7aebb32c06d0795fbf386d99b78e /source/blender/editors/space_file/filelist.c
parenta5790b26563c216dce262586369fdca1061b4850 (diff)
UI: Windows Platform File Browser System List
Showing Windows special folder locations with icons in File Browser System list. https://developer.blender.org/D6405 Reviewed by Brecht Van Lommel
Diffstat (limited to 'source/blender/editors/space_file/filelist.c')
-rw-r--r--source/blender/editors/space_file/filelist.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index a567aeed826..fa904e0934b 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -947,15 +947,13 @@ ImBuf *filelist_geticon_image(struct FileList *filelist, const int index)
return filelist_geticon_image_ex(file->typeflag, file->relpath);
}
-static int filelist_geticon_ex(const int typeflag,
- const int blentype,
- const char *relpath,
- const bool is_main,
- const bool ignore_libdir)
+static int filelist_geticon_ex(FileDirEntry *file, const char *root, const bool is_main, const bool ignore_libdir)
{
+ const int typeflag = file->typeflag;
+
if ((typeflag & FILE_TYPE_DIR) &&
!(ignore_libdir && (typeflag & (FILE_TYPE_BLENDERLIB | FILE_TYPE_BLENDER)))) {
- if (FILENAME_IS_PARENT(relpath)) {
+ if (FILENAME_IS_PARENT(file->relpath)) {
return is_main ? ICON_FILE_PARENT : ICON_NONE;
}
else if (typeflag & FILE_TYPE_APPLICATIONBUNDLE) {
@@ -969,6 +967,20 @@ static int filelist_geticon_ex(const int typeflag,
* (e.g. when used over previews). */
return ICON_FILE_FOLDER;
}
+ else {
+ /* If this path is in System list then use that icon. */
+ struct FSMenu *fsmenu = ED_fsmenu_get();
+ FSMenuEntry *tfsm = ED_fsmenu_get_category(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS);
+ char fullpath[FILE_MAX_LIBEXTRA];
+ 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 (typeflag & FILE_TYPE_BLENDER) {
@@ -1014,7 +1026,7 @@ static int filelist_geticon_ex(const int typeflag,
return ICON_FILE_ARCHIVE;
}
else if (typeflag & FILE_TYPE_BLENDERLIB) {
- const int ret = UI_idcode_icon_get(blentype);
+ const int ret = UI_idcode_icon_get(file->blentype);
if (ret != ICON_NONE) {
return ret;
}
@@ -1026,7 +1038,7 @@ int filelist_geticon(struct FileList *filelist, const int index, const bool is_m
{
FileDirEntry *file = filelist_geticon_get_file(filelist, index);
- return filelist_geticon_ex(file->typeflag, file->blentype, file->relpath, is_main, false);
+ return filelist_geticon_ex(file, filelist->filelist.root, is_main, false);
}
/* ********** Main ********** */