[PATCH 13/15] tracker: updated for the new caps and options APIs



From: Guillaume Emont <guijemont igalia com>

---
 src/media/tracker/grl-tracker-media-api.c |   38 +++++++++++++++++-----------
 src/media/tracker/grl-tracker-metadata.c  |    1 +
 src/media/tracker/grl-tracker-utils.c     |   13 ++++++++++
 src/media/tracker/grl-tracker-utils.h     |    3 ++
 4 files changed, 40 insertions(+), 15 deletions(-)

diff --git a/src/media/tracker/grl-tracker-media-api.c b/src/media/tracker/grl-tracker-media-api.c
index 267c1fd..8bcef58 100644
--- a/src/media/tracker/grl-tracker-media-api.c
+++ b/src/media/tracker/grl-tracker-media-api.c
@@ -549,6 +549,8 @@ grl_tracker_media_query (GrlMediaSource *source,
   gchar                *sparql_final;
   gchar                *sparql_select;
   GrlTrackerOp         *os;
+  gint count = grl_operation_options_get_count (qs->options);
+  guint skip = grl_operation_options_get_skip (qs->options);
 
   GRL_IDEBUG ("%s: id=%u", __FUNCTION__, qs->query_id);
 
@@ -567,8 +569,8 @@ grl_tracker_media_query (GrlMediaSource *source,
                                     sparql_select,
                                     qs->query,
                                     constraint,
-                                    qs->skip,
-                                    qs->count);
+                                    skip,
+                                    count);
     g_free (constraint);
     g_free (qs->query);
     g_free (sparql_select);
@@ -585,8 +587,8 @@ grl_tracker_media_query (GrlMediaSource *source,
                                       qs);
 
   os->keys  = qs->keys;
-  os->skip  = qs->skip;
-  os->count = qs->count;
+  os->skip  = skip;
+  os->count = count;
   os->data  = qs;
   /* os->cb.sr     = qs->callback; */
   /* os->user_data = qs->user_data; */
@@ -683,6 +685,8 @@ grl_tracker_media_search (GrlMediaSource *source, GrlMediaSourceSearchSpec *ss)
   gchar                *sparql_select;
   gchar                *sparql_final;
   GrlTrackerOp         *os;
+  gint count = grl_operation_options_get_count (ss->options);
+  guint skip = grl_operation_options_get_skip (ss->options);
 
   GRL_IDEBUG ("%s: id=%u", __FUNCTION__, ss->search_id);
 
@@ -691,10 +695,10 @@ grl_tracker_media_search (GrlMediaSource *source, GrlMediaSourceSearchSpec *ss)
   if (!ss->text || ss->text[0] == '\0') {
     /* Search all */
     sparql_final = g_strdup_printf (TRACKER_SEARCH_ALL_REQUEST, sparql_select,
-                                    constraint, ss->skip, ss->count);
+                                    constraint, skip, count);
   } else {
     sparql_final = g_strdup_printf (TRACKER_SEARCH_REQUEST, sparql_select,
-                                    ss->text, constraint, ss->skip, ss->count);
+                                    ss->text, constraint, skip, count);
   }
 
   GRL_IDEBUG ("\tselect: '%s'", sparql_final);
@@ -704,8 +708,8 @@ grl_tracker_media_search (GrlMediaSource *source, GrlMediaSourceSearchSpec *ss)
                                       (GAsyncReadyCallback) tracker_search_cb,
                                       ss);
   os->keys  = ss->keys;
-  os->skip  = ss->skip;
-  os->count = ss->count;
+  os->skip  = skip;
+  os->count = count;
 
   grl_tracker_queue_push (grl_tracker_queue, os);
 
@@ -724,6 +728,8 @@ grl_tracker_media_browse_category (GrlMediaSource *source,
   GrlTrackerOp         *os;
   GrlMedia             *media;
   const gchar          *category;
+  gint count = grl_operation_options_get_count (bs->options);
+  guint skip = grl_operation_options_get_skip (bs->options);
 
   GRL_IDEBUG ("%s: id=%u", __FUNCTION__, bs->browse_id);
 
@@ -770,7 +776,7 @@ grl_tracker_media_browse_category (GrlMediaSource *source,
                                   sparql_select,
                                   category,
                                   constraint,
-                                  bs->skip, bs->count);
+                                  skip, count);
 
   GRL_IDEBUG ("\tselect: '%s'", sparql_final);
 
