[gnome-photos] item-manager: Split out some code into a separate function



commit 0be4999f6df55734f22c38c8b5910aca1014e4e6
Author: Debarshi Ray <debarshir gnome org>
Date:   Fri Aug 19 18:52:50 2016 +0200

    item-manager: Split out some code into a separate function
    
    This will be useful when we split PhotosItemManager to have a separate
    child manager for each mode.

 src/photos-item-manager.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/src/photos-item-manager.c b/src/photos-item-manager.c
index 26b8395..c08a5f4 100644
--- a/src/photos-item-manager.c
+++ b/src/photos-item-manager.c
@@ -237,6 +237,18 @@ photos_item_manager_collection_path_free (PhotosItemManager *self)
 }
 
 
+static gboolean
+photos_item_manager_cursor_is_collection (TrackerSparqlCursor *cursor)
+{
+  gboolean ret_val;
+  const gchar *identifier;
+
+  identifier = tracker_sparql_cursor_get_string (cursor, PHOTOS_QUERY_COLUMNS_IDENTIFIER, NULL);
+  ret_val = g_str_has_prefix (identifier, "photos:collection:");
+  return ret_val;
+}
+
+
 static gchar *
 photos_item_manager_get_where (PhotosBaseManager *mngr, gint flags)
 {
@@ -620,7 +632,7 @@ photos_item_manager_create_item (PhotosItemManager *self, TrackerSparqlCursor *c
 
   split_identifier = g_strsplit (identifier, ":", 4);
 
-  if (g_str_has_prefix (identifier, "photos:collection:"))
+  if (photos_item_manager_cursor_is_collection (cursor))
     {
       /* Its a collection. */
       extension_name = split_identifier[2];


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