[gthumb] [change_date tool] original datetime not saved correctly
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] [change_date tool] original datetime not saved correctly
- Date: Sun, 18 Jul 2010 19:06:17 +0000 (UTC)
commit 66bc3971668f06970594c55c777b5f628882c4e9
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sun Jul 18 20:59:42 2010 +0200
[change_date tool] original datetime not saved correctly
Always write the embedded metadata when the user wants to
change the datetime original field.
extensions/change_date/gth-change-date-task.c | 3 +-
.../comments/gth-metadata-provider-comment.c | 7 +-
extensions/edit_metadata/dlg-edit-metadata.c | 7 ++-
extensions/edit_metadata/gth-tag-task.c | 1 +
.../exiv2_tools/gth-metadata-provider-exiv2.c | 9 +-
extensions/importer/gth-import-task.c | 1 +
gthumb/gth-metadata-provider.c | 45 ++++++----
gthumb/gth-metadata-provider.h | 90 +++++++++++---------
8 files changed, 94 insertions(+), 69 deletions(-)
---
diff --git a/extensions/change_date/gth-change-date-task.c b/extensions/change_date/gth-change-date-task.c
index 5c792a8..518edf8 100644
--- a/extensions/change_date/gth-change-date-task.c
+++ b/extensions/change_date/gth-change-date-task.c
@@ -278,9 +278,10 @@ info_ready_cb (GList *files,
attributes = _g_string_array_join (attribute_v, ",");
_g_write_metadata_async (self->priv->file_list,
+ (self->priv->fields & GTH_CHANGE_EXIF_DATETIMEORIGINAL_TAG) ? GTH_METADATA_WRITE_FORCE_EMBEDDED : GTH_METADATA_WRITE_DEFAULT,
attributes,
gth_task_get_cancellable (GTH_TASK (self)),
- write_metadata_reasy_cb,
+ write_metadata_ready_cb,
self);
g_free (attributes);
diff --git a/extensions/comments/gth-metadata-provider-comment.c b/extensions/comments/gth-metadata-provider-comment.c
index a1109ea..62ff082 100644
--- a/extensions/comments/gth-metadata-provider-comment.c
+++ b/extensions/comments/gth-metadata-provider-comment.c
@@ -133,9 +133,10 @@ gth_metadata_provider_comment_read (GthMetadataProvider *self,
static void
-gth_metadata_provider_comment_write (GthMetadataProvider *self,
- GthFileData *file_data,
- const char *attributes)
+gth_metadata_provider_comment_write (GthMetadataProvider *self,
+ GthMetadataWriteFlags flags,
+ GthFileData *file_data,
+ const char *attributes)
{
GthComment *comment;
GthMetadata *metadata;
diff --git a/extensions/edit_metadata/dlg-edit-metadata.c b/extensions/edit_metadata/dlg-edit-metadata.c
index 5164f4e..f5655f5 100644
--- a/extensions/edit_metadata/dlg-edit-metadata.c
+++ b/extensions/edit_metadata/dlg-edit-metadata.c
@@ -90,7 +90,12 @@ edit_metadata_dialog__response_cb (GtkDialog *dialog,
}
gth_edit_metadata_dialog_update_info (GTH_EDIT_METADATA_DIALOG (data->dialog), data->file_list);
- _g_write_metadata_async (data->file_list, "*", NULL, write_metadata_ready_cb, data);
+ _g_write_metadata_async (data->file_list,
+ GTH_METADATA_WRITE_DEFAULT,
+ "*",
+ NULL,
+ write_metadata_ready_cb,
+ data);
}
diff --git a/extensions/edit_metadata/gth-tag-task.c b/extensions/edit_metadata/gth-tag-task.c
index d27035f..7b75fdc 100644
--- a/extensions/edit_metadata/gth-tag-task.c
+++ b/extensions/edit_metadata/gth-tag-task.c
@@ -113,6 +113,7 @@ info_ready_cb (GList *files,
gth_task_progress (GTH_TASK (self), _("Assigning tags to the selected files"), _("Writing files"), TRUE, 0.0);
_g_write_metadata_async (self->priv->file_data_list,
+ GTH_METADATA_WRITE_DEFAULT,
"general::tags",
gth_task_get_cancellable (GTH_TASK (self)),
write_metadata_ready_cb,
diff --git a/extensions/exiv2_tools/gth-metadata-provider-exiv2.c b/extensions/exiv2_tools/gth-metadata-provider-exiv2.c
index fe86fa7..fe0ac54 100644
--- a/extensions/exiv2_tools/gth-metadata-provider-exiv2.c
+++ b/extensions/exiv2_tools/gth-metadata-provider-exiv2.c
@@ -114,16 +114,17 @@ gth_metadata_provider_exiv2_read (GthMetadataProvider *self,
static void
-gth_metadata_provider_exiv2_write (GthMetadataProvider *self,
- GthFileData *file_data,
- const char *attributes)
+gth_metadata_provider_exiv2_write (GthMetadataProvider *self,
+ GthMetadataWriteFlags flags,
+ GthFileData *file_data,
+ const char *attributes)
{
void *buffer = NULL;
gsize size;
GError *error = NULL;
GObject *metadata;
- if (! eel_gconf_get_boolean (PREF_STORE_METADATA_IN_FILES, TRUE))
+ if (((flags & GTH_METADATA_WRITE_FORCE_EMBEDDED) != GTH_METADATA_WRITE_FORCE_EMBEDDED) && ! eel_gconf_get_boolean (PREF_STORE_METADATA_IN_FILES, TRUE))
return;
if (! exiv2_supports_writes (gth_file_data_get_mime_type (file_data)))
diff --git a/extensions/importer/gth-import-task.c b/extensions/importer/gth-import-task.c
index 5426ada..5775c92 100644
--- a/extensions/importer/gth-import-task.c
+++ b/extensions/importer/gth-import-task.c
@@ -205,6 +205,7 @@ transformation_ready_cb (GError *error,
g_file_info_set_attribute_object (self->priv->destination_file->info, "comment::categories", G_OBJECT (tag_list));
file_list = g_list_prepend (NULL, self->priv->destination_file);
_g_write_metadata_async (file_list,
+ GTH_METADATA_WRITE_DEFAULT,
"comment::categories",
gth_task_get_cancellable (GTH_TASK (self)),
write_metadata_ready_func,
diff --git a/gthumb/gth-metadata-provider.c b/gthumb/gth-metadata-provider.c
index e86e205..e8ebee4 100644
--- a/gthumb/gth-metadata-provider.c
+++ b/gthumb/gth-metadata-provider.c
@@ -56,14 +56,17 @@ gth_metadata_provider_real_read (GthMetadataProvider *self,
GthFileData *file_data,
const char *attributes)
{
+ /* void */
}
static void
-gth_metadata_provider_real_write (GthMetadataProvider *self,
- GthFileData *file_data,
- const char *attributes)
+gth_metadata_provider_real_write (GthMetadataProvider *self,
+ GthMetadataWriteFlags flags,
+ GthFileData *file_data,
+ const char *attributes)
{
+ /* void */
}
@@ -130,11 +133,12 @@ gth_metadata_provider_read (GthMetadataProvider *self,
void
-gth_metadata_provider_write (GthMetadataProvider *self,
- GthFileData *file_data,
- const char *attributes)
+gth_metadata_provider_write (GthMetadataProvider *self,
+ GthMetadataWriteFlags flags,
+ GthFileData *file_data,
+ const char *attributes)
{
- GTH_METADATA_PROVIDER_GET_CLASS (self)->write (self, file_data, attributes);
+ GTH_METADATA_PROVIDER_GET_CLASS (self)->write (self, flags, file_data, attributes);
}
@@ -300,12 +304,13 @@ _g_query_metadata_async (GList *files, /* GthFileData * list *
typedef struct {
- GList *files;
- char *attributes;
- char **attributes_v;
- GMutex *mutex;
- gboolean thread_done;
- GError *error;
+ GList *files;
+ GthMetadataWriteFlags flags;
+ char *attributes;
+ char **attributes_v;
+ GMutex *mutex;
+ gboolean thread_done;
+ GError *error;
} WriteMetadataThreadData;
@@ -366,7 +371,7 @@ write_metadata_thread (gpointer data)
GthMetadataProvider *metadata_provider = scan_providers->data;
if (gth_metadata_provider_can_write (metadata_provider, gth_file_data_get_mime_type (file_data), wmtd->attributes_v))
- gth_metadata_provider_write (metadata_provider, file_data, wmtd->attributes);
+ gth_metadata_provider_write (metadata_provider, wmtd->flags, file_data, wmtd->attributes);
}
}
@@ -404,17 +409,19 @@ check_write_metadata_thread (gpointer data)
void
-_g_write_metadata_async (GList *files, /* GthFileData * list */
- const char *attributes,
- GCancellable *cancellable,
- ReadyFunc ready_func,
- gpointer user_data)
+_g_write_metadata_async (GList *files, /* GthFileData * list */
+ GthMetadataWriteFlags flags,
+ const char *attributes,
+ GCancellable *cancellable,
+ ReadyFunc ready_func,
+ gpointer user_data)
{
WriteMetadataData *wmd;
WriteMetadataThreadData *wmtd;
wmtd = g_new0 (WriteMetadataThreadData, 1);
wmtd->files = _g_object_list_ref (files);
+ wmtd->flags = flags;
wmtd->attributes = g_strdup (attributes);
wmtd->attributes_v = gth_main_get_metadata_attributes (attributes);
wmtd->mutex = g_mutex_new ();
diff --git a/gthumb/gth-metadata-provider.h b/gthumb/gth-metadata-provider.h
index 9183b03..c77fdb9 100644
--- a/gthumb/gth-metadata-provider.h
+++ b/gthumb/gth-metadata-provider.h
@@ -30,6 +30,11 @@
G_BEGIN_DECLS
+typedef enum {
+ GTH_METADATA_WRITE_DEFAULT = 0,
+ GTH_METADATA_WRITE_FORCE_EMBEDDED = (1 << 0)
+} GthMetadataWriteFlags;
+
#define GTH_TYPE_METADATA_PROVIDER (gth_metadata_provider_get_type ())
#define GTH_METADATA_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTH_TYPE_METADATA_PROVIDER, GthMetadataProvider))
#define GTH_METADATA_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTH_TYPE_METADATA_PROVIDER, GthMetadataProviderClass))
@@ -46,50 +51,53 @@ struct _GthMetadataProvider {
struct _GthMetadataProviderClass {
GObjectClass parent_class;
- gboolean (*can_read) (GthMetadataProvider *self,
- const char *mime_type,
- char **attribute_v);
- gboolean (*can_write) (GthMetadataProvider *self,
- const char *mime_type,
- char **attribute_v);
- void (*read) (GthMetadataProvider *self,
- GthFileData *file_data,
- const char *attributes);
- void (*write) (GthMetadataProvider *self,
- GthFileData *file_data,
- const char *attributes);
+ gboolean (*can_read) (GthMetadataProvider *self,
+ const char *mime_type,
+ char **attribute_v);
+ gboolean (*can_write) (GthMetadataProvider *self,
+ const char *mime_type,
+ char **attribute_v);
+ void (*read) (GthMetadataProvider *self,
+ GthFileData *file_data,
+ const char *attributes);
+ void (*write) (GthMetadataProvider *self,
+ GthMetadataWriteFlags flags,
+ GthFileData *file_data,
+ const char *attributes);
};
GType gth_metadata_provider_get_type (void);
-gboolean gth_metadata_provider_can_read (GthMetadataProvider *self,
- const char *mime_type,
- char **attribute_v);
-gboolean gth_metadata_provider_can_write (GthMetadataProvider *self,
- const char *mime_type,
- char **attribute_v);
-void gth_metadata_provider_read (GthMetadataProvider *self,
- GthFileData *file_data,
- const char *attributes);
-void gth_metadata_provider_write (GthMetadataProvider *self,
- GthFileData *file_data,
- const char *attributes);
-void _g_query_metadata_async (GList *files, /* GthFileData * list */
- const char *attributes,
- GCancellable *cancellable,
- InfoReadyCallback ready_func,
- gpointer user_data);
-void _g_write_metadata_async (GList *files, /* GthFileData * list */
- const char *attributes,
- GCancellable *cancellable,
- ReadyFunc ready_func,
- gpointer user_data);
-void _g_query_all_metadata_async (GList *files, /* GFile * list */
- gboolean recursive,
- gboolean follow_links,
- const char *attributes,
- GCancellable *cancellable,
- InfoReadyCallback ready_func,
- gpointer user_data);
+gboolean gth_metadata_provider_can_read (GthMetadataProvider *self,
+ const char *mime_type,
+ char **attribute_v);
+gboolean gth_metadata_provider_can_write (GthMetadataProvider *self,
+ const char *mime_type,
+ char **attribute_v);
+void gth_metadata_provider_read (GthMetadataProvider *self,
+ GthFileData *file_data,
+ const char *attributes);
+void gth_metadata_provider_write (GthMetadataProvider *self,
+ GthMetadataWriteFlags flags,
+ GthFileData *file_data,
+ const char *attributes);
+void _g_query_metadata_async (GList *files, /* GthFileData * list */
+ const char *attributes,
+ GCancellable *cancellable,
+ InfoReadyCallback ready_func,
+ gpointer user_data);
+void _g_write_metadata_async (GList *files, /* GthFileData * list */
+ GthMetadataWriteFlags flags,
+ const char *attributes,
+ GCancellable *cancellable,
+ ReadyFunc ready_func,
+ gpointer user_data);
+void _g_query_all_metadata_async (GList *files, /* GFile * list */
+ gboolean recursive,
+ gboolean follow_links,
+ const char *attributes,
+ GCancellable *cancellable,
+ InfoReadyCallback ready_func,
+ gpointer user_data);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]