[PATCH 3/4] tracker: don't filter notified items



From: Lionel Landwerlin <lionel g landwerlin linux intel com>

We can't filter out directories and documents if they're part of the
requests.

Signed-off-by: Lionel Landwerlin <lionel g landwerlin linux intel com>
---
 src/media/tracker/grl-tracker-media-api.c   |    4 +-
 src/media/tracker/grl-tracker-media-notif.c |   90 ++++++++++++---------------
 src/media/tracker/grl-tracker-utils.c       |    2 +-
 3 files changed, 44 insertions(+), 52 deletions(-)

diff --git a/src/media/tracker/grl-tracker-media-api.c b/src/media/tracker/grl-tracker-media-api.c
index 755997c..16898d6 100644
--- a/src/media/tracker/grl-tracker-media-api.c
+++ b/src/media/tracker/grl-tracker-media-api.c
@@ -278,8 +278,8 @@ tracker_query_result_cb (GObject              *source_object,
                                           result,
                                           &tracker_error)) {
     if (tracker_error != NULL) {
-      GRL_ODEBUG ("\terror in parsing query id=%u : %s",
-                  operation->operation_id, tracker_error->message);
+      GRL_WARNING ("\terror in parsing query id=%u : %s",
+                   operation->operation_id, tracker_error->message);
 
       error = g_error_new (GRL_CORE_ERROR,
                            GRL_CORE_ERROR_BROWSE_FAILED,
diff --git a/src/media/tracker/grl-tracker-media-notif.c b/src/media/tracker/grl-tracker-media-notif.c
index 409d977..0999c8b 100644
--- a/src/media/tracker/grl-tracker-media-notif.c
+++ b/src/media/tracker/grl-tracker-media-notif.c
@@ -541,61 +541,53 @@ tracker_dbus_signal_cb (GDBusConnection *connection,
              (unsigned long) g_variant_iter_n_children (iter2),
 	     evt);
 
-  /* Avoid processing item from uninteresting classes */
-  if (g_str_has_suffix (class_name, RDF_TYPE_MUSIC) ||
-      g_str_has_suffix (class_name, RDF_TYPE_AUDIO) ||
-      g_str_has_suffix (class_name, RDF_TYPE_VIDEO) ||
-      g_str_has_suffix (class_name, RDF_TYPE_IMAGE)) {
-
-    /* Process deleted items */
-    while (g_variant_iter_loop (iter1, "(iiii)", &graph,
-                                &subject, &predicate, &object)) {
-      gpointer psubject = GSIZE_TO_POINTER (subject);
-      GrlTrackerMedia *source =
-        grl_tracker_media_cache_get_source (grl_tracker_item_cache, subject);
-
-      /* GRL_DEBUG ("\tdelete=> subject=%i", subject); */
-
-      if (source) {
-        g_hash_table_insert (evt->deleted_items, psubject,
-                             g_object_ref (source));
-      } else {
+  /* Process deleted items */
+  while (g_variant_iter_loop (iter1, "(iiii)", &graph,
+                              &subject, &predicate, &object)) {
+    gpointer psubject = GSIZE_TO_POINTER (subject);
+    GrlTrackerMedia *source =
+      grl_tracker_media_cache_get_source (grl_tracker_item_cache, subject);
+
+    /* GRL_DEBUG ("\tdelete=> subject=%i", subject); */
+
+    if (source) {
+      g_hash_table_insert (evt->deleted_items, psubject,
+                           g_object_ref (source));
+    } else {
         g_hash_table_insert (evt->orphan_items, psubject,
                              GSIZE_TO_POINTER (GRL_CONTENT_REMOVED));
-      }
     }
+  }
 
-    /* Process inserted items */
-    while (g_variant_iter_loop (iter2, "(iiii)", &graph,
-                                &subject, &predicate, &object)) {
-      gpointer psubject = GSIZE_TO_POINTER (subject);
-      GrlTrackerMedia *source =
-        grl_tracker_media_cache_get_source (grl_tracker_item_cache, subject);
-
-      /* GRL_DEBUG ("\tinsert=> subject=%i", subject); */
-
-      if (source) {
-        /* Removed & inserted items are probably just renamed items... */
-        if (g_hash_table_lookup (evt->deleted_items, psubject)) {
-          g_hash_table_remove (evt->deleted_items, psubject);
-          g_hash_table_insert (evt->updated_items, psubject,
-                               g_object_ref (source));
-        } else if (!g_hash_table_lookup (evt->updated_items, psubject)) {
-          g_hash_table_insert (evt->inserted_items, psubject,
-                               g_object_ref (source));
-        }
-      } else {
-        gpointer state;
+  while (g_variant_iter_loop (iter2, "(iiii)", &graph,
+                              &subject, &predicate, &object)) {
+    gpointer psubject = GSIZE_TO_POINTER (subject);
+    GrlTrackerMedia *source =
+      grl_tracker_media_cache_get_source (grl_tracker_item_cache, subject);
 
-        if (g_hash_table_lookup_extended (evt->orphan_items, psubject,
-                                          NULL, &state) &&
+    /* GRL_DEBUG ("\tinsert=> subject=%i", subject); */
+
+    if (source) {
+      /* Removed & inserted items are probably just renamed items... */
+      if (g_hash_table_lookup (evt->deleted_items, psubject)) {
+        g_hash_table_remove (evt->deleted_items, psubject);
+        g_hash_table_insert (evt->updated_items, psubject,
+                             g_object_ref (source));
+      } else if (!g_hash_table_lookup (evt->updated_items, psubject)) {
+        g_hash_table_insert (evt->inserted_items, psubject,
+                             g_object_ref (source));
+      }
+    } else {
+      gpointer state;
+
+      if (g_hash_table_lookup_extended (evt->orphan_items, psubject,
+                                        NULL, &state) &&
             (GPOINTER_TO_INT (state) == GRL_CONTENT_REMOVED)) {
-          g_hash_table_insert (evt->orphan_items, psubject,
-                               GSIZE_TO_POINTER (GRL_CONTENT_CHANGED));
-        } else {
-          g_hash_table_insert (evt->orphan_items, psubject,
-                               GSIZE_TO_POINTER (GRL_CONTENT_ADDED));
-        }
+        g_hash_table_insert (evt->orphan_items, psubject,
+                             GSIZE_TO_POINTER (GRL_CONTENT_CHANGED));
+      } else {
+        g_hash_table_insert (evt->orphan_items, psubject,
+                             GSIZE_TO_POINTER (GRL_CONTENT_ADDED));
       }
     }
   }
diff --git a/src/media/tracker/grl-tracker-utils.c b/src/media/tracker/grl-tracker-utils.c
index bc77ed1..ce0072d 100644
--- a/src/media/tracker/grl-tracker-utils.c
+++ b/src/media/tracker/grl-tracker-utils.c
@@ -234,7 +234,7 @@ grl_tracker_build_grilo_media (const gchar *rdf_type)
       media = grl_media_box_new ();
     } else if (g_str_has_suffix (rdf_single_type[i], RDF_TYPE_FOLDER)) {
       media = grl_media_box_new ();
-    } else if (g_str_has_suffix (rdf_single_type[i], RDF_TYPE_DOCUMENT)) {
+    } else {
       media = grl_media_new ();
     }
     i--;
-- 
1.7.4.1



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