static int file_operator_poll(bContext *C) { int poll = ED_operator_file_active(C); SpaceFile *sfile = CTX_wm_space_file(C); if (!sfile || !sfile->op) poll = 0; return poll; }
static int file_rename_poll(bContext *C) { int poll = ED_operator_file_active(C); SpaceFile *sfile= CTX_wm_space_file(C); if (sfile && sfile->params) { if (sfile->params->active_file < 0) { poll= 0; } else { char dir[FILE_MAX], group[FILE_MAX]; if (filelist_islibrary(sfile->files, dir, group)) poll= 0; } } else poll= 0; return poll; }
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; } 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; } } else poll= 0; return poll; }
/* TODO, directory operator is non-functional while a library is loaded * until this is properly supported just disable it. */ static int file_directory_poll(bContext *C) { return ED_operator_file_active(C) && filelist_lib(CTX_wm_space_file(C)->files) == NULL; }