forked from bartvdbraak/blender
== filebrowser ==
added operator for resetting (cleaning up) the recent folders list in the file-browser panels. (small and low risk request by dfelinto)
This commit is contained in:
parent
dd3636a6d4
commit
d9a95f967a
@ -66,6 +66,7 @@ void FILE_OT_select_border(struct wmOperatorType *ot);
|
||||
void FILE_OT_select_bookmark(struct wmOperatorType *ot);
|
||||
void FILE_OT_bookmark_add(struct wmOperatorType *ot);
|
||||
void FILE_OT_delete_bookmark(struct wmOperatorType *ot);
|
||||
void FILE_OT_reset_recent(wmOperatorType *ot);
|
||||
void FILE_OT_hidedot(struct wmOperatorType *ot);
|
||||
void FILE_OT_execute(struct wmOperatorType *ot);
|
||||
void FILE_OT_cancel(struct wmOperatorType *ot);
|
||||
|
@ -515,6 +515,35 @@ void FILE_OT_delete_bookmark(wmOperatorType *ot)
|
||||
RNA_def_int(ot->srna, "index", -1, -1, 20000, "Index", "", -1, 20000);
|
||||
}
|
||||
|
||||
static int reset_recent_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
char name[FILE_MAX];
|
||||
struct FSMenu *fsmenu = fsmenu_get();
|
||||
|
||||
while (fsmenu_get_entry(fsmenu, FS_CATEGORY_RECENT, 0) != NULL) {
|
||||
fsmenu_remove_entry(fsmenu, FS_CATEGORY_RECENT, 0);
|
||||
}
|
||||
BLI_make_file_string("/", name, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_BOOKMARK_FILE);
|
||||
fsmenu_write_file(fsmenu, name);
|
||||
ED_area_tag_redraw(sa);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void FILE_OT_reset_recent(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name = "Reset Recent";
|
||||
ot->description = "Reset Recent files";
|
||||
ot->idname = "FILE_OT_reset_recent";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec = reset_recent_exec;
|
||||
ot->poll = ED_operator_file_active;
|
||||
|
||||
}
|
||||
|
||||
int file_highlight_set(SpaceFile *sfile, ARegion *ar, int mx, int my)
|
||||
{
|
||||
View2D *v2d = &ar->v2d;
|
||||
|
@ -152,9 +152,14 @@ static void file_panel_bookmarks(const bContext *C, Panel *pa)
|
||||
static void file_panel_recent(const bContext *C, Panel *pa)
|
||||
{
|
||||
SpaceFile *sfile = CTX_wm_space_file(C);
|
||||
uiLayout *row;
|
||||
|
||||
if (sfile) {
|
||||
if (!(U.uiflag & USER_HIDE_RECENT) ) {
|
||||
row = uiLayoutRow(pa->layout, FALSE);
|
||||
uiItemO(row, IFACE_("Reset"), ICON_X, "file.reset_recent");
|
||||
uiItemL(row, NULL, ICON_NONE);
|
||||
|
||||
file_panel_category(C, pa, FS_CATEGORY_RECENT, &sfile->recentnr, ICON_FILE_FOLDER, 0);
|
||||
}
|
||||
}
|
||||
|
@ -386,6 +386,7 @@ static void file_operatortypes(void)
|
||||
WM_operatortype_append(FILE_OT_bookmark_toggle);
|
||||
WM_operatortype_append(FILE_OT_bookmark_add);
|
||||
WM_operatortype_append(FILE_OT_delete_bookmark);
|
||||
WM_operatortype_append(FILE_OT_reset_recent);
|
||||
WM_operatortype_append(FILE_OT_hidedot);
|
||||
WM_operatortype_append(FILE_OT_filenum);
|
||||
WM_operatortype_append(FILE_OT_directory_new);
|
||||
|
Loading…
Reference in New Issue
Block a user