[gthumb/ext] [photo importer] add tags to the imported images
- From: Paolo Bacchilega <paobac src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gthumb/ext] [photo importer] add tags to the imported images
- Date: Wed, 19 Aug 2009 17:50:09 +0000 (UTC)
commit ae7c38ae612cc59a5e3ad2665595cc0e5df87c11
Author: Paolo Bacchilega <paobac src gnome org>
Date: Wed Aug 19 19:42:05 2009 +0200
[photo importer] add tags to the imported images
extensions/exiv2/exiv2.extension.in.in | 2 +-
extensions/exiv2/gth-metadata-provider-exiv2.c | 1 +
extensions/photo_importer/gth-import-task.c | 37 ++++++++++++++++++++---
gthumb/gth-string-list.c | 19 ++++++++++++
gthumb/gth-string-list.h | 11 ++++---
5 files changed, 59 insertions(+), 11 deletions(-)
---
diff --git a/extensions/exiv2/exiv2.extension.in.in b/extensions/exiv2/exiv2.extension.in.in
index 596a656..f24eab5 100644
--- a/extensions/exiv2/exiv2.extension.in.in
+++ b/extensions/exiv2/exiv2.extension.in.in
@@ -6,6 +6,6 @@ Copyright=Copyright © 2009 The Free Software Foundation, Inc.
Version=1.0
[Loader]
-After=image_rotation
Type=module
File=%LIBRARY%
+After=image_rotation
diff --git a/extensions/exiv2/gth-metadata-provider-exiv2.c b/extensions/exiv2/gth-metadata-provider-exiv2.c
index f0b946d..77e9105 100644
--- a/extensions/exiv2/gth-metadata-provider-exiv2.c
+++ b/extensions/exiv2/gth-metadata-provider-exiv2.c
@@ -82,6 +82,7 @@ gth_metadata_provider_exiv2_write (GthMetadataProvider *self,
GthFileData *file_data,
const char *attributes)
{
+ /* FIXME */
}
diff --git a/extensions/photo_importer/gth-import-task.c b/extensions/photo_importer/gth-import-task.c
index 70af240..a80f291 100644
--- a/extensions/photo_importer/gth-import-task.c
+++ b/extensions/photo_importer/gth-import-task.c
@@ -24,6 +24,7 @@
#include <extensions/image_rotation/rotation-utils.h>
#include "gth-import-task.h"
+
struct _GthImportTaskPrivate {
GthBrowser *browser;
GList *files;
@@ -77,16 +78,42 @@ import_next_file (GthImportTask *self)
static void
+write_metadata_ready_func (GError *error,
+ gpointer user_data)
+{
+ GthImportTask *self = user_data;
+
+ if (error != NULL)
+ g_clear_error (&error);
+
+ import_next_file (self);
+}
+
+
+static void
transformation_ready_cb (GError *error,
gpointer user_data)
{
GthImportTask *self = user_data;
+ GthStringList *tag_list;
+ GList *file_list;
- /*
- * FIXME: add tags
- */
+ if (self->priv->tags[0] == NULL) {
+ import_next_file (self);
+ return;
+ }
- import_next_file (self);
+ tag_list = gth_string_list_new_from_strv (self->priv->tags);
+ 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,
+ "comment::categories",
+ self->priv->cancellable,
+ write_metadata_ready_func,
+ self);
+
+ g_list_free (file_list);
+ g_object_unref (tag_list);
}
@@ -130,7 +157,7 @@ copy_ready_cb (GError *error,
}
if (! appling_tranformation)
- import_next_file (self);
+ transformation_ready_cb (NULL, self);
}
diff --git a/gthumb/gth-string-list.c b/gthumb/gth-string-list.c
index 7e4172e..50766a3 100644
--- a/gthumb/gth-string-list.c
+++ b/gthumb/gth-string-list.c
@@ -94,6 +94,25 @@ gth_string_list_new (GList *list)
GthStringList *
+gth_string_list_new_from_strv (char **strv)
+{
+ GthStringList *string_list;
+ int i;
+
+ string_list = g_object_new (GTH_TYPE_STRING_LIST, NULL);
+ if (strv != NULL) {
+ for (i = 0; strv[i] != NULL; i++)
+ string_list->priv->list = g_list_prepend (string_list->priv->list, g_strdup (strv[i]));
+ string_list->priv->list = g_list_reverse (string_list->priv->list);
+ }
+ else
+ string_list->priv->list = NULL;
+
+ return string_list;
+}
+
+
+GthStringList *
gth_string_list_new_from_ptr_array (GPtrArray *array)
{
GthStringList *string_list;
diff --git a/gthumb/gth-string-list.h b/gthumb/gth-string-list.h
index 4bd9fa5..c49da1f 100644
--- a/gthumb/gth-string-list.h
+++ b/gthumb/gth-string-list.h
@@ -49,11 +49,12 @@ struct _GthStringListClass {
};
GType gth_string_list_get_type (void);
-GthStringList * gth_string_list_new (GList *list);
-GthStringList * gth_string_list_new_from_ptr_array (GPtrArray *array);
-GList * gth_string_list_get_list (GthStringList *list);
-char * gth_string_list_join (GthStringList *list,
- const char *separator);
+GthStringList * gth_string_list_new (GList *list);
+GthStringList * gth_string_list_new_from_strv (char **strv);
+GthStringList * gth_string_list_new_from_ptr_array (GPtrArray *array);
+GList * gth_string_list_get_list (GthStringList *list);
+char * gth_string_list_join (GthStringList *list,
+ const char *separator);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]