Fix T38945, empty "System Bookmarks" and "Recent" panel were drawn in the File Browser, although these were disabled in User Preferences.

This commit is contained in:
Thomas Dinges 2014-03-04 16:47:07 +01:00
parent ef40e889ca
commit 1754c0de33
Notes: blender-bot 2023-02-14 11:05:02 +01:00
Referenced by issue #38945, System Bookmarks dont disappear
1 changed files with 14 additions and 0 deletions

View File

@ -135,6 +135,12 @@ 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 int file_panel_system_bookmarks_poll(const bContext *C, PanelType *UNUSED(pt))
{
SpaceFile *sfile = CTX_wm_space_file(C);
return (sfile && !(U.uiflag & USER_HIDE_SYSTEM_BOOKMARKS));
}
static void file_panel_system_bookmarks(const bContext *C, Panel *pa)
{
SpaceFile *sfile = CTX_wm_space_file(C);
@ -159,6 +165,12 @@ static void file_panel_bookmarks(const bContext *C, Panel *pa)
}
}
static int file_panel_recent_poll(const bContext *C, PanelType *UNUSED(pt))
{
SpaceFile *sfile = CTX_wm_space_file(C);
return (sfile && !(U.uiflag & USER_HIDE_RECENT));
}
static void file_panel_recent(const bContext *C, Panel *pa)
{
SpaceFile *sfile = CTX_wm_space_file(C);
@ -228,6 +240,7 @@ void file_panels_register(ARegionType *art)
strcpy(pt->label, N_("System Bookmarks"));
strcpy(pt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA);
pt->draw = file_panel_system_bookmarks;
pt->poll = file_panel_system_bookmarks_poll;
BLI_addtail(&art->paneltypes, pt);
pt = MEM_callocN(sizeof(PanelType), "spacetype file bookmarks");
@ -242,6 +255,7 @@ void file_panels_register(ARegionType *art)
strcpy(pt->label, N_("Recent"));
strcpy(pt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA);
pt->draw = file_panel_recent;
pt->poll = file_panel_recent_poll;
BLI_addtail(&art->paneltypes, pt);
pt = MEM_callocN(sizeof(PanelType), "spacetype file operator properties");