--- gthumb-2.9.1/data/glade/gthumb_tools.glade	2006-12-08 12:31:03.000000000 +0100
+++ gthumb-2.9.1-exifdate/data/glade/gthumb_tools.glade	2007-02-04 23:56:01.000000000 +0100
@@ -2071,6 +2071,25 @@
 			  <property name="fill">False</property>
 			</packing>
 		      </child>
+
+		      <child>
+			<widget class="GtkCheckButton" id="cd_exif_checkbutton">
+			  <property name="visible">True</property>
+			  <property name="can_focus">True</property>
+			  <property name="label" translatable="yes">EXIF date</property>
+			  <property name="use_underline">True</property>
+			  <property name="relief">GTK_RELIEF_NORMAL</property>
+			  <property name="focus_on_click">True</property>
+			  <property name="active">False</property>
+			  <property name="inconsistent">False</property>
+			  <property name="draw_indicator">True</property>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">False</property>
+			  <property name="fill">False</property>
+			</packing>
+		      </child>
 		    </widget>
 		    <packing>
 		      <property name="padding">0</property>
--- gthumb-2.9.1/libgthumb/gth-exif-utils.c	2006-11-08 19:18:32.000000000 +0100
+++ gthumb-2.9.1-exifdate/libgthumb/gth-exif-utils.c	2007-02-16 23:11:40.000000000 +0100
@@ -32,6 +32,57 @@
 
 
 char *
+set_exif_tag (const char *uri,
+	      ExifTag     etag,
+	      char       *value,
+	      int         size)
+{
+	int          i;
+	int          counter;
+	char        *filename;
+	ExifEntry   *entry;
+	ExifData    *edata;
+	ExifContent *content;
+
+
+	if ((filename = get_file_path_from_uri(uri)) == NULL)
+		return NULL;
+
+	edata = exif_data_new_from_file(filename);
+
+	if (edata == NULL) 
+		return NULL;
+
+        counter = 0;
+
+	for (i = 0; i < EXIF_IFD_COUNT; i++) {
+		
+		if (((content = edata->ifd[i]) == NULL) || (content->count == 0)) 
+			continue;
+
+		if ((entry = exif_content_get_entry(content, etag)) != NULL){
+			entry->size = strnlen(value, size);
+			free(entry->data);
+			if ((entry->data = strndup(value, size)) == NULL){
+				printf("strndup() is out of memory\n");
+				break;
+			}
+			counter++;
+		}
+	}
+
+	if (counter == 0){
+		printf("Sorry, unable to set EXIF tag\n");
+		return NULL;
+        }
+
+	save_exif_data(uri, edata);
+	exif_data_unref(edata);
+
+	return 1;
+}
+
+char *
 get_exif_tag (const char *filename,
 	      ExifTag     etag)
 {
@@ -310,6 +361,7 @@
 		jpeg_data_set_exif_data (jdata, edata);
 
 	jpeg_data_save_file (jdata, filename);
+
 	jpeg_data_unref (jdata);
 }
 
--- gthumb-2.9.1/src/dlg-change-date.c	2006-11-08 14:30:20.000000000 +0100
+++ gthumb-2.9.1-exifdate/src/dlg-change-date.c	2007-02-16 22:50:22.000000000 +0100
@@ -50,6 +50,7 @@
 
 	GtkWidget    *cd_last_modified_checkbutton;
 	GtkWidget    *cd_comment_checkbutton;
+	GtkWidget    *cd_exif_checkbutton;
 
 	GtkWidget    *cd_following_date_radiobutton;
 	GtkWidget    *cd_created_radiobutton;
@@ -156,6 +157,22 @@
 			comment_data_free (cdata);
 		}
 
+		if (is_active (data->cd_exif_checkbutton)) {
+			char buf[32];
+			struct tm tm;
+
+			localtime_r(&mtime, &tm);
+			snprintf(buf, 32, "%04d:%02d:%02d %02d:%02d:%02d ", 
+			       tm.tm_year + 1900,
+			       tm.tm_mon + 1,
+			       tm.tm_mday,
+			       tm.tm_hour,
+			       tm.tm_min,
+			       tm.tm_sec );
+			set_exif_tag(fdata->path, EXIF_TAG_DATE_TIME, buf, 32);
+			mtime++; // Step the time to enable sorting of pictures according to EXIF time
+		}
+
 		file_list = g_list_prepend (file_list, fdata->path);
 	}
 
@@ -172,8 +189,9 @@
 update_sensitivity (DialogData *data)
 {
 	gtk_widget_set_sensitive (data->ok_button,
-				  gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->cd_last_modified_checkbutton))
-				  || gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->cd_comment_checkbutton)));
+				     gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->cd_last_modified_checkbutton))
+				  || gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->cd_comment_checkbutton))
+				  || gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->cd_exif_checkbutton)));
 		
 	gtk_widget_set_sensitive (data->cd_dateedit, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->cd_following_date_radiobutton)));
 	gtk_widget_set_sensitive (data->cd_timezone_box, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->cd_adjust_timezone_radiobutton)));
@@ -234,6 +252,7 @@
 
 	data->cd_last_modified_checkbutton = glade_xml_get_widget (data->gui, "cd_last_modified_checkbutton");
 	data->cd_comment_checkbutton = glade_xml_get_widget (data->gui, "cd_comment_checkbutton");
+	data->cd_exif_checkbutton = glade_xml_get_widget (data->gui, "cd_exif_checkbutton");
 
 	data->cd_following_date_radiobutton = glade_xml_get_widget (data->gui, "cd_following_date_radiobutton");
 	data->cd_created_radiobutton = glade_xml_get_widget (data->gui, "cd_created_radiobutton");
@@ -284,7 +303,11 @@
 	g_signal_connect (G_OBJECT (data->cd_comment_checkbutton), 
 			  "clicked",
 			  G_CALLBACK (radio_button_clicked),
-			  data);
+			  data); 
+	g_signal_connect (G_OBJECT (data->cd_exif_checkbutton), 
+			  "clicked",
+			  G_CALLBACK (radio_button_clicked),
+			  data); 
 	
 	g_signal_connect (G_OBJECT (data->cd_following_date_radiobutton), 
 			  "clicked",
