UI: File Browser Favorites
authorHarley Acheson <harley.acheson@gmail.com>
Thu, 5 Mar 2020 19:49:56 +0000 (11:49 -0800)
committerHarley Acheson <harley.acheson@gmail.com>
Thu, 5 Mar 2020 19:49:56 +0000 (11:49 -0800)
Adding more Windows special folder locations, used when browsing or bookmarking.

Differential Revision: https://developer.blender.org/D7014

Reviewed by Brecht Van Lommel

release/datafiles/locale
release/scripts/addons
release/scripts/addons_contrib
source/blender/editors/space_file/filelist.c
source/blender/editors/space_file/fsmenu.c
source/tools

index 036668461bd1ec98ea5c23b45f83211dd2fd2a4e..2a25e004396d3f135a98da132b496923275a3dcc 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 036668461bd1ec98ea5c23b45f83211dd2fd2a4e
+Subproject commit 2a25e004396d3f135a98da132b496923275a3dcc
index 14ee8dfc0f360d7ea53c467e218f45fbf965da74..7481a1c3c199799ccc606b617e97c6b77535c346 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 14ee8dfc0f360d7ea53c467e218f45fbf965da74
+Subproject commit 7481a1c3c199799ccc606b617e97c6b77535c346
index 68f6291ef28902de6ddaffc3fa18748a95569c08..9468c406fb554e32ff47b62bfef356b3908ec651 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 68f6291ef28902de6ddaffc3fa18748a95569c08
+Subproject commit 9468c406fb554e32ff47b62bfef356b3908ec651
index 11304d6ae466f1ee7f13ed2a25ff0fc66dbbc1b0..948fa91718ef64975117e9c467baaf2770c49dc4 100644 (file)
@@ -996,16 +996,24 @@ static int filelist_geticon_ex(FileDirEntry *file,
       return (file->attributes & FILE_ATTR_ANY_LINK) ? ICON_FOLDER_REDIRECT : ICON_FILE_FOLDER;
     }
     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();
-      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;
+      FSMenuCategory categories[] = {
+          FS_CATEGORY_SYSTEM_BOOKMARKS,
+          FS_CATEGORY_OTHER,
+      };
+
+      for (int i = 0; i < ARRAY_SIZE(categories); i++) {
+        FSMenuEntry *tfsm = ED_fsmenu_get_category(fsmenu, categories[i]);
+        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;
+          }
         }
       }
     }
index 5702fe723969d3dd68b85809f3663df7784b7b0f..af3ad0c354da470e432464c98935193a0caddd6d 100644 (file)
@@ -617,6 +617,7 @@ void fsmenu_read_bookmarks(struct FSMenu *fsmenu, const char *filename)
 #ifdef WIN32
 /* Add a Windows known folder path to the System list. */
 static void fsmenu_add_windows_folder(struct FSMenu *fsmenu,
+                                      FSMenuCategory category,
                                       REFKNOWNFOLDERID rfid,
                                       const char *name,
                                       const int icon,
@@ -627,7 +628,7 @@ static void fsmenu_add_windows_folder(struct FSMenu *fsmenu,
   if (SHGetKnownFolderPath(rfid, 0, NULL, &pPath) == S_OK) {
     BLI_strncpy_wchar_as_utf8(line, pPath, FILE_MAXDIR);
     CoTaskMemFree(pPath);
-    fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, name, icon, flag);
+    fsmenu_insert_entry(fsmenu, category, line, name, icon, flag);
   }
 }
 #endif
