[tracker] tracker-extract: Insert nfo:orientation as a resource



commit 7ef71db27bfd410ac514d1fa5ffe9253d13fe36b
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Jan 2 19:51:05 2017 +0100

    tracker-extract: Insert nfo:orientation as a resource
    
    This is not an string, but a builtin class, so it must be dealt
    with as a resource.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=776723

 src/libtracker-extract/tracker-xmp.c       |    6 +++++-
 src/tracker-extract/tracker-extract-gif.c  |    6 +++++-
 src/tracker-extract/tracker-extract-jpeg.c |    6 +++++-
 src/tracker-extract/tracker-extract-pdf.c  |    6 +++++-
 src/tracker-extract/tracker-extract-png.c  |    6 +++++-
 src/tracker-extract/tracker-extract-tiff.c |    6 +++++-
 6 files changed, 30 insertions(+), 6 deletions(-)
---
diff --git a/src/libtracker-extract/tracker-xmp.c b/src/libtracker-extract/tracker-xmp.c
index ee0fb7d..911f3d7 100644
--- a/src/libtracker-extract/tracker-xmp.c
+++ b/src/libtracker-extract/tracker-xmp.c
@@ -977,7 +977,11 @@ tracker_xmp_apply_to_resource (TrackerResource *resource,
        }
 
        if (data->orientation) {
-               tracker_resource_set_string (resource, "nfo:orientation", data->orientation);
+               TrackerResource *orientation;
+
+               orientation = tracker_resource_new (data->orientation);
+               tracker_resource_set_relation (resource, "nfo:orientation", orientation);
+               g_object_unref (orientation);
        }
 
        if (data->rights || data->copyright) {
diff --git a/src/tracker-extract/tracker-extract-gif.c b/src/tracker-extract/tracker-extract-gif.c
index f79efa5..f260bd5 100644
--- a/src/tracker-extract/tracker-extract-gif.c
+++ b/src/tracker-extract/tracker-extract-gif.c
@@ -299,7 +299,11 @@ read_metadata (GifFileType          *gifFile,
        }
 
        if (xd->orientation) {
-               tracker_resource_set_string (metadata, "nfo:orientation", xd->orientation);
+               TrackerResource *orientation;
+
+               orientation = tracker_resource_new (xd->orientation);
+               tracker_resource_set_relation (metadata, "nfo:orientation", orientation);
+               g_object_unref (orientation);
        }
 
        if (xd->exposure_time) {
diff --git a/src/tracker-extract/tracker-extract-jpeg.c b/src/tracker-extract/tracker-extract-jpeg.c
index 65e8766..c6b07bf 100644
--- a/src/tracker-extract/tracker-extract-jpeg.c
+++ b/src/tracker-extract/tracker-extract-jpeg.c
@@ -402,7 +402,11 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
                                                    NULL);
 
        if (md.orientation) {
-               tracker_resource_set_string (metadata, "nfo:orientation", md.orientation);
+               TrackerResource *orientation;
+
+               orientation = tracker_resource_new (md.orientation);
+               tracker_resource_set_relation (metadata, "nfo:orientation", orientation);
+               g_object_unref (orientation);
        }
 
        if (md.copyright) {
diff --git a/src/tracker-extract/tracker-extract-pdf.c b/src/tracker-extract/tracker-extract-pdf.c
index 13dee8a..acce7c8 100644
--- a/src/tracker-extract/tracker-extract-pdf.c
+++ b/src/tracker-extract/tracker-extract-pdf.c
@@ -466,7 +466,11 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
                }
 
                if (xd->orientation) {
-                       tracker_resource_set_string (metadata, "nfo:orientation", xd->orientation);
+                       TrackerResource *orientation;
+
+                       orientation = tracker_resource_new (xd->orientation);
+                       tracker_resource_set_relation (metadata, "nfo:orientation", orientation);
+                       g_object_unref (orientation);
                }
 
                if (xd->rights) {
diff --git a/src/tracker-extract/tracker-extract-png.c b/src/tracker-extract/tracker-extract-png.c
index a1850d3..d392365 100644
--- a/src/tracker-extract/tracker-extract-png.c
+++ b/src/tracker-extract/tracker-extract-png.c
@@ -414,7 +414,11 @@ read_metadata (TrackerResource      *metadata,
        }
 
        if (md.orientation) {
-               tracker_resource_set_string (metadata, "nfo:orientation", md.orientation);
+               TrackerResource *orientation;
+
+               orientation = tracker_resource_new (md.orientation);
+               tracker_resource_set_relation (metadata, "nfo:orientation", orientation);
+               g_object_unref (orientation);
        }
 
        if (md.exposure_time) {
diff --git a/src/tracker-extract/tracker-extract-tiff.c b/src/tracker-extract/tracker-extract-tiff.c
index 0cb5a82..64ff894 100644
--- a/src/tracker-extract/tracker-extract-tiff.c
+++ b/src/tracker-extract/tracker-extract-tiff.c
@@ -530,7 +530,11 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
                                                    NULL);
 
        if (md.orientation) {
-               tracker_resource_set_string (metadata, "nfo:orientation", md.orientation);
+               TrackerResource *orientation;
+
+               orientation = tracker_resource_new (md.orientation);
+               tracker_resource_set_relation (metadata, "nfo:orientation", orientation);
+               g_object_unref (orientation);
        }
 
        if (md.copyright) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]