diff options
-rw-r--r-- | release/scripts/startup/bl_ui/space_userpref.py | 1 | ||||
-rw-r--r-- | source/blender/editors/space_file/file_panels.c | 16 | ||||
-rw-r--r-- | source/blender/editors/space_file/fsmenu.c | 42 | ||||
-rw-r--r-- | source/blender/editors/space_file/fsmenu.h | 1 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_userdef_types.h | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 4 |
6 files changed, 50 insertions, 17 deletions
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index 85ea4985715..dfb4a419a0c 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -823,6 +823,7 @@ class USERPREF_PT_file(Panel): col.prop(paths, "use_filter_files") col.prop(paths, "show_hidden_files_datablocks") col.prop(paths, "hide_recent_locations") + col.prop(paths, "hide_system_bookmarks") col.prop(paths, "show_thumbnails") col.separator() diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c index a7054909aaa..fb5210380b3 100644 --- a/source/blender/editors/space_file/file_panels.c +++ b/source/blender/editors/space_file/file_panels.c @@ -135,6 +135,16 @@ static void file_panel_system(const bContext *C, Panel *pa) file_panel_category(C, pa, FS_CATEGORY_SYSTEM, &sfile->systemnr, ICON_DISK_DRIVE, 0); } +static void file_panel_system_bookmarks(const bContext *C, Panel *pa) +{ + SpaceFile *sfile = CTX_wm_space_file(C); + + if (sfile && !(U.uiflag & USER_HIDE_SYSTEM_BOOKMARKS) ) { + file_panel_category(C, pa, FS_CATEGORY_SYSTEM_BOOKMARKS, &sfile->systemnr, ICON_BOOKMARKS, 0); + } + +} + static void file_panel_bookmarks(const bContext *C, Panel *pa) { SpaceFile *sfile = CTX_wm_space_file(C); @@ -212,6 +222,12 @@ void file_panels_register(ARegionType *art) pt->draw = file_panel_system; BLI_addtail(&art->paneltypes, pt); + pt = MEM_callocN(sizeof(PanelType), "spacetype file system bookmarks"); + strcpy(pt->idname, "FILE_PT_system_bookmarks"); + strcpy(pt->label, N_("System Bookmarks")); + pt->draw = file_panel_system_bookmarks; + BLI_addtail(&art->paneltypes, pt); + pt = MEM_callocN(sizeof(PanelType), "spacetype file bookmarks"); strcpy(pt->idname, "FILE_PT_bookmarks"); strcpy(pt->label, N_("Bookmarks")); diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c index 66cda3082ea..c57bfaeeb2c 100644 --- a/source/blender/editors/space_file/fsmenu.c +++ b/source/blender/editors/space_file/fsmenu.c @@ -80,9 +80,9 @@ struct _FSMenuEntry { typedef struct FSMenu { FSMenuEntry *fsmenu_system; + FSMenuEntry *fsmenu_system_bookmarks; FSMenuEntry *fsmenu_bookmarks; FSMenuEntry *fsmenu_recent; - } FSMenu; static FSMenu *g_fsmenu = NULL; @@ -103,6 +103,9 @@ static FSMenuEntry *fsmenu_get_category(struct FSMenu *fsmenu, FSMenuCategory ca case FS_CATEGORY_SYSTEM: fsm_head = fsmenu->fsmenu_system; break; + case FS_CATEGORY_SYSTEM_BOOKMARKS: + fsm_head = fsmenu->fsmenu_system_bookmarks; + break; case FS_CATEGORY_BOOKMARKS: fsm_head = fsmenu->fsmenu_bookmarks; break; @@ -119,6 +122,9 @@ static void fsmenu_set_category(struct FSMenu *fsmenu, FSMenuCategory category, case FS_CATEGORY_SYSTEM: fsmenu->fsmenu_system = fsm_head; break; + case FS_CATEGORY_SYSTEM_BOOKMARKS: + fsmenu->fsmenu_system_bookmarks = fsm_head; + break; case FS_CATEGORY_BOOKMARKS: fsmenu->fsmenu_bookmarks = fsm_head; break; @@ -336,9 +342,9 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks) /* Adding Desktop and My Documents */ if (read_bookmarks) { SHGetSpecialFolderPath(0, line, CSIDL_PERSONAL, 0); - fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, FS_INSERT_SORTED); + fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, FS_INSERT_SORTED); SHGetSpecialFolderPath(0, line, CSIDL_DESKTOPDIRECTORY, 0); - fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, FS_INSERT_SORTED); + fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, FS_INSERT_SORTED); } } #else @@ -361,7 +367,7 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks) FSRefMakePath(&dir, path, FILE_MAX); if (strcmp((char *)path, "/home") && strcmp((char *)path, "/net")) { /* /net and /home are meaningless on OSX, home folders are stored in /Users */ - fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM, (char *)path, FS_INSERT_SORTED); + fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, (char *)path, FS_INSERT_SORTED); } } @@ -371,26 +377,26 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks) home = getenv("HOME"); if (read_bookmarks && home) { BLI_snprintf(line, 256, "%s/", home); - fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, FS_INSERT_SORTED); + fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, FS_INSERT_SORTED); BLI_snprintf(line, 256, "%s/Desktop/", home); if (BLI_exists(line)) { - fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, FS_INSERT_SORTED); + fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, FS_INSERT_SORTED); } BLI_snprintf(line, 256, "%s/Documents/", home); if (BLI_exists(line)) { - fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, FS_INSERT_SORTED); + fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, FS_INSERT_SORTED); } BLI_snprintf(line, 256, "%s/Pictures/", home); if (BLI_exists(line)) { - fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, FS_INSERT_SORTED); + fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, FS_INSERT_SORTED); } BLI_snprintf(line, 256, "%s/Music/", home); if (BLI_exists(line)) { - fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, FS_INSERT_SORTED); + fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, FS_INSERT_SORTED); } BLI_snprintf(line, 256, "%s/Movies/", home); if (BLI_exists(line)) { - fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, FS_INSERT_SORTED); + fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, FS_INSERT_SORTED); } } #else @@ -423,7 +429,7 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks) if (!CFStringGetCString(pathString, line, 256, kCFStringEncodingASCII)) continue; - fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM, line, FS_INSERT_SORTED); + fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, FS_INSERT_SORTED); CFRelease(pathString); CFRelease(cfURL); @@ -450,7 +456,7 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks) FSRefMakePath(&dir, path, FILE_MAX); - fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM, (char *)path, FS_INSERT_SORTED); + fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, (char *)path, FS_INSERT_SORTED); } /* Finally get user favorite places */ @@ -473,7 +479,7 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks) if (!CFStringGetCString(pathString, line, 256, kCFStringEncodingASCII)) continue; - fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, FS_INSERT_SORTED); + fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, FS_INSERT_SORTED); CFRelease(pathString); CFRelease(cfURL); @@ -491,10 +497,10 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks) if (read_bookmarks && home) { BLI_snprintf(line, FILE_MAXDIR, "%s/", home); - fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, FS_INSERT_SORTED); + fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, FS_INSERT_SORTED); BLI_snprintf(line, FILE_MAXDIR, "%s/Desktop/", home); if (BLI_exists(line)) { - fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, FS_INSERT_SORTED); + fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, FS_INSERT_SORTED); } } @@ -564,13 +570,17 @@ void fsmenu_refresh_system_category(struct FSMenu *fsmenu) fsmenu_free_category(fsmenu, FS_CATEGORY_SYSTEM); fsmenu_set_category(fsmenu, FS_CATEGORY_SYSTEM, NULL); + fsmenu_free_category(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS); + fsmenu_set_category(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, NULL); + /* Add all entries to system category */ - fsmenu_read_system(fsmenu, FALSE); + fsmenu_read_system(fsmenu, TRUE); } void fsmenu_free(struct FSMenu *fsmenu) { fsmenu_free_category(fsmenu, FS_CATEGORY_SYSTEM); + fsmenu_free_category(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS); fsmenu_free_category(fsmenu, FS_CATEGORY_BOOKMARKS); fsmenu_free_category(fsmenu, FS_CATEGORY_RECENT); MEM_freeN(fsmenu); diff --git a/source/blender/editors/space_file/fsmenu.h b/source/blender/editors/space_file/fsmenu.h index 30730578085..1b69eb09fce 100644 --- a/source/blender/editors/space_file/fsmenu.h +++ b/source/blender/editors/space_file/fsmenu.h @@ -39,6 +39,7 @@ typedef enum FSMenuCategory { FS_CATEGORY_SYSTEM, + FS_CATEGORY_SYSTEM_BOOKMARKS, FS_CATEGORY_BOOKMARKS, FS_CATEGORY_RECENT } FSMenuCategory; diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 89b1208e800..2256968da56 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -532,7 +532,8 @@ typedef enum eUserpref_UI_Flag { USER_SPLASH_DISABLE = (1 << 27), USER_HIDE_RECENT = (1 << 28), USER_SHOW_THUMBNAILS = (1 << 29), - USER_QUIT_PROMPT = (1 << 30) + USER_QUIT_PROMPT = (1 << 30), + USER_HIDE_SYSTEM_BOOKMARKS = (1 << 31) } eUserpref_UI_Flag; /* Auto-Keying mode */ diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 64992eda954..baa892ecdc8 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -3511,6 +3511,10 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_HIDE_RECENT); RNA_def_property_ui_text(prop, "Hide Recent Locations", "Hide recent locations in the file selector"); + prop = RNA_def_property(srna, "hide_system_bookmarks", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_HIDE_SYSTEM_BOOKMARKS); + RNA_def_property_ui_text(prop, "Hide System Bookmarks", "Hide system bookmarks in the file selector"); + prop = RNA_def_property(srna, "show_thumbnails", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_SHOW_THUMBNAILS); RNA_def_property_ui_text(prop, "Show Thumbnails", "Open in thumbnail view for images and movies"); |