[gnome-photos/wip/rishi/import-7: 3/6] utils: Shuffle some code around



commit 8cde3fb2714c65e4b2c8c21517f95055214ffe5e
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed Jan 24 20:57:48 2018 +0100

    utils: Shuffle some code around
    
    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.
    
    This is a step in that direction.
    
    https://gitlab.gnome.org/GNOME/gnome-photos/issues/29

 src/photos-utils.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/src/photos-utils.c b/src/photos-utils.c
index 73035896..c83676a6 100644
--- a/src/photos-utils.c
+++ b/src/photos-utils.c
@@ -421,13 +421,18 @@ photos_utils_create_zoom_target_value (gdouble delta, PhotosZoomEvent event)
 
 
 static GIcon *
-photos_utils_get_thumbnail_icon (const gchar *uri)
+photos_utils_get_thumbnail_icon (PhotosBaseItem *item)
 {
   g_autoptr (GFile) file = NULL;
   g_autoptr (GFile) thumb_file = NULL;
   g_autoptr (GFileInfo) info = NULL;
   GIcon *icon = NULL;
   const gchar *thumb_path;
+  const gchar *uri;
+
+  uri = photos_base_item_get_uri (item);
+  if (uri == NULL || uri[0] == '\0')
+    goto out;
 
   file = g_file_new_for_uri (uri);
 
@@ -476,13 +481,7 @@ photos_utils_get_icon_from_item (PhotosBaseItem *item)
     }
 
   if (!is_remote)
-    {
-      const gchar *uri;
-
-      uri = photos_base_item_get_uri (item);
-      if (uri != NULL && uri[0] != '\0')
-        icon = photos_utils_get_thumbnail_icon (uri);
-    }
+    icon = photos_utils_get_thumbnail_icon (item);
 
   if (icon != NULL)
     goto out;


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