diff options
author | Andrea Weikert <elubie@gmx.net> | 2009-03-12 09:40:03 +0300 |
---|---|---|
committer | Andrea Weikert <elubie@gmx.net> | 2009-03-12 09:40:03 +0300 |
commit | 52dc350c09558e348fa7a702671a8533a68ce850 (patch) | |
tree | b40c0fc752fbf8757e05faa0911ec0a6a2c87734 /source/blender/editors/space_file | |
parent | c3cf187123c97022b5da53de10efab5ae57b8de0 (diff) |
2.5 filebrowser
- add refresh filelist operator and button in header
Diffstat (limited to 'source/blender/editors/space_file')
-rw-r--r-- | source/blender/editors/space_file/file_header.c | 11 | ||||
-rw-r--r-- | source/blender/editors/space_file/file_intern.h | 1 | ||||
-rw-r--r-- | source/blender/editors/space_file/file_ops.c | 28 | ||||
-rw-r--r-- | source/blender/editors/space_file/space_file.c | 1 |
4 files changed, 37 insertions, 4 deletions
diff --git a/source/blender/editors/space_file/file_header.c b/source/blender/editors/space_file/file_header.c index 2f9d5ed8c7a..b967e21c99c 100644 --- a/source/blender/editors/space_file/file_header.c +++ b/source/blender/editors/space_file/file_header.c @@ -143,10 +143,13 @@ void file_header_buttons(const bContext *C, ARegion *ar) uiBlockSetEmboss(block, UI_EMBOSSX); xco += 5; - - uiDefIconButO(block, BUT, "FILE_OT_parent", WM_OP_INVOKE_DEFAULT, ICON_FILE_PARENT, xco, yco, 20, 20, "Navigate to Parent Folder"); - - xco+=XIC; + + uiBlockBeginAlign(block); + uiDefIconButO(block, BUT, "FILE_OT_parent", WM_OP_INVOKE_DEFAULT, ICON_FILE_PARENT, xco+=XIC, yco, 20, 20, "Navigate to Parent Folder"); + uiDefIconButO(block, BUT, "FILE_OT_refresh", WM_OP_INVOKE_DEFAULT, ICON_FILE_REFRESH, xco+=XIC, yco, 20, 20, "Refresh List of Files"); + uiBlockEndAlign(block); + + xco += 5; if (sfile->params->type != FILE_MAIN) { uiBlockBeginAlign(block); diff --git a/source/blender/editors/space_file/file_intern.h b/source/blender/editors/space_file/file_intern.h index 1c39e1d685e..6a75303696b 100644 --- a/source/blender/editors/space_file/file_intern.h +++ b/source/blender/editors/space_file/file_intern.h @@ -60,6 +60,7 @@ void FILE_OT_loadimages(struct wmOperatorType *ot); void FILE_OT_exec(struct wmOperatorType *ot); void FILE_OT_cancel(struct wmOperatorType *ot); void FILE_OT_parent(struct wmOperatorType *ot); +void FILE_OT_refresh(struct wmOperatorType *ot); void FILE_OT_bookmark_toggle(struct wmOperatorType *ot); int file_exec(bContext *C, struct wmOperator *unused); diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index bb25fb62702..4725014a4b1 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -569,6 +569,34 @@ void FILE_OT_parent(struct wmOperatorType *ot) ot->poll= ED_operator_file_active; /* <- important, handler is on window level */ } + +int file_refresh_exec(bContext *C, wmOperator *unused) +{ + SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C); + + if(sfile->params) { + filelist_setdir(sfile->files, sfile->params->dir); + filelist_free(sfile->files); + sfile->params->active_file = -1; + } + ED_area_tag_redraw(CTX_wm_area(C)); + + return OPERATOR_FINISHED; + +} + + +void FILE_OT_refresh(struct wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Refresh Filelist"; + ot->idname= "FILE_OT_refresh"; + + /* api callbacks */ + ot->exec= file_refresh_exec; + ot->poll= ED_operator_file_active; /* <- important, handler is on window level */ +} + struct ARegion *file_buttons_region(struct ScrArea *sa) { ARegion *ar; diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index 50dbaf08c06..d68cde85554 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -270,6 +270,7 @@ void file_operatortypes(void) WM_operatortype_append(FILE_OT_exec); WM_operatortype_append(FILE_OT_cancel); WM_operatortype_append(FILE_OT_parent); + WM_operatortype_append(FILE_OT_refresh); WM_operatortype_append(FILE_OT_bookmark_toggle); } |