@@ -779,8 +785,8 @@ grl_tracker_media_browse_category (GrlMediaSource *source,
                                       (GAsyncReadyCallback) tracker_browse_cb,
                                       bs);
   os->keys  = bs->keys;
-  os->skip  = bs->skip;
-  os->count = bs->count;
+  os->skip  = skip;
+  os->count = count;
 
   grl_tracker_queue_push (grl_tracker_queue, os);
 
@@ -797,6 +803,8 @@ grl_tracker_media_browse_filesystem (GrlMediaSource *source,
   gchar                *sparql_select;
   gchar                *sparql_final;
   GrlTrackerOp         *os;
+  gint count = grl_operation_options_get_count (bs->options);
+  guint skip = grl_operation_options_get_skip (bs->options);
 
   GRL_IDEBUG ("%s: id=%u", __FUNCTION__, bs->browse_id);
 
@@ -808,14 +816,14 @@ grl_tracker_media_browse_filesystem (GrlMediaSource *source,
     sparql_final = g_strdup_printf (TRACKER_BROWSE_FILESYSTEM_ROOT_REQUEST,
                                     sparql_select,
                                     constraint,
-                                    bs->skip, bs->count);
+                                    skip, count);
 
   } else {
     sparql_final = g_strdup_printf (TRACKER_BROWSE_FILESYSTEM_REQUEST,
                                     sparql_select,
                                     constraint,
                                     grl_media_get_id (bs->container),
-                                    bs->skip, bs->count);
+                                    skip, count);
   }
 
   GRL_IDEBUG ("\tselect: '%s'", sparql_final);
@@ -825,8 +833,8 @@ grl_tracker_media_browse_filesystem (GrlMediaSource *source,
                                       (GAsyncReadyCallback) tracker_browse_cb,
                                       bs);
   os->keys  = bs->keys;
-  os->skip  = bs->skip;
-  os->count = bs->count;
+  os->skip  = skip;
+  os->count = count;
 
   grl_tracker_queue_push (grl_tracker_queue, os);
 
diff --git a/src/media/tracker/grl-tracker-metadata.c b/src/media/tracker/grl-tracker-metadata.c
index 549d3af..ac1780f 100644
--- a/src/media/tracker/grl-tracker-metadata.c
+++ b/src/media/tracker/grl-tracker-metadata.c
@@ -121,6 +121,7 @@ grl_tracker_metadata_class_init (GrlTrackerMetadataClass * klass)
   metadata_class->supported_keys = grl_tracker_supported_keys;
   metadata_class->may_resolve    = grl_tracker_metadata_may_resolve;
   metadata_class->resolve        = grl_tracker_metadata_resolve;
+  metadata_class->get_caps       = grl_tracker_get_caps;
 
   g_class->finalize     = grl_tracker_metadata_finalize;
   g_class->set_property = grl_tracker_metadata_set_property;
diff --git a/src/media/tracker/grl-tracker-utils.c b/src/media/tracker/grl-tracker-utils.c
index 2973242..a3bf03b 100644
--- a/src/media/tracker/grl-tracker-utils.c
+++ b/src/media/tracker/grl-tracker-utils.c
@@ -662,3 +662,16 @@ grl_tracker_supported_keys (GrlMetadataSource *source)
 
   return supported_keys;
 }
+
+GrlCaps *
+grl_tracker_get_caps (GrlMetadataSource *source,
+                      GrlSupportedOps operation)
+{
+  static GrlCaps *caps = NULL;
+
+  if (caps == NULL) {
+    caps = grl_caps_new ();
+  }
+
+  return caps;
+}
diff --git a/src/media/tracker/grl-tracker-utils.h b/src/media/tracker/grl-tracker-utils.h
index b55ff8c..e9eb663 100644
--- a/src/media/tracker/grl-tracker-utils.h
+++ b/src/media/tracker/grl-tracker-utils.h
@@ -63,6 +63,9 @@ extern GrlKeyID grl_metadata_key_tracker_urn;
 
 const GList *grl_tracker_supported_keys (GrlMetadataSource *source);
 
+GrlCaps * grl_tracker_get_caps (GrlMetadataSource *source,
+                                GrlSupportedOps operation);
+
 gboolean grl_tracker_key_is_supported (const GrlKeyID key);
 
 void grl_tracker_setup_key_mappings (void);
-- 
1.7.5.4



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