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-29 08:26:02 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-01-29 08:27:54 +0300
commita622e29a25414d6f3a050f609abb667dabfe4624 (patch)
treef53fa9621b419c21e689aaa5b53f625af7cc7af4 /source/blender/editors/space_file
parent51546ff6e621a136fe8c84010f0fdd1474a9ac94 (diff)
UI: Linux Platform File Browser System List
Since we can now use separate icons for the items in the File Browser lists, the following rounds out the "System" list for Linux. Adds a few more folders that are available in most distributions at installation, but only if they exist.
Diffstat (limited to 'source/blender/editors/space_file')
-rw-r--r--source/blender/editors/space_file/fsmenu.c72
1 files changed, 67 insertions, 5 deletions
diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c
index 4458b38cd2f..eaabd907f23 100644
--- a/source/blender/editors/space_file/fsmenu.c
+++ b/source/blender/editors/space_file/fsmenu.c
@@ -313,7 +313,7 @@ void fsmenu_insert_entry(struct FSMenu *fsmenu,
fsm_iter->path = BLI_strdup(path);
fsm_iter->save = (flag & FS_INSERT_SAVE) != 0;
- /* If entry is also in another list, use that icon and maybe name. */
+ /* If entry is also in another list, use that icon and maybe name. */
if (ELEM(category, FS_CATEGORY_BOOKMARKS, FS_CATEGORY_RECENT)) {
FSMenuCategory cats[] = {
@@ -702,13 +702,75 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks)
const char *home = BLI_getenv("HOME");
if (read_bookmarks && home) {
+
BLI_snprintf(line, sizeof(line), "%s/", home);
- fsmenu_insert_entry(
- fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, NULL, ICON_HOME, FS_INSERT_SORTED);
- BLI_snprintf(line, sizeof(line), "%s/Desktop/", home);
if (BLI_exists(line)) {
fsmenu_insert_entry(
- fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, NULL, ICON_DESKTOP, FS_INSERT_SORTED);
+ fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, IFACE_("Home"), ICON_HOME, FS_INSERT_LAST);
+ }
+
+ /* Follow the XDG spec, check if these are available. */
+
+ /* TODO: parse "$XDG_CONFIG_HOME/user-dirs.dirs" for localized paths. */
+
+ BLI_snprintf(line, sizeof(line), "%s/Desktop/", home);
+ if (BLI_exists(line)) {
+ fsmenu_insert_entry(fsmenu,
+ FS_CATEGORY_SYSTEM_BOOKMARKS,
+ line,
+ IFACE_("Desktop"),
+ ICON_DESKTOP,
+ FS_INSERT_LAST);
+ }
+
+ BLI_snprintf(line, sizeof(line), "%s/Documents/", home);
+ if (BLI_exists(line)) {
+ fsmenu_insert_entry(fsmenu,
+ FS_CATEGORY_SYSTEM_BOOKMARKS,
+ line,
+ IFACE_("Documents"),
+ ICON_DOCUMENTS,
+ FS_INSERT_LAST);
+ }
+
+ BLI_snprintf(line, sizeof(line), "%s/Downloads/", home);
+ if (BLI_exists(line)) {
+ fsmenu_insert_entry(fsmenu,
+ FS_CATEGORY_SYSTEM_BOOKMARKS,
+ line,
+ IFACE_("Downloads"),
+ ICON_IMPORT,
+ FS_INSERT_LAST);
+ }
+
+ BLI_snprintf(line, sizeof(line), "%s/Videos/", home);
+ if (BLI_exists(line)) {
+ fsmenu_insert_entry(fsmenu,
+ FS_CATEGORY_SYSTEM_BOOKMARKS,
+ line,
+ IFACE_("Videos"),
+ ICON_FILE_MOVIE,
+ FS_INSERT_LAST);
+ }
+
+ BLI_snprintf(line, sizeof(line), "%s/Pictures/", home);
+ if (BLI_exists(line)) {
+ fsmenu_insert_entry(fsmenu,
+ FS_CATEGORY_SYSTEM_BOOKMARKS,
+ line,
+ IFACE_("Pictures"),
+ ICON_FILE_IMAGE,
+ FS_INSERT_LAST);
+ }
+
+ BLI_snprintf(line, sizeof(line), "%s/Music/", home);
+ if (BLI_exists(line)) {
+ fsmenu_insert_entry(fsmenu,
+ FS_CATEGORY_SYSTEM_BOOKMARKS,
+ line,
+ IFACE_("Music"),
+ ICON_FILE_SOUND,
+ FS_INSERT_LAST);
}
}