Commit: 1754c0de3312bda162ae3709ab7b8f95a2914866
Author: Thomas Dinges
Date:   Tue Mar 4 16:47:07 2014 +0100
https://developer.blender.org/rB1754c0de3312bda162ae3709ab7b8f95a2914866

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

===================================================================

M       source/blender/editors/space_file/file_panels.c

===================================================================

diff --git a/source/blender/editors/space_file/file_panels.c 
b/source/blender/editors/space_file/file_panels.c
index 77cea89..4b81b72 100644
--- a/source/blender/editors/space_file/file_panels.c
+++ b/source/blender/editors/space_file/file_panels.c
@@ -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");

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to