[gnome-photos/wip/rishi/collection: 35/40] Support creating BaseItems with thumbnailing turned off



commit 619f0491f7407032688ac1357e2064d557b8fa65
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed Jan 24 20:04:41 2018 +0100

    Support creating BaseItems with thumbnailing turned off
    
    A subsequent patch will directly use the BaseItem to query the
    GFileInfo, instead of creating a GFile out of the URI. This is
    required to transparently query the state of the thumbnail across
    different BaseItem sub-classes that might have different thumbnail
    caches.
    
    To do so, various bits of the search provider need to use the BaseItem
    API instead of directly parsing the TrackerSparqlCursor and creating a
    GFile out of the URI. Since the search provider shouldn't initiate
    thumbnailing, it's necessary to be able to create BaseItems with
    thumbnailing turned off.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=751212

 src/photos-collection-icon-watcher.c | 2 +-
 src/photos-item-manager.c            | 9 ++++++---
 src/photos-item-manager.h            | 3 ++-
 3 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/src/photos-collection-icon-watcher.c b/src/photos-collection-icon-watcher.c
index 9cbb548a..5c8dcefd 100644
--- a/src/photos-collection-icon-watcher.c
+++ b/src/photos-collection-icon-watcher.c
@@ -177,7 +177,7 @@ photos_collection_icon_watcher_to_query_executed (GObject *source_object, GAsync
     {
       PhotosBaseItem *item;
 
-      item = photos_item_manager_create_item (PHOTOS_ITEM_MANAGER (self->item_mngr), G_TYPE_NONE, cursor);
+      item = photos_item_manager_create_item (PHOTOS_ITEM_MANAGER (self->item_mngr), G_TYPE_NONE, cursor, 
TRUE);
       self->items = g_list_prepend (self->items, item);
     }
 
diff --git a/src/photos-item-manager.c b/src/photos-item-manager.c
index 4f88cc02..69dfc469 100644
--- a/src/photos-item-manager.c
+++ b/src/photos-item-manager.c
@@ -317,7 +317,7 @@ photos_item_manager_add_cursor_for_mode (PhotosItemManager *self,
         }
       else
         {
-          item = photos_item_manager_create_item (self, base_item_type, cursor);
+          item = photos_item_manager_create_item (self, base_item_type, cursor, TRUE);
           if (photos_base_item_is_collection (item))
             g_hash_table_insert (self->collections, g_strdup (id), g_object_ref (item));
 
@@ -1150,7 +1150,10 @@ photos_item_manager_clear (PhotosItemManager *self, PhotosWindowMode mode)
 
 
 PhotosBaseItem *
-photos_item_manager_create_item (PhotosItemManager *self, GType base_item_type, TrackerSparqlCursor *cursor)
+photos_item_manager_create_item (PhotosItemManager *self,
+                                 GType base_item_type,
+                                 TrackerSparqlCursor *cursor,
+                                 gboolean create_thumbnails)
 {
   GType type;
   PhotosBaseItem *ret_val = NULL;
@@ -1205,7 +1208,7 @@ photos_item_manager_create_item (PhotosItemManager *self, GType base_item_type,
 
   ret_val = PHOTOS_BASE_ITEM (g_object_new (type,
                                             "cursor", cursor,
-                                            "failed-thumbnailing", FALSE,
+                                            "failed-thumbnailing", !create_thumbnails,
                                             NULL));
 
  out:
diff --git a/src/photos-item-manager.h b/src/photos-item-manager.h
index 708e7504..7ab2d155 100644
--- a/src/photos-item-manager.h
+++ b/src/photos-item-manager.h
@@ -86,7 +86,8 @@ void                      photos_item_manager_clear                        (Phot
 
 PhotosBaseItem           *photos_item_manager_create_item                  (PhotosItemManager *self,
                                                                             GType base_item_type,
-                                                                            TrackerSparqlCursor *cursor);
+                                                                            TrackerSparqlCursor *cursor,
+                                                                            gboolean create_thumbnails);
 
 PhotosBaseItem           *photos_item_manager_get_active_collection        (PhotosItemManager *self);
 


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