Mend personal Template loading bug in New dialog
Mended bug where a personal Template could not be loaded due to how we tracked which entry in the "New" dialog was the first template image. Also, don't track directories when searching for Starters and Templates (e.g., ".", "..", and ".thumbs"), since it's just a waste of time/space.
This commit is contained in:
parent
5a1a80ff69
commit
a36dcee321
2 changed files with 11 additions and 9 deletions
|
|
@ -116,6 +116,10 @@ $Id$
|
||||||
descriptions, if we failed to know what language to use
|
descriptions, if we failed to know what language to use
|
||||||
(see above).
|
(see above).
|
||||||
|
|
||||||
|
* Mended bug where a personal Template could not be loaded
|
||||||
|
due to how we tracked which entry in the "New" dialog
|
||||||
|
was the first template image.
|
||||||
|
|
||||||
* New Translations:
|
* New Translations:
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
(See COPYING.txt)
|
(See COPYING.txt)
|
||||||
|
|
||||||
June 14, 2002 - November 10, 2020
|
June 14, 2002 - November 13, 2020
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -11635,6 +11635,7 @@ static SDL_Surface *load_starter_helper(char *path_and_basename, const char *ext
|
||||||
|
|
||||||
ext = strdup(extension);
|
ext = strdup(extension);
|
||||||
safe_snprintf(fname, sizeof(fname), "%s.%s", path_and_basename, ext);
|
safe_snprintf(fname, sizeof(fname), "%s.%s", path_and_basename, ext);
|
||||||
|
|
||||||
surf = (*load_func) (fname);
|
surf = (*load_func) (fname);
|
||||||
|
|
||||||
if (surf == NULL)
|
if (surf == NULL)
|
||||||
|
|
@ -16194,6 +16195,7 @@ static void play_slideshow(int *selected, int num_selected, char *dirname, char
|
||||||
SDL_Surface *img;
|
SDL_Surface *img;
|
||||||
char *tmp_starter_id, *tmp_template_id, *tmp_file_id;
|
char *tmp_starter_id, *tmp_template_id, *tmp_file_id;
|
||||||
int tmp_starter_mirrored, tmp_starter_flipped, tmp_starter_personal;
|
int tmp_starter_mirrored, tmp_starter_flipped, tmp_starter_personal;
|
||||||
|
/* FIXME: Do we want to keep `template_personal` safe, too? */
|
||||||
char fname[1024];
|
char fname[1024];
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
SDLKey key;
|
SDLKey key;
|
||||||
|
|
@ -16211,6 +16213,7 @@ static void play_slideshow(int *selected, int num_selected, char *dirname, char
|
||||||
tmp_starter_mirrored = starter_mirrored;
|
tmp_starter_mirrored = starter_mirrored;
|
||||||
tmp_starter_flipped = starter_flipped;
|
tmp_starter_flipped = starter_flipped;
|
||||||
tmp_starter_personal = starter_personal;
|
tmp_starter_personal = starter_personal;
|
||||||
|
/* FIXME: Do we want to keep `template_personal` safe, too? */
|
||||||
|
|
||||||
do_setcursor(cursor_tiny);
|
do_setcursor(cursor_tiny);
|
||||||
|
|
||||||
|
|
@ -19063,7 +19066,7 @@ static int do_new_dialog(void)
|
||||||
DIR *d;
|
DIR *d;
|
||||||
struct dirent *f;
|
struct dirent *f;
|
||||||
struct dirent2 *fs;
|
struct dirent2 *fs;
|
||||||
int place, oldplace;
|
int place;
|
||||||
char *dirname[NUM_PLACES_TO_LOOK];
|
char *dirname[NUM_PLACES_TO_LOOK];
|
||||||
char **d_names = NULL, **d_exts = NULL;
|
char **d_names = NULL, **d_exts = NULL;
|
||||||
int *d_places;
|
int *d_places;
|
||||||
|
|
@ -19149,7 +19152,7 @@ static int do_new_dialog(void)
|
||||||
{
|
{
|
||||||
f = readdir(d);
|
f = readdir(d);
|
||||||
|
|
||||||
if (f != NULL)
|
if (f != NULL && f->d_type != DT_DIR)
|
||||||
{
|
{
|
||||||
memcpy(&(fs[num_files_in_dirs].f), f, sizeof(struct dirent));
|
memcpy(&(fs[num_files_in_dirs].f), f, sizeof(struct dirent));
|
||||||
fs[num_files_in_dirs].place = places_to_look;
|
fs[num_files_in_dirs].place = places_to_look;
|
||||||
|
|
@ -19204,19 +19207,14 @@ static int do_new_dialog(void)
|
||||||
|
|
||||||
/* Read directory of images and build thumbnails: */
|
/* Read directory of images and build thumbnails: */
|
||||||
|
|
||||||
oldplace = -1;
|
|
||||||
|
|
||||||
for (j = 0; j < num_files_in_dirs; j++)
|
for (j = 0; j < num_files_in_dirs; j++)
|
||||||
{
|
{
|
||||||
f = &(fs[j].f);
|
f = &(fs[j].f);
|
||||||
place = fs[j].place;
|
place = fs[j].place;
|
||||||
|
|
||||||
if ((place == PLACE_PERSONAL_TEMPLATES_DIR || place == PLACE_TEMPLATES_DIR) && oldplace != place)
|
if ((place == PLACE_PERSONAL_TEMPLATES_DIR || place == PLACE_TEMPLATES_DIR) && first_template == -1)
|
||||||
first_template = num_files;
|
first_template = num_files;
|
||||||
|
|
||||||
oldplace = place;
|
|
||||||
|
|
||||||
|
|
||||||
show_progress_bar(screen);
|
show_progress_bar(screen);
|
||||||
|
|
||||||
if (f != NULL)
|
if (f != NULL)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue