Skip to content

Commit 9cf4df5

Browse files
ralfbrownTurboGit
authored andcommitted
add busy indicators for applying GPX files
Displaying a GPX track preview can take tens of seconds if there are many images and their thumbnails are not cached. During this time, the GUI is frozen, so enable the busy cursor. Also add a progress bar when applying the GPX track to images, though this is a far faster operation.
1 parent cf3e972 commit 9cf4df5

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/control/jobs/control_jobs.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,6 +1375,9 @@ static int32_t _control_gpx_apply_job_run(dt_job_t *job)
13751375
const dt_control_gpx_apply_t *d = params->data;
13761376
const gchar *filename = d->filename;
13771377
const gchar *tz = d->tz;
1378+
char message[512] = { 0 };
1379+
double fraction = 0;
1380+
13781381
/* do we have any selected images */
13791382
if(!t) goto bail_out;
13801383

@@ -1389,6 +1392,13 @@ static int32_t _control_gpx_apply_job_run(dt_job_t *job)
13891392
GTimeZone *tz_camera = (tz == NULL) ? g_time_zone_new_utc() : g_time_zone_new(tz);
13901393
if(!tz_camera) goto bail_out;
13911394

1395+
const guint total = g_list_length(t);
1396+
double prev_time = 0;
1397+
g_snprintf(message, sizeof(message),
1398+
ngettext("setting GPS information", "setting GPS information for %u images", total),
1399+
total);
1400+
dt_control_job_set_progress_message(job, message);
1401+
13921402
GList *imgs = NULL;
13931403
GArray *gloc = g_array_new(FALSE, FALSE, sizeof(dt_image_geoloc_t));
13941404
/* go thru each selected image and lookup location in gpx */
@@ -1424,6 +1434,7 @@ static int32_t _control_gpx_apply_job_run(dt_job_t *job)
14241434
g_list_free(grps);
14251435
}
14261436
g_date_time_unref(utc_time);
1437+
_update_progress(job, fraction, &prev_time);
14271438
} while((t = g_list_next(t)) != NULL);
14281439
imgs = g_list_reverse(imgs);
14291440

src/libs/geotagging.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ static void _remove_images_from_map(dt_lib_module_t *self)
299299

300300
static void _refresh_images_displayed_on_track(const int segid, const gboolean active, dt_lib_module_t *self)
301301
{
302+
dt_gui_cursor_set_busy();
302303
dt_lib_geotagging_t *d = self->data;
303304
for(GList *i = d->imgs; i; i = g_list_next(i))
304305
{
@@ -342,6 +343,7 @@ static void _refresh_images_displayed_on_track(const int segid, const gboolean a
342343
}
343344
}
344345
}
346+
dt_gui_cursor_clear_busy();
345347
}
346348

347349
static void _update_nb_images(dt_lib_module_t *self)

0 commit comments

Comments
 (0)