[tracker/regions-of-interest] libtracker-extract: new function to generate sparql of the region struct



commit 49b710ee570defddc5a97a7148d4bf564df9fe2a
Author: Ivan Frade <ivan frade gmail com>
Date:   Mon Aug 1 17:14:39 2011 +0300

    libtracker-extract: new function to generate sparql of the region struct
    
    Input arguments "uri" and "where" are not needed, but I keep the there
    for consistency with the other sparql-generation function.

 src/libtracker-extract/tracker-xmp.c |   24 +++++++++++++++++++++---
 src/libtracker-extract/tracker-xmp.h |   24 +++++++++++++++---------
 2 files changed, 36 insertions(+), 12 deletions(-)
---
diff --git a/src/libtracker-extract/tracker-xmp.c b/src/libtracker-extract/tracker-xmp.c
index beddcc3..b3d0694 100644
--- a/src/libtracker-extract/tracker-xmp.c
+++ b/src/libtracker-extract/tracker-xmp.c
@@ -828,8 +828,6 @@ tracker_xmp_apply (TrackerSparqlBuilder *preupdate,
                    TrackerXmpData       *data)
 {
 	GPtrArray        *keywords;
-        GList            *iter;
-        TrackerXmpRegion *region;
 	guint i;
 
 	g_return_val_if_fail (TRACKER_SPARQL_IS_BUILDER (metadata), FALSE);
@@ -1127,6 +1125,27 @@ tracker_xmp_apply (TrackerSparqlBuilder *preupdate,
 	}
 
 
+        if (data->regions) {
+                tracker_xmp_apply_regions (preupdate, metadata, where, uri, data);
+        }
+
+	return TRUE;
+}
+
+void 
+tracker_xmp_apply_regions (TrackerSparqlBuilder *preupdate,
+                           TrackerSparqlBuilder *metadata,
+                           GString              *where,
+                           const gchar          *uri,
+                           TrackerXmpData       *data)
+{
+        GList            *iter;
+        TrackerXmpRegion *region;
+
+        if (!data->regions) {
+                return;
+        }
+        
         for (iter = data->regions; iter != NULL; iter = iter->next) {
                 gchar *reguuid;
                 reguuid = tracker_sparql_get_uuid_urn ();
@@ -1196,5 +1215,4 @@ tracker_xmp_apply (TrackerSparqlBuilder *preupdate,
                 g_free (reguuid);
         }
 
-	return TRUE;
 }
diff --git a/src/libtracker-extract/tracker-xmp.h b/src/libtracker-extract/tracker-xmp.h
index cbefc33..c557c36 100644
--- a/src/libtracker-extract/tracker-xmp.h
+++ b/src/libtracker-extract/tracker-xmp.h
@@ -105,15 +105,21 @@ typedef struct {
         gchar *link_uri;
 } TrackerXmpRegion;
 
-TrackerXmpData * tracker_xmp_new   (const gchar          *buffer,
-                                    gsize                 len,
-                                    const gchar          *uri);
-void             tracker_xmp_free  (TrackerXmpData       *data);
-gboolean         tracker_xmp_apply (TrackerSparqlBuilder *preupdate,
-                                    TrackerSparqlBuilder *metadata,
-                                    GString              *where,
-                                    const gchar          *uri,
-                                    TrackerXmpData       *data);
+TrackerXmpData *tracker_xmp_new           (const gchar          *buffer,
+                                           gsize                 len,
+                                           const gchar          *uri);
+void            tracker_xmp_free          (TrackerXmpData       *data);
+gboolean        tracker_xmp_apply         (TrackerSparqlBuilder *preupdate,
+                                           TrackerSparqlBuilder *metadata,
+                                           GString              *where,
+                                           const gchar          *uri,
+                                           TrackerXmpData       *data);
+void            tracker_xmp_apply_regions (TrackerSparqlBuilder *preupdate,
+                                           TrackerSparqlBuilder *metadata,
+                                           GString              *where,
+                                           const gchar          *uri,
+                                           TrackerXmpData       *data);
+
 
 #ifndef TRACKER_DISABLE_DEPRECATED
 



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