Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/space_info/space_info.c')
-rw-r--r--source/blender/editors/space_info/space_info.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c
index 0d9f1c90489..0f483f4bcec 100644
--- a/source/blender/editors/space_info/space_info.c
+++ b/source/blender/editors/space_info/space_info.c
@@ -38,6 +38,7 @@
#include "BKE_context.h"
#include "BKE_colortools.h"
+#include "BKE_global.h"
#include "BKE_screen.h"
#include "BKE_utildefines.h"
@@ -49,7 +50,7 @@
#include "WM_types.h"
#include "UI_resources.h"
-
+#include "UI_interface.h"
#include "info_intern.h" // own include
@@ -179,6 +180,31 @@ static void info_header_listener(ARegion *ar, wmNotifier *wmn)
}
+static void recent_files_menu(const bContext *C, Menu *menu)
+{
+ struct RecentFile *recent;
+ uiLayout *layout= menu->layout;
+ uiLayoutSetOperatorContext(layout, WM_OP_EXEC_REGION_WIN);
+ if (G.recent_files.first) {
+ for(recent = G.recent_files.first; (recent); recent = recent->next) {
+ uiItemStringO(layout, BLI_path_basename(recent->filepath), ICON_FILE_BLEND, "WM_OT_open_mainfile", "filepath", recent->filepath);
+ }
+ } else {
+ uiItemL(layout, "No Recent Files", 0);
+ }
+}
+
+void recent_files_menu_register()
+{
+ MenuType *mt;
+
+ mt= MEM_callocN(sizeof(MenuType), "spacetype info menu recent files");
+ strcpy(mt->idname, "INFO_MT_file_open_recent");
+ strcpy(mt->label, "Open Recent...");
+ mt->draw= recent_files_menu;
+ WM_menutype_add(mt);
+}
+
/* only called once, from space/spacetypes.c */
void ED_spacetype_info(void)
{
@@ -217,7 +243,8 @@ void ED_spacetype_info(void)
BLI_addhead(&st->regiontypes, art);
-
+ recent_files_menu_register();
+
BKE_spacetype_register(st);
}