diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-09-17 06:19:41 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-09-17 06:19:41 +0400 |
commit | 3cae9ca04353c33eb940ba2dccefe9b69d9e0ae7 (patch) | |
tree | 1ea9aa812c9e6fb239e7650600a038e8b9203ed7 | |
parent | a5003727c59859e8e9e2650ce18532ebc5771a88 (diff) |
fix [#32564] Entries in recent list (file select dialog) don't get pushed to top if used again
-rw-r--r-- | source/blender/editors/space_file/file_ops.c | 5 | ||||
-rw-r--r-- | source/blender/editors/space_file/fsmenu.c | 10 | ||||
-rw-r--r-- | source/blender/editors/space_file/fsmenu.h | 3 |
3 files changed, 14 insertions, 4 deletions
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index aa423448e45..f0fdffadb12 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -770,8 +770,9 @@ int file_exec(bContext *C, wmOperator *exec_op) file_sfile_to_operator(op, sfile, filepath); - if (BLI_exists(sfile->params->dir)) - fsmenu_insert_entry(fsmenu_get(), FS_CATEGORY_RECENT, sfile->params->dir, FS_INSERT_SAVE); + if (BLI_exists(sfile->params->dir)) { + fsmenu_insert_entry(fsmenu_get(), FS_CATEGORY_RECENT, sfile->params->dir, FS_INSERT_SAVE | FS_INSERT_FIRST); + } BLI_make_file_string(G.main->name, filepath, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_BOOKMARK_FILE); fsmenu_write_file(fsmenu_get(), filepath); diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c index 474ec81ad93..3877534e1dc 100644 --- a/source/blender/editors/space_file/fsmenu.c +++ b/source/blender/editors/space_file/fsmenu.c @@ -164,14 +164,22 @@ void fsmenu_insert_entry(struct FSMenu *fsmenu, FSMenuCategory category, const c FSMenuEntry *prev; FSMenuEntry *fsme; FSMenuEntry *fsms; + FSMenuEntry *fsms_first; fsms = fsmenu_get_category(fsmenu, category); - prev = fsme = fsms; + prev = fsme = fsms_first = fsms; for (; fsme; prev = fsme, fsme = fsme->next) { if (fsme->path) { const int cmp_ret = BLI_path_cmp(path, fsme->path); if (cmp_ret == 0) { + if (FS_INSERT_FIRST) { + if (fsme != fsms_first) { + prev->next = fsme->next; + fsme->next = fsms_first; + fsmenu_set_category(fsmenu, category, fsme); + } + } return; } else if ((flag & FS_INSERT_SORTED) && cmp_ret < 0) { diff --git a/source/blender/editors/space_file/fsmenu.h b/source/blender/editors/space_file/fsmenu.h index a16aab19842..875f8de42bd 100644 --- a/source/blender/editors/space_file/fsmenu.h +++ b/source/blender/editors/space_file/fsmenu.h @@ -45,7 +45,8 @@ typedef enum FSMenuCategory { typedef enum FSMenuInsert { FS_INSERT_SORTED = (1 << 0), - FS_INSERT_SAVE = (1 << 1) + FS_INSERT_SAVE = (1 << 1), + FS_INSERT_FIRST = (1 << 2) /* moves the item to the front of the list when its already there */ } FSMenuInsert; struct FSMenu; |