diff options
author | julianeisel <julian_eisel@web.de> | 2014-12-24 21:51:42 +0300 |
---|---|---|
committer | julianeisel <julian_eisel@web.de> | 2014-12-24 21:51:42 +0300 |
commit | 76b4fad6dbda1b10c8db1acec49c30386c9d9a94 (patch) | |
tree | 5ecd25f9a1df20cf1d0e4f4db5399038576f2e91 /source | |
parent | 703bb0f62dbcd2a6ddebd1faae238790c0e19a46 (diff) |
Fix T42879: File Browser - disable selecting ".." entry (Parent Directory)
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/space_file/file_draw.c | 5 | ||||
-rw-r--r-- | source/blender/editors/space_file/file_ops.c | 16 |
2 files changed, 19 insertions, 2 deletions
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 2b2fa04c4a6..d5eeff4f5e4 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -518,6 +518,11 @@ void file_draw_list(const bContext *C, ARegion *ar) if ((params->active_file == i) || (file->selflag & HILITED_FILE) || (file->selflag & SELECTED_FILE)) { int colorid = (file->selflag & SELECTED_FILE) ? TH_HILITE : TH_BACK; int shade = (params->active_file == i) || (file->selflag & HILITED_FILE) ? 20 : 0; + + /* readonly files (".." and ".") must not be drawn as selected - set color back to normal */ + if (STREQ(file->relname, "..") || STREQ(file->relname, ".")) { + colorid = TH_BACK; + } draw_tile(sx, sy - 1, layout->tile_w + 4, sfile->layout->tile_h + layout->tile_border_y, colorid, shade); } } diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index df3f989c3a2..5798529583f 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -341,8 +341,20 @@ static int file_select_invoke(bContext *C, wmOperator *op, const wmEvent *event) if (!BLI_rcti_isect_pt(&ar->v2d.mask, rect.xmin, rect.ymin)) return OPERATOR_CANCELLED; - /* single select, deselect all selected first */ - if (!extend) file_deselect_all(sfile, SELECTED_FILE); + if (sfile && sfile->params) { + int idx = sfile->params->active_file; + + if (idx >= 0) { + struct direntry *file = filelist_file(sfile->files, idx); + if (STREQ(file->relname, "..") || STREQ(file->relname, ".")) { + /* skip - If a readonly file (".." or ".") is selected, skip deselect all! */ + } + else { + /* single select, deselect all selected first */ + if (!extend) file_deselect_all(sfile, SELECTED_FILE); + } + } + } ret = file_select(C, &rect, extend ? FILE_SEL_TOGGLE : FILE_SEL_ADD, fill, do_diropen); if (FILE_SELECT_DIR == ret) |