]> git.street.me.uk Git - andy/viking.git/blame - src/viktrwlayer_geotag.c
Correct format for an include statement of a C standard library.
[andy/viking.git] / src / viktrwlayer_geotag.c
CommitLineData
b3eb3b98
RN
1/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2/*
3 * viking -- GPS Data and Topo Analyzer, Explorer, and Manager
4 *
5 * Copyright (C) 2011, Rob Norris <rw_norris@hotmail.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22/*
23 * Similar to the track and trackpoint properties dialogs,
24 * this is made a separate file for ease of grouping related stuff together
25 */
26#ifdef HAVE_CONFIG_H
27#include "config.h"
28#endif
29#include <math.h>
30#include <time.h>
31#include <string.h>
32#include <stdlib.h>
33#include <gtk/gtk.h>
34#include <glib/gi18n.h>
35#include "viking.h"
36#include "vikfilelist.h"
37#include "geotag_exif.h"
38#include "thumbnails.h"
404328d1 39#include "background.h"
b3eb3b98 40
404328d1 41// Function taken from GPSCorrelate 1.6.1
b3eb3b98
RN
42// ConvertToUnixTime Copyright 2005 Daniel Foote. GPL2+
43
44#define EXIF_DATE_FORMAT "%d:%d:%d %d:%d:%d"
45
46time_t ConvertToUnixTime(char* StringTime, char* Format, int TZOffsetHours, int TZOffsetMinutes)
47{
48 /* Read the time using the specified format.
49 * The format and string being read from must
50 * have the most significant time on the left,
51 * and the least significant on the right:
52 * ie, Year on the left, seconds on the right. */
53
54 /* Sanity check... */
55 if (StringTime == NULL || Format == NULL)
56 {
57 return 0;
58 }
59
60 /* Define and set up our structure. */
61 struct tm Time;
62 Time.tm_wday = 0;
63 Time.tm_yday = 0;
64 Time.tm_isdst = -1;
65
66 /* Read out the time from the string using our format. */
67 sscanf(StringTime, Format, &Time.tm_year, &Time.tm_mon,
68 &Time.tm_mday, &Time.tm_hour,
69 &Time.tm_min, &Time.tm_sec);
70
71 /* Adjust the years for the mktime function to work. */
72 Time.tm_year -= 1900;
73 Time.tm_mon -= 1;
74
75 /* Add our timezone offset to the time.
76 * We don't check to see if it overflowed anything;
77 * mktime does this and fixes it for us. */
78 /* Note also that we SUBTRACT these times. We want the
79 * result to be in UTC. */
80
81 Time.tm_hour -= TZOffsetHours;
82 Time.tm_min -= TZOffsetMinutes;
83
84 /* Calculate and return the unix time. */
85 return mktime(&Time);
86}
87
88// GPSCorrelate END
89
90typedef struct {
91 GtkWidget *dialog;
92 VikFileList *files;
93 VikTrwLayer *vtl; // to pass on
94 VikTrack *track; // Use specified track or all tracks if NULL
95 GtkCheckButton *create_waypoints_b;
96 GtkCheckButton *write_exif_b;
97 GtkLabel *overwrite_gps_exif_l; // Referenced so the sensitivity can be changed
98 GtkCheckButton *overwrite_gps_exif_b;
99 GtkLabel *no_change_mtime_l; // Referenced so the sensitivity can be changed
100 GtkCheckButton *no_change_mtime_b;
101 GtkCheckButton *interpolate_segments_b;
102 GtkEntry *time_zone_b; // TODO consider a more user friendly tz widget eg libtimezonemap or similar
103 GtkEntry *time_offset_b;
104} GeoTagWidgets;
105
106static GeoTagWidgets *geotag_widgets_new()
107{
108 GeoTagWidgets *widgets = g_malloc0(sizeof(GeoTagWidgets));
109 return widgets;
110}
111
112static void geotag_widgets_free ( GeoTagWidgets *widgets )
113{
114 // Need to free VikFileList??
115 g_free(widgets);
116}
117
118typedef struct {
119 gboolean create_waypoints;
120 gboolean write_exif;
121 gboolean overwrite_gps_exif;
122 gboolean no_change_mtime;
123 gboolean interpolate_segments;
124 gint time_offset;
125 gint TimeZoneHours;
126 gint TimeZoneMins;
127} option_values_t;
128
129typedef struct {
130 VikTrwLayer *vtl;
131 gchar *image;
132 VikTrack *track; // Use specified track or all tracks if NULL
133 // User options...
134 option_values_t ov;
404328d1 135 GList *files;
b3eb3b98
RN
136 time_t PhotoTime;
137 // Store answer from interpolation for an image
138 gboolean found_match;
139 VikCoord coord;
140 gdouble altitude;
141 // If anything has changed
142 gboolean redraw;
143} geotag_options_t;
144
145static option_values_t default_values = {
146 TRUE,
147 TRUE,
148 FALSE,
149 TRUE,
150 TRUE,
151 0,
152 0,
153 0,
154};
155
156/**
157 * Correlate the image against the specified track
158 */
159static void trw_layer_geotag_track ( const gchar *name, VikTrack *track, geotag_options_t *options )
160{
161 // If already found match then don't need to check this track
162 if ( options->found_match )
163 return;
164
165 VikTrackpoint *trkpt;
166 VikTrackpoint *trkpt_next;
167
168 GList *mytrkpt = track->trackpoints;
169 for ( mytrkpt = mytrkpt; mytrkpt; mytrkpt = mytrkpt->next ) {
170
171 // Do something for this trackpoint...
172
173 trkpt = VIK_TRACKPOINT(mytrkpt->data);
174
175 // is it exactly this point?
176 if ( options->PhotoTime == trkpt->timestamp ) {
177 options->coord = trkpt->coord;
178 options->altitude = trkpt->altitude;
179 options->found_match = TRUE;
180 break;
181 }
182
183 // Now need two trackpoints, hence check next is available
184 if ( !mytrkpt->next ) break;
185 trkpt_next = VIK_TRACKPOINT(mytrkpt->next->data);
186
187 // TODO need to use 'has_timestamp' property
188 if ( trkpt->timestamp == trkpt_next->timestamp ) continue;
189 if ( trkpt->timestamp > trkpt_next->timestamp ) continue;
190
191 // When interpolating between segments, no need for any special segment handling
192 if ( !options->ov.interpolate_segments )
193 // Don't check between segments
194 if ( trkpt_next->newsegment )
195 // Simply move on to consider next point
196 continue;
197
198 // Too far
199 if ( trkpt->timestamp > options->PhotoTime ) break;
200
201 // Is is between this and the next point?
202 if ( (options->PhotoTime > trkpt->timestamp) && (options->PhotoTime < trkpt_next->timestamp) ) {
203 options->found_match = TRUE;
204 // Interpolate
205 /* Calculate the "scale": a decimal giving the relative distance
206 * in time between the two points. Ie, a number between 0 and 1 -
207 * 0 is the first point, 1 is the next point, and 0.5 would be
208 * half way. */
209 gdouble scale = (gdouble)trkpt_next->timestamp - (gdouble)trkpt->timestamp;
210 scale = ((gdouble)options->PhotoTime - (gdouble)trkpt->timestamp) / scale;
211
212 struct LatLon ll_result, ll1, ll2;
213
214 vik_coord_to_latlon ( &(trkpt->coord), &ll1 );
215 vik_coord_to_latlon ( &(trkpt_next->coord), &ll2 );
216
217 ll_result.lat = ll1.lat + ((ll2.lat - ll1.lat) * scale);
218
219 // NB This won't cope with going over the 180 degrees longitude boundary
220 ll_result.lon = ll1.lon + ((ll2.lon - ll1.lon) * scale);
221
222 // set coord
223 vik_coord_load_from_latlon ( &(options->coord), VIK_COORD_LATLON, &ll_result );
224
225 // Interpolate elevation
226 options->altitude = trkpt->altitude + ((trkpt_next->altitude - trkpt->altitude) * scale);
227 break;
228 }
229
230 }
231}
232
233/**
234 * Correlate the image to any track within the TrackWaypoint layer
235 */
236static void trw_layer_geotag_process ( geotag_options_t *options )
237{
404328d1 238 if ( !options->vtl || !IS_VIK_LAYER(options->vtl) )
b3eb3b98
RN
239 return;
240
241 if ( !options->image )
242 return;
243
244 gboolean has_gps_exif = FALSE;
245 gchar* datetime = a_geotag_get_exif_date_from_file ( options->image, &has_gps_exif );
246
247 if ( datetime ) {
248
249 // If image already has gps info - don't attempt to change it.
250 if ( !options->ov.overwrite_gps_exif && has_gps_exif ) {
251 if ( options->ov.create_waypoints ) {
252 // Create waypoint with file information
253 gchar *name = NULL;
254 VikWaypoint *wp = a_geotag_create_waypoint_from_file ( options->image, vik_trw_layer_get_coord_mode (options->vtl), &name );
255 if ( !name )
256 name = g_strdup ( a_file_basename ( options->image ) );
257 vik_trw_layer_filein_add_waypoint ( options->vtl, name, wp );
258 g_free ( name );
259
260 // Mark for redraw
261 options->redraw = TRUE;
262 }
263 return;
264 }
265
266 options->PhotoTime = ConvertToUnixTime ( datetime, EXIF_DATE_FORMAT, options->ov.TimeZoneHours, options->ov.TimeZoneMins);
267 g_free ( datetime );
268
269 // Apply any offset
270 options->PhotoTime = options->PhotoTime + options->ov.time_offset;
271
272 options->found_match = FALSE;
273
274 if ( options->track ) {
275 // Single specified track
276 // NB Doesn't care about track name
277 trw_layer_geotag_track ( NULL, options->track, options );
278 }
279 else {
280 // Try all tracks
281 GHashTable *tracks = vik_trw_layer_get_tracks ( options->vtl );
282 if ( g_hash_table_size (tracks) > 0 ) {
283 g_hash_table_foreach ( tracks, (GHFunc) trw_layer_geotag_track, options );
284 }
285 }
286
287 // Match found ?
288 if ( options->found_match ) {
289
290 if ( options->ov.create_waypoints ) {
291
292 // Create waypoint with found position
293 gchar *name = NULL;
294 VikWaypoint *wp = a_geotag_create_waypoint_positioned ( options->image, options->coord, options->altitude, &name );
295 if ( !name )
296 name = g_strdup ( a_file_basename ( options->image ) );
297 vik_trw_layer_filein_add_waypoint ( options->vtl, name, wp );
298 g_free ( name );
299
300 // Mark for redraw
301 options->redraw = TRUE;
302 }
303
304 // Write EXIF if specified
305 if ( options->ov.write_exif ) {
306 a_geotag_write_exif_gps ( options->image, options->coord, options->altitude, options->ov.no_change_mtime );
307 }
308 }
309 }
310}
311
404328d1
RN
312/*
313 * Tidy up
314 */
315static void trw_layer_geotag_thread_free ( geotag_options_t *gtd )
316{
317 if ( gtd->files )
318 g_list_free ( gtd->files );
319 g_free ( gtd );
320}
321
322/**
323 * Run geotagging process in a separate thread
324 */
325static int trw_layer_geotag_thread ( geotag_options_t *options, gpointer threaddata )
326{
327 guint total = g_list_length(options->files), done = 0;
328
329 // TODO decide how to report any issues to the user ...
330
331 // Foreach file attempt to geotag it
332 while ( options->files ) {
333 options->image = (gchar *) ( options->files->data );
334 trw_layer_geotag_process ( options );
335 options->files = options->files->next;
336
337 // Update thread progress and detect stop requests
338 int result = a_background_thread_progress ( threaddata, ((gdouble) ++done) / total );
339 if ( result != 0 )
340 return -1; /* Abort thread */
341 }
342
343 if ( options->redraw ) {
344 if ( IS_VIK_LAYER(options->vtl) ) {
345 // Ensure any new images get shown
346 trw_layer_verify_thumbnails ( options->vtl, NULL ); // NB second parameter not used ATM
347 // Force redraw as verify only redraws if there are new thumbnails (they may already exist)
348 vik_layer_emit_update ( VIK_LAYER(options->vtl), TRUE ); // Update from background
349 }
350 }
351
352 return 0;
353}
354
b3eb3b98
RN
355/**
356 * Parse user input from dialog response
357 */
358static void trw_layer_geotag_response_cb ( GtkDialog *dialog, gint resp, GeoTagWidgets *widgets )
359{
360 switch (resp) {
361 case GTK_RESPONSE_DELETE_EVENT: /* received delete event (not from buttons) */
362 case GTK_RESPONSE_REJECT:
363 break;
364 default: {
365 //GTK_RESPONSE_ACCEPT:
366 // Get options
404328d1
RN
367 geotag_options_t *options = g_malloc ( sizeof(geotag_options_t) );
368 options->vtl = widgets->vtl;
369 options->track = widgets->track;
b3eb3b98 370 // Values extracted from the widgets:
404328d1
RN
371 options->ov.create_waypoints = gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON(widgets->create_waypoints_b) );
372 options->ov.write_exif = gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON(widgets->write_exif_b) );
373 options->ov.overwrite_gps_exif = gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON(widgets->overwrite_gps_exif_b) );
374 options->ov.no_change_mtime = gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON(widgets->no_change_mtime_b) );
375 options->ov.interpolate_segments = gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON(widgets->interpolate_segments_b) );
376 options->ov.TimeZoneHours = 0;
377 options->ov.TimeZoneMins = 0;
b3eb3b98
RN
378 const gchar* TZString = gtk_entry_get_text(GTK_ENTRY(widgets->time_zone_b));
379 /* Check the string. If there is a colon, then (hopefully) it's a time in xx:xx format.
380 * If not, it's probably just a +/-xx format. In all other cases,
381 * it will be interpreted as +/-xx, which, if given a string, returns 0. */
382 if (strstr(TZString, ":")) {
383 /* Found colon. Split into two. */
404328d1
RN
384 sscanf(TZString, "%d:%d", &options->ov.TimeZoneHours, &options->ov.TimeZoneMins);
385 if (options->ov.TimeZoneHours < 0)
386 options->ov.TimeZoneMins *= -1;
b3eb3b98
RN
387 } else {
388 /* No colon. Just parse. */
404328d1 389 options->ov.TimeZoneHours = atoi(TZString);
b3eb3b98 390 }
404328d1 391 options->ov.time_offset = atoi ( gtk_entry_get_text ( GTK_ENTRY(widgets->time_offset_b) ) );
b3eb3b98 392
404328d1 393 options->redraw = FALSE;
b3eb3b98
RN
394
395 // Save settings for reuse
404328d1 396 default_values = options->ov;
b3eb3b98 397
404328d1
RN
398 options->files = g_list_copy ( vik_file_list_get_files ( widgets->files ) );
399
400 gint len = g_list_length ( options->files );
401 gchar *tmp = g_strdup_printf ( _("Geotagging %d Images..."), len );
402
403 // Processing lots of files can take time - so run a background effort
404 a_background_thread ( VIK_GTK_WINDOW_FROM_LAYER(options->vtl),
405 tmp,
406 (vik_thr_func) trw_layer_geotag_thread,
407 options,
408 (vik_thr_free_func) trw_layer_geotag_thread_free,
409 NULL,
410 len );
411
412 g_free ( tmp );
b3eb3b98
RN
413
414 break;
415 }
416 }
417 geotag_widgets_free ( widgets );
418 gtk_widget_destroy ( GTK_WIDGET(dialog) );
419}
420
421/**
422 * Handle widget sensitivities
423 */
424static void write_exif_b_cb ( GtkWidget *gw, GeoTagWidgets *gtw )
425{
426 // Overwriting & file modification times are irrelevant if not going to write EXIF!
427 if ( gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON(gtw->write_exif_b) ) ) {
428 gtk_widget_set_sensitive ( GTK_WIDGET(gtw->overwrite_gps_exif_b), TRUE );
429 gtk_widget_set_sensitive ( GTK_WIDGET(gtw->overwrite_gps_exif_l), TRUE );
430 gtk_widget_set_sensitive ( GTK_WIDGET(gtw->no_change_mtime_b), TRUE );
431 gtk_widget_set_sensitive ( GTK_WIDGET(gtw->no_change_mtime_l), TRUE );
432 }
433 else {
434 gtk_widget_set_sensitive ( GTK_WIDGET(gtw->overwrite_gps_exif_b), FALSE );
435 gtk_widget_set_sensitive ( GTK_WIDGET(gtw->overwrite_gps_exif_l), FALSE );
436 gtk_widget_set_sensitive ( GTK_WIDGET(gtw->no_change_mtime_b), FALSE );
437 gtk_widget_set_sensitive ( GTK_WIDGET(gtw->no_change_mtime_l), FALSE );
438 }
439}
440
441
442/**
443 * trw_layer_geotag_dialog:
444 * @parent: The Window of the calling process
445 * @vtl: The VikTrwLayer to use for correlating images to tracks
446 * @track: Optional - The particular track to use (if specified) for correlating images
447 * @track_name: Optional - The name of specified track to use
448 */
449void trw_layer_geotag_dialog ( GtkWindow *parent, VikTrwLayer *vtl, VikTrack *track, const gchar *track_name )
450{
451 GeoTagWidgets *widgets = geotag_widgets_new();
452
453 widgets->dialog = gtk_dialog_new_with_buttons ( _("Geotag Images"),
454 parent,
455 GTK_DIALOG_DESTROY_WITH_PARENT,
456 GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
457 GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
458 NULL );
459 widgets->files = VIK_FILE_LIST(vik_file_list_new ( _("Images") )); // TODO would be nice to be able to set a filefilter
460 widgets->vtl = vtl;
461 widgets->track = track;
462 widgets->create_waypoints_b = GTK_CHECK_BUTTON ( gtk_check_button_new () );
463 widgets->write_exif_b = GTK_CHECK_BUTTON ( gtk_check_button_new () );
464 widgets->overwrite_gps_exif_l = GTK_LABEL ( gtk_label_new ( _("Overwrite Existing GPS Information:") ) );
465 widgets->overwrite_gps_exif_b = GTK_CHECK_BUTTON ( gtk_check_button_new () );
466 widgets->no_change_mtime_l = GTK_LABEL ( gtk_label_new ( _("Keep File Modification Timestamp:") ) );
467 widgets->no_change_mtime_b = GTK_CHECK_BUTTON ( gtk_check_button_new () );
468 widgets->interpolate_segments_b = GTK_CHECK_BUTTON ( gtk_check_button_new () );
469 widgets->time_zone_b = GTK_ENTRY ( gtk_entry_new () );
470 widgets->time_offset_b = GTK_ENTRY ( gtk_entry_new () );
471
472 gtk_entry_set_width_chars ( widgets->time_zone_b, 7);
473 gtk_entry_set_width_chars ( widgets->time_offset_b, 7);
474
475 // Defaults - TODO restore previous values / save settings somewhere??
476 gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON(widgets->create_waypoints_b), default_values.create_waypoints );
477 gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON(widgets->write_exif_b), default_values.write_exif );
478 gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON(widgets->overwrite_gps_exif_b), default_values.overwrite_gps_exif );
479 gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON(widgets->no_change_mtime_b), default_values.no_change_mtime );
480 gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON(widgets->interpolate_segments_b), default_values.interpolate_segments );
481 gchar tmp_string[7];
482 snprintf (tmp_string, 7, "%+02d:%02d", default_values.TimeZoneHours, abs (default_values.TimeZoneMins) );
483 gtk_entry_set_text ( widgets->time_zone_b, tmp_string );
484 snprintf (tmp_string, 7, "%d", default_values.time_offset );
485 gtk_entry_set_text ( widgets->time_offset_b, tmp_string );
486
487 // Ensure sensitivities setup
488 write_exif_b_cb ( GTK_WIDGET(widgets->write_exif_b), widgets );
489
490 g_signal_connect ( G_OBJECT(widgets->write_exif_b), "toggled", G_CALLBACK(write_exif_b_cb), widgets );
491
492 GtkWidget *cw_hbox = gtk_hbox_new ( FALSE, 0 );
493 gtk_box_pack_start ( GTK_BOX(cw_hbox), gtk_label_new ( _("Create Waypoints:") ), FALSE, FALSE, 5 );
494 gtk_box_pack_start ( GTK_BOX(cw_hbox), GTK_WIDGET(widgets->create_waypoints_b), FALSE, FALSE, 5 );
495
496 GtkWidget *we_hbox = gtk_hbox_new ( FALSE, 0 );
497 gtk_box_pack_start ( GTK_BOX(we_hbox), gtk_label_new ( _("Write EXIF:") ), FALSE, FALSE, 5 );
498 gtk_box_pack_start ( GTK_BOX(we_hbox), GTK_WIDGET(widgets->write_exif_b), FALSE, FALSE, 5 );
499
500 GtkWidget *og_hbox = gtk_hbox_new ( FALSE, 0 );
501 gtk_box_pack_start ( GTK_BOX(og_hbox), GTK_WIDGET(widgets->overwrite_gps_exif_l), FALSE, FALSE, 5 );
502 gtk_box_pack_start ( GTK_BOX(og_hbox), GTK_WIDGET(widgets->overwrite_gps_exif_b), FALSE, FALSE, 5 );
503
504 GtkWidget *fm_hbox = gtk_hbox_new ( FALSE, 0 );
505 gtk_box_pack_start ( GTK_BOX(fm_hbox), GTK_WIDGET(widgets->no_change_mtime_l), FALSE, FALSE, 5 );
506 gtk_box_pack_start ( GTK_BOX(fm_hbox), GTK_WIDGET(widgets->no_change_mtime_b), FALSE, FALSE, 5 );
507
508 GtkWidget *is_hbox = gtk_hbox_new ( FALSE, 0 );
509 gtk_box_pack_start ( GTK_BOX(is_hbox), gtk_label_new ( _("Interpolate Between Track Segments:") ), FALSE, FALSE, 5 );
510 gtk_box_pack_start ( GTK_BOX(is_hbox), GTK_WIDGET(widgets->interpolate_segments_b), FALSE, FALSE, 5 );
511
512 GtkWidget *to_hbox = gtk_hbox_new ( FALSE, 0 );
513 gtk_box_pack_start ( GTK_BOX(to_hbox), gtk_label_new ( _("Image Time Offset (Seconds):") ), FALSE, FALSE, 5 );
514 gtk_box_pack_start ( GTK_BOX(to_hbox), GTK_WIDGET(widgets->time_offset_b), FALSE, FALSE, 5 );
515 gtk_widget_set_tooltip_text ( GTK_WIDGET(widgets->time_offset_b), _("The number of seconds to ADD to the photos time to make it match the GPS data. Calculate this with (GPS - Photo). Can be negative or positive. Useful to adjust times when a camera's timestamp was incorrect.") );
516
517 GtkWidget *tz_hbox = gtk_hbox_new ( FALSE, 0 );
518 gtk_box_pack_start ( GTK_BOX(tz_hbox), gtk_label_new ( _("Image Timezone:") ), FALSE, FALSE, 5 );
519 gtk_box_pack_start ( GTK_BOX(tz_hbox), GTK_WIDGET(widgets->time_zone_b), FALSE, FALSE, 5 );
520 gtk_widget_set_tooltip_text ( GTK_WIDGET(widgets->time_zone_b), _("The timezone that was used when the images were created. For example, if a camera is set to AWST or +8:00 hours. Enter +8:00 here so that the correct adjustment to the images' time can be made. GPS data is always in UTC.") );
521
522 gchar *track_string = NULL;
523 if ( widgets->track )
524 track_string = g_strdup_printf ( _("Using track: %s"), track_name );
525 else
526 track_string = g_strdup_printf ( _("Using all tracks in: %s"), VIK_LAYER(widgets->vtl)->name );
527
528 gtk_box_pack_start ( GTK_BOX(GTK_DIALOG(widgets->dialog)->vbox), gtk_label_new ( track_string ), FALSE, FALSE, 5 );
529
530 gtk_box_pack_start ( GTK_BOX(GTK_DIALOG(widgets->dialog)->vbox), GTK_WIDGET(widgets->files), TRUE, TRUE, 0 );
531
532 gtk_box_pack_start ( GTK_BOX(GTK_DIALOG(widgets->dialog)->vbox), cw_hbox, FALSE, FALSE, 0);
533 gtk_box_pack_start ( GTK_BOX(GTK_DIALOG(widgets->dialog)->vbox), we_hbox, FALSE, FALSE, 0);
534 gtk_box_pack_start ( GTK_BOX(GTK_DIALOG(widgets->dialog)->vbox), og_hbox, FALSE, FALSE, 0);
535 gtk_box_pack_start ( GTK_BOX(GTK_DIALOG(widgets->dialog)->vbox), fm_hbox, FALSE, FALSE, 0);
536 gtk_box_pack_start ( GTK_BOX(GTK_DIALOG(widgets->dialog)->vbox), is_hbox, FALSE, FALSE, 0);
537 gtk_box_pack_start ( GTK_BOX(GTK_DIALOG(widgets->dialog)->vbox), to_hbox, FALSE, FALSE, 0);
538 gtk_box_pack_start ( GTK_BOX(GTK_DIALOG(widgets->dialog)->vbox), tz_hbox, FALSE, FALSE, 0);
539
540 g_signal_connect ( widgets->dialog, "response", G_CALLBACK(trw_layer_geotag_response_cb), widgets );
541
542 gtk_dialog_set_default_response ( GTK_DIALOG(widgets->dialog), GTK_RESPONSE_REJECT );
543
544 gtk_widget_show_all ( widgets->dialog );
545
546 g_free ( track_string );
547}