diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-03-26 13:09:31 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-03-26 13:09:31 +0400 |
commit | 18d2dd7e3ae0338829fd61740151f41c21668474 (patch) | |
tree | 53d755b496944c9017c2cda0ac812e7c545f4024 /source/blender/editors/space_file | |
parent | fc9e0a37f0087d003808a87c26e46ed573ae39dd (diff) | |
parent | f1ed223e34e61777af46d33e5bfc2fc03223a689 (diff) |
Merging r55547 through r55594 from trunk into soc-2008-mxcurioni
Diffstat (limited to 'source/blender/editors/space_file')
-rw-r--r-- | source/blender/editors/space_file/file_draw.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_file/file_ops.c | 40 |
2 files changed, 26 insertions, 16 deletions
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 5b6b8656072..1c677d7c006 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -538,7 +538,7 @@ void file_draw_list(const bContext *C, ARegion *ar) uiButSetRenameFunc(but, renamebutton_cb, file); uiButSetFlag(but, UI_BUT_NO_UTF8); /* allow non utf8 names */ uiButClearFlag(but, UI_BUT_UNDO); - if (0 == uiButActiveOnly(C, block, but)) { + if (0 == uiButActiveOnly(C, ar, block, but)) { file->selflag &= ~EDITING_FILE; } } diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index f705831c715..e3270d9ce8e 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -1460,17 +1460,21 @@ static int file_delete_poll(bContext *C) { int poll = ED_operator_file_active(C); SpaceFile *sfile = CTX_wm_space_file(C); - struct direntry *file; if (sfile && sfile->params) { - if (sfile->params->active_file < 0) { - poll = 0; + char dir[FILE_MAX], group[FILE_MAX]; + int numfiles = filelist_numfiles(sfile->files); + int i; + int num_selected = 0; + + if (filelist_islibrary(sfile->files, dir, group)) poll = 0; + for (i = 0; i < numfiles; i++) { + if (filelist_is_selected(sfile->files, i, CHECK_FILES)) { + num_selected++; + } } - else { - char dir[FILE_MAX], group[FILE_MAX]; - if (filelist_islibrary(sfile->files, dir, group)) poll = 0; - file = filelist_file(sfile->files, sfile->params->active_file); - if (file && S_ISDIR(file->type)) poll = 0; + if (num_selected <= 0) { + poll = 0; } } else @@ -1484,12 +1488,18 @@ int file_delete_exec(bContext *C, wmOperator *UNUSED(op)) char str[FILE_MAX]; wmWindowManager *wm = CTX_wm_manager(C); SpaceFile *sfile = CTX_wm_space_file(C); - struct direntry *file; - + struct direntry *file; + int numfiles = filelist_numfiles(sfile->files); + int i; + + for (i = 0; i < numfiles; i++) { + if (filelist_is_selected(sfile->files, i, CHECK_FILES)) { + file = filelist_file(sfile->files, i); + BLI_make_file_string(G.main->name, str, sfile->params->dir, file->relname); + BLI_delete(str, false, false); + } + } - file = filelist_file(sfile->files, sfile->params->active_file); - BLI_make_file_string(G.main->name, str, sfile->params->dir, file->relname); - BLI_delete(str, false, false); ED_fileselect_clear(wm, sfile); WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL); @@ -1500,8 +1510,8 @@ int file_delete_exec(bContext *C, wmOperator *UNUSED(op)) void FILE_OT_delete(struct wmOperatorType *ot) { /* identifiers */ - ot->name = "Delete File"; - ot->description = "Delete selected file"; + ot->name = "Delete Selected Files"; + ot->description = "Delete selected files"; ot->idname = "FILE_OT_delete"; /* api callbacks */ |