[gnome-photos] item-manager: Don't look for collections in wait_for_changes_table
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] item-manager: Don't look for collections in wait_for_changes_table
- Date: Wed, 11 Jan 2017 13:20:02 +0000 (UTC)
commit 8c3555d964531f3aa78f03b2fde3e8d630821d81
Author: Kartikeya Sharma <09kartikeya gmail com>
Date: Thu Dec 29 15:40:17 2016 +0530
item-manager: Don't look for collections in wait_for_changes_table
Collections are stored in tracker's database. Unlike local BaseItems,
they are not going to undergo atomic file updates that can possibly
change their URN. Therefore we don't need to track them in the
wait_for_changes_table GHashTable.
Moreoever, local collections don't have a URI. So we don't have a key
to look for them in the GHashTable.
https://bugzilla.gnome.org/show_bug.cgi?id=776565
src/photos-item-manager.c | 49 +++++++++++++++++++++++++-------------------
1 files changed, 28 insertions(+), 21 deletions(-)
---
diff --git a/src/photos-item-manager.c b/src/photos-item-manager.c
index 0d0796e..cb653cb 100644
--- a/src/photos-item-manager.c
+++ b/src/photos-item-manager.c
@@ -162,6 +162,18 @@ photos_item_manager_check_wait_for_changes (PhotosItemManager *self, const gchar
}
+static gboolean
+photos_item_manager_cursor_is_collection (TrackerSparqlCursor *cursor)
+{
+ gboolean ret_val;
+ const gchar *rdf_type;
+
+ rdf_type = tracker_sparql_cursor_get_string (cursor, PHOTOS_QUERY_COLUMNS_RDF_TYPE, NULL);
+ ret_val = strstr (rdf_type, "nfo#DataContainer") != NULL;
+ return ret_val;
+}
+
+
static void
photos_item_manager_item_created_executed (GObject *source_object, GAsyncResult *res, gpointer user_data)
{
@@ -169,8 +181,6 @@ photos_item_manager_item_created_executed (GObject *source_object, GAsyncResult
GError *error = NULL;
PhotosSingleItemJob *job = PHOTOS_SINGLE_ITEM_JOB (source_object);
TrackerSparqlCursor *cursor = NULL;
- const gchar *id;
- const gchar *uri;
cursor = photos_single_item_job_finish (job, res, &error);
if (error != NULL)
@@ -185,9 +195,15 @@ photos_item_manager_item_created_executed (GObject *source_object, GAsyncResult
photos_item_manager_add_item (self, cursor, FALSE);
- id = tracker_sparql_cursor_get_string (cursor, PHOTOS_QUERY_COLUMNS_URN, NULL);
- uri = tracker_sparql_cursor_get_string (cursor, PHOTOS_QUERY_COLUMNS_URI, NULL);
- photos_item_manager_check_wait_for_changes (self, id, uri);
+ if (!photos_item_manager_cursor_is_collection (cursor))
+ {
+ const gchar *id;
+ const gchar *uri;
+
+ id = tracker_sparql_cursor_get_string (cursor, PHOTOS_QUERY_COLUMNS_URN, NULL);
+ uri = tracker_sparql_cursor_get_string (cursor, PHOTOS_QUERY_COLUMNS_URI, NULL);
+ photos_item_manager_check_wait_for_changes (self, id, uri);
+ }
out:
g_clear_object (&cursor);
@@ -238,12 +254,15 @@ photos_item_manager_changes_pending_foreach (gpointer key, gpointer value, gpoin
object = photos_base_manager_get_object_by_id (PHOTOS_BASE_MANAGER (self), change_urn);
if (object != NULL)
{
- const gchar *uri;
-
photos_base_item_refresh (PHOTOS_BASE_ITEM (object));
- uri = photos_base_item_get_uri (PHOTOS_BASE_ITEM (object));
- photos_item_manager_check_wait_for_changes (self, change_urn, uri);
+ if (!photos_base_item_is_collection (PHOTOS_BASE_ITEM (object)))
+ {
+ const gchar *uri;
+
+ uri = photos_base_item_get_uri (PHOTOS_BASE_ITEM (object));
+ photos_item_manager_check_wait_for_changes (self, change_urn, uri);
+ }
}
}
else if (change_type == PHOTOS_TRACKER_CHANGE_EVENT_CREATED)
@@ -299,18 +318,6 @@ photos_item_manager_collection_path_free (PhotosItemManager *self)
static gboolean
-photos_item_manager_cursor_is_collection (TrackerSparqlCursor *cursor)
-{
- gboolean ret_val;
- const gchar *rdf_type;
-
- rdf_type = tracker_sparql_cursor_get_string (cursor, PHOTOS_QUERY_COLUMNS_RDF_TYPE, NULL);
- ret_val = strstr (rdf_type, "nfo#DataContainer") != NULL;
- return ret_val;
-}
-
-
-static gboolean
photos_item_manager_cursor_is_favorite (TrackerSparqlCursor *cursor)
{
gboolean favorite;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]