[gnome-photos/wip/rishi/collection: 40/47] utils: Shuffle some code around



commit aa6afb812b44b3fbb976e98968be8e4422f022a0
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 a step
    in that direction.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=751212

 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 549ee1b2..8d94c403 100644
--- a/src/photos-utils.c
+++ b/src/photos-utils.c
@@ -424,13 +424,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);
 
@@ -479,13 +484,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]