UI: Implement a Clear Recent Files List Operator #116494
|
@ -206,6 +206,8 @@ static void recent_files_menu_draw(const bContext * /*C*/, Menu *menu)
|
||||||
RNA_string_set(&ptr, "filepath", recent->filepath);
|
RNA_string_set(&ptr, "filepath", recent->filepath);
|
||||||
RNA_boolean_set(&ptr, "display_file_selector", false);
|
RNA_boolean_set(&ptr, "display_file_selector", false);
|
||||||
}
|
}
|
||||||
|
uiItemS(layout);
|
||||||
|
uiItemO(layout, nullptr, ICON_NONE, "WM_OT_clear_recent_files");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
uiItemL(layout, IFACE_("No Recent Files"), ICON_NONE);
|
uiItemL(layout, IFACE_("No Recent Files"), ICON_NONE);
|
||||||
|
|
|
@ -3544,6 +3544,30 @@ void WM_OT_save_mainfile(wmOperatorType *ot)
|
||||||
|
|
||||||
/** \} */
|
/** \} */
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------- */
|
||||||
|
/** \name Clear Recent Files List Operator
|
||||||
|
* \{ */
|
||||||
|
|
||||||
|
static int wm_clear_recent_files_exec(bContext * /*C*/, wmOperator * /*op*/)
|
||||||
|
{
|
||||||
|
wm_history_files_free();
|
||||||
|
wm_history_file_write();
|
||||||
|
|
||||||
|
return OPERATOR_FINISHED;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WM_OT_clear_recent_files(wmOperatorType *ot)
|
||||||
|
{
|
||||||
|
ot->name = "Clear Recent Files";
|
||||||
|
ot->idname = "WM_OT_clear_recent_files";
|
||||||
|
ot->description = "Clear the Recent Files List";
|
||||||
|
|
||||||
|
ot->invoke = WM_operator_confirm;
|
||||||
|
ot->exec = wm_clear_recent_files_exec;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \} */
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
/** \name Auto Script Execution Warning Dialog
|
/** \name Auto Script Execution Warning Dialog
|
||||||
* \{ */
|
* \{ */
|
||||||
|
|
|
@ -3888,6 +3888,7 @@ void wm_operatortypes_register()
|
||||||
WM_operatortype_append(WM_OT_recover_auto_save);
|
WM_operatortype_append(WM_OT_recover_auto_save);
|
||||||
WM_operatortype_append(WM_OT_save_as_mainfile);
|
WM_operatortype_append(WM_OT_save_as_mainfile);
|
||||||
WM_operatortype_append(WM_OT_save_mainfile);
|
WM_operatortype_append(WM_OT_save_mainfile);
|
||||||
|
WM_operatortype_append(WM_OT_clear_recent_files);
|
||||||
WM_operatortype_append(WM_OT_redraw_timer);
|
WM_operatortype_append(WM_OT_redraw_timer);
|
||||||
WM_operatortype_append(WM_OT_memory_statistics);
|
WM_operatortype_append(WM_OT_memory_statistics);
|
||||||
WM_operatortype_append(WM_OT_debug_menu);
|
WM_operatortype_append(WM_OT_debug_menu);
|
||||||
|
|
|
@ -116,6 +116,8 @@ void WM_OT_recover_auto_save(wmOperatorType *ot);
|
||||||
void WM_OT_save_as_mainfile(wmOperatorType *ot);
|
void WM_OT_save_as_mainfile(wmOperatorType *ot);
|
||||||
void WM_OT_save_mainfile(wmOperatorType *ot);
|
void WM_OT_save_mainfile(wmOperatorType *ot);
|
||||||
|
|
||||||
|
void WM_OT_clear_recent_files(wmOperatorType *ot);
|
||||||
|
|
||||||
/* `wm_files_link.cc` */
|
/* `wm_files_link.cc` */
|
||||||
|
|
||||||
void WM_OT_link(wmOperatorType *ot);
|
void WM_OT_link(wmOperatorType *ot);
|
||||||
|
|
Loading…
Reference in New Issue