2.5: fix for recent file operator opening wrong item.

This commit is contained in:
Brecht Van Lommel 2009-09-09 17:34:14 +00:00
parent 11c5cb452c
commit d4a69283a6

@ -803,7 +803,7 @@ static int recentfile_exec(bContext *C, wmOperator *op)
WM_read_file(C, G.sce, op->reports); WM_read_file(C, G.sce, op->reports);
} }
else { else {
struct RecentFile *recent = BLI_findlink(&(G.recent_files), event-2); struct RecentFile *recent = BLI_findlink(&(G.recent_files), event-1);
if(recent) { if(recent) {
WM_event_add_notifier(C, NC_WINDOW, NULL); WM_event_add_notifier(C, NC_WINDOW, NULL);
WM_read_file(C, recent->filename, op->reports); WM_read_file(C, recent->filename, op->reports);
@ -831,11 +831,11 @@ static EnumPropertyItem *open_recentfile_itemf(bContext *C, PointerRNA *ptr, int
EnumPropertyItem tmp = {0, "", 0, "", ""}; EnumPropertyItem tmp = {0, "", 0, "", ""};
EnumPropertyItem *item= NULL; EnumPropertyItem *item= NULL;
struct RecentFile *recent; struct RecentFile *recent;
int totitem= 0, i, ofs= 0; int totitem= 0, i;
/* dynamically construct enum */ /* dynamically construct enum */
for(recent = G.recent_files.first, i=0; (i<U.recent_files) && (recent); recent = recent->next, i++) { for(recent = G.recent_files.first, i=0; (i<U.recent_files) && (recent); recent = recent->next, i++) {
tmp.value= i+ofs+1; tmp.value= i+1;
tmp.identifier= recent->filename; tmp.identifier= recent->filename;
tmp.name= recent->filename; tmp.name= recent->filename;
RNA_enum_item_add(&item, &totitem, &tmp); RNA_enum_item_add(&item, &totitem, &tmp);