gthumb r2208 - in trunk: . data/glade libgthumb src
- From: mjc svn gnome org
- To: svn-commits-list gnome org
- Subject: gthumb r2208 - in trunk: . data/glade libgthumb src
- Date: Mon, 21 Jan 2008 01:12:29 +0000 (GMT)
Author: mjc
Date: Mon Jan 21 01:12:29 2008
New Revision: 2208
URL: http://svn.gnome.org/viewvc/gthumb?rev=2208&view=rev
Log:
2008-01-20 Michael J. Chudobiak <mjc svn gnome org>
* data/glade/gthumb_comments.glade:
Removed the non-existent word "digitalization".
* libgthumb/gth-exif-utils.c: (get_metadata_time_from_fd):
* libgthumb/gth-exif-utils.h:
* src/dlg-comment.c: (get_requested_time),
(date_optionmenu_changed_cb), (dlg_comment_update):
* src/dlg-photo-importer.c: (save_image):
Now, all functions obtain the exif_time for a file using the
metadata in the FileData struct. Conversion complete.
Modified:
trunk/ChangeLog
trunk/data/glade/gthumb_comments.glade
trunk/libgthumb/gth-exif-utils.c
trunk/libgthumb/gth-exif-utils.h
trunk/src/dlg-comment.c
trunk/src/dlg-photo-importer.c
Modified: trunk/data/glade/gthumb_comments.glade
==============================================================================
--- trunk/data/glade/gthumb_comments.glade (original)
+++ trunk/data/glade/gthumb_comments.glade Mon Jan 21 01:12:29 2008
@@ -525,7 +525,7 @@
<child>
<widget class="GtkMenuItem" id="photo_digitalization_date_(from_exif_data)1">
<property name="visible">True</property>
- <property name="label" translatable="yes">Photo digitalization date (From EXIF data)</property>
+ <property name="label" translatable="yes">Date photo taken (from EXIF metadata)</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_photo_digitalization_date_(from_exif_data)1_activate" last_modification_time="Mon, 02 Jun 2003 19:35:05 GMT"/>
</widget>
Modified: trunk/libgthumb/gth-exif-utils.c
==============================================================================
--- trunk/libgthumb/gth-exif-utils.c (original)
+++ trunk/libgthumb/gth-exif-utils.c Mon Jan 21 01:12:29 2008
@@ -194,43 +194,25 @@
time_t
get_metadata_time_from_fd (FileData *fd)
{
- return get_metadata_time (fd->mime_type, fd->path, fd->metadata);
-}
-
+ int i, len;
+ char *date = NULL;
+ time_t result = 0;
-time_t
-get_metadata_time (const char *mime_type,
- const char *uri,
- GList *md)
-{
- gboolean loaded_metadata = FALSE;
-
- if (md == NULL) {
- if (mime_type == NULL)
- mime_type = get_mime_type (uri);
- md = update_metadata (NULL, uri, mime_type);
- loaded_metadata = TRUE;
- }
-
- int i;
- int len = (sizeof (DATE_TAG_NAMES) / sizeof (DATE_TAG_NAMES[0])) + 1;
- char *date = NULL;
+ len = (sizeof (DATE_TAG_NAMES) / sizeof (DATE_TAG_NAMES[0])) + 1;
for (i = 0; i < len && date == NULL; i++) {
- GList *search_result = g_list_find_custom (md, DATE_TAG_NAMES[i], (GCompareFunc)metadata_search);
+ GList *search_result = g_list_find_custom (fd->metadata, DATE_TAG_NAMES[i], (GCompareFunc)metadata_search);
if (search_result != NULL) {
GthMetadata *md_entry = search_result->data;
- date = g_strdup(md_entry->value);
+ date = g_strdup (md_entry->value);
}
}
- if (loaded_metadata)
- free_metadata(md);
-
if (date != NULL)
- return exif_string_to_time_t (date);
- else
- return (time_t) 0;
+ result = exif_string_to_time_t (date);
+
+ g_free (date);
+ return result;
}
@@ -282,13 +264,6 @@
}
-gboolean
-have_exif_time (const char *uri)
-{
- return get_metadata_time (NULL, uri, NULL) != (time_t)0;
-}
-
-
#define VALUE_LEN 1024
Modified: trunk/libgthumb/gth-exif-utils.h
==============================================================================
--- trunk/libgthumb/gth-exif-utils.h (original)
+++ trunk/libgthumb/gth-exif-utils.h Mon Jan 21 01:12:29 2008
@@ -81,7 +81,6 @@
const char *uri,
GList *md);
char * get_exif_aperture_value (const char *filename);
-gboolean have_exif_time (const char *filename);
const char *get_exif_entry_value (ExifEntry *entry);
void save_exif_data_to_uri (const char *filename,
ExifData *edata);
Modified: trunk/src/dlg-comment.c
==============================================================================
--- trunk/src/dlg-comment.c (original)
+++ trunk/src/dlg-comment.c Mon Jan 21 01:12:29 2008
@@ -138,6 +138,11 @@
{
int idx = gtk_option_menu_get_history (GTK_OPTION_MENU (data->date_optionmenu));
time_t t = (time_t)0;
+
+ FileData *file;
+
+ file = file_data_new (filename, NULL);
+ file_data_update_all (file, FALSE);
switch (idx) {
case NO_DATE:
@@ -149,16 +154,19 @@
t = time (NULL);
break;
case EXIF_DATE:
- t = get_metadata_time (NULL, filename, NULL);
+ file_data_insert_metadata (file);
+ t = file->exif_time;
break;
case LAST_MODIFIED_DATE:
- t = get_file_mtime (filename);
+ t = file->mtime;
break;
case IMAGE_CREATION_DATE:
- t = get_file_ctime (filename);
+ t = file->ctime;
break;
}
+ file_data_unref (file);
+
return t;
}
@@ -287,8 +295,13 @@
char *first_image = data->file_list->data;
int idx = gtk_option_menu_get_history (option_menu);
+ FileData *file;
+
gtk_widget_set_sensitive (data->date_dateedit, idx == FOLLOWING_DATE);
+ file = file_data_new (first_image, NULL);
+ file_data_update_all (file, FALSE);
+
switch (idx) {
case NO_DATE:
case FOLLOWING_DATE:
@@ -301,17 +314,20 @@
break;
case IMAGE_CREATION_DATE:
gnome_date_edit_set_time (GNOME_DATE_EDIT (data->date_dateedit),
- get_file_ctime (first_image));
+ file->ctime);
break;
case LAST_MODIFIED_DATE:
gnome_date_edit_set_time (GNOME_DATE_EDIT (data->date_dateedit),
- get_file_mtime (first_image));
+ file->mtime);
break;
case EXIF_DATE:
+ file_data_insert_metadata (file);
gnome_date_edit_set_time (GNOME_DATE_EDIT (data->date_dateedit),
- get_metadata_time (NULL, first_image, NULL));
+ file->exif_time);
break;
}
+
+ file_data_unref (file);
}
@@ -463,11 +479,17 @@
/* Does at least one image have exif data? */
data->have_exif_data = FALSE;
- for (scan = data->file_list; scan; scan = scan->next)
- if (have_exif_time (scan->data)) {
+ for (scan = data->file_list; scan; scan = scan->next) {
+ FileData *file;
+ file = file_data_new (scan->data, NULL);
+ file_data_update_all (file, FALSE);
+ file_data_insert_metadata (file);
+ if (file->exif_time) {
data->have_exif_data = TRUE;
break;
}
+ file_data_unref (file);
+ }
first_image = data->file_list->data;
data->original_cdata = cdata = comments_load_comment (first_image, TRUE);
Modified: trunk/src/dlg-photo-importer.c
==============================================================================
--- trunk/src/dlg-photo-importer.c (original)
+++ trunk/src/dlg-photo-importer.c Mon Jan 21 01:12:29 2008
@@ -1332,14 +1332,21 @@
if ( (subfolder_value == GTH_IMPORT_SUBFOLDER_GROUP_DAY) ||
(subfolder_value == GTH_IMPORT_SUBFOLDER_GROUP_MONTH) ||
(subfolder_value == GTH_IMPORT_SUBFOLDER_GROUP_CUSTOM)) {
- char *dest_folder;
-
+ char *dest_folder;
+ FileData *file;
+
/* Name a subfolder based on the exif date */
- exif_date = get_metadata_time (NULL, local_path, NULL);
+ file = file_data_new (local_path, NULL);
+ file_data_update_all (file, FALSE);
+ file_data_insert_metadata (file);
+ exif_date = file->exif_time;
/* Use the file mtime if no exif date if present */
if (exif_date == (time_t) 0)
- exif_date = get_file_mtime (local_path);
+ exif_date = file->mtime;
+
+ file_data_unref (file);
+
if (exif_date != (time_t) 0) {
struct tm *exif_tm = localtime(&exif_date);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]