@@ -690,22 +691,68 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks)
 
     /* Get Special Folder Locations. */
     if (read_bookmarks) {
+
+      /* These items are shown in System List. */
+      fsmenu_add_windows_folder(fsmenu,
+                                FS_CATEGORY_SYSTEM_BOOKMARKS,
+                                &FOLDERID_Profile,
+                                IFACE_("Home"),
+                                ICON_HOME,
+                                FS_INSERT_LAST);
+      fsmenu_add_windows_folder(fsmenu,
+                                FS_CATEGORY_SYSTEM_BOOKMARKS,
+                                &FOLDERID_Desktop,
+                                IFACE_("Desktop"),
+                                ICON_DESKTOP,
+                                FS_INSERT_LAST);
+      fsmenu_add_windows_folder(fsmenu,
+                                FS_CATEGORY_SYSTEM_BOOKMARKS,
+                                &FOLDERID_Documents,
+                                IFACE_("Documents"),
+                                ICON_DOCUMENTS,
+                                FS_INSERT_LAST);
+      fsmenu_add_windows_folder(fsmenu,
+                                FS_CATEGORY_SYSTEM_BOOKMARKS,
+                                &FOLDERID_Downloads,
+                                IFACE_("Downloads"),
+                                ICON_IMPORT,
+                                FS_INSERT_LAST);
+      fsmenu_add_windows_folder(fsmenu,
+                                FS_CATEGORY_SYSTEM_BOOKMARKS,
+                                &FOLDERID_Music,
+                                IFACE_("Music"),
+                                ICON_FILE_SOUND,
+                                FS_INSERT_LAST);
+      fsmenu_add_windows_folder(fsmenu,
+                                FS_CATEGORY_SYSTEM_BOOKMARKS,
+                                &FOLDERID_Pictures,
+                                IFACE_("Pictures"),
+                                ICON_FILE_IMAGE,
+                                FS_INSERT_LAST);
+      fsmenu_add_windows_folder(fsmenu,
+                                FS_CATEGORY_SYSTEM_BOOKMARKS,
+                                &FOLDERID_Videos,
+                                IFACE_("Videos"),
+                                ICON_FILE_MOVIE,
+                                FS_INSERT_LAST);
+      fsmenu_add_windows_folder(fsmenu,
+                                FS_CATEGORY_SYSTEM_BOOKMARKS,
+                                &FOLDERID_Fonts,
+                                IFACE_("Fonts"),
+                                ICON_FONTPREVIEW,
+                                FS_INSERT_LAST);
+
+      /* These items are just put in path cache for thumbnail views and if bookmarked. */
+
       fsmenu_add_windows_folder(
-          fsmenu, &FOLDERID_Profile, IFACE_("Home"), ICON_HOME, FS_INSERT_LAST);
-      fsmenu_add_windows_folder(
-          fsmenu, &FOLDERID_Desktop, IFACE_("Desktop"), ICON_DESKTOP, FS_INSERT_LAST);
-      fsmenu_add_windows_folder(
-          fsmenu, &FOLDERID_Documents, IFACE_("Documents"), ICON_DOCUMENTS, FS_INSERT_LAST);
-      fsmenu_add_windows_folder(
-          fsmenu, &FOLDERID_Downloads, IFACE_("Downloads"), ICON_IMPORT, FS_INSERT_LAST);
-      fsmenu_add_windows_folder(
-          fsmenu, &FOLDERID_Music, IFACE_("Music"), ICON_FILE_SOUND, FS_INSERT_LAST);
-      fsmenu_add_windows_folder(
-          fsmenu, &FOLDERID_Pictures, IFACE_("Pictures"), ICON_FILE_IMAGE, FS_INSERT_LAST);
+          fsmenu, FS_CATEGORY_OTHER, &FOLDERID_UserProfiles, NULL, ICON_COMMUNITY, FS_INSERT_LAST);
+
       fsmenu_add_windows_folder(
-          fsmenu, &FOLDERID_Videos, IFACE_("Videos"), ICON_FILE_MOVIE, FS_INSERT_LAST);
+          fsmenu, FS_CATEGORY_OTHER, &FOLDERID_Objects3D, NULL, ICON_FILE_3D, FS_INSERT_LAST);
+
       fsmenu_add_windows_folder(
-          fsmenu, &FOLDERID_Fonts, IFACE_("Fonts"), ICON_FONTPREVIEW, FS_INSERT_LAST);
+          fsmenu, FS_CATEGORY_OTHER, &FOLDERID_SkyDrive, NULL, ICON_URL, FS_INSERT_LAST);
+
     }
   }
 #else
index d230f2161f36f8b21f3ce8eeb19b34c0629506c2..4a6f1706258439db3ee5a50ec6938fef79c7cb97 160000 (submodule)
@@ -1 +1 @@
-Subproject commit d230f2161f36f8b21f3ce8eeb19b34c0629506c2
+Subproject commit 4a6f1706258439db3ee5a50ec6938fef79c7cb97