[cheese] Do not add 0-sized files to the thumb view



commit 9722eef709afca9e1b9452b7dfee87a4331b8d1a
Author: Hans de Goede <hdegoede redhat com>
Date:   Sat Jun 9 00:06:20 2012 +0200

    Do not add 0-sized files to the thumb view
    
    Sometimes, ie when Cheese crashes when starting to record, something which
    we need to fix, 0 bytes large files are created under ~/Videos/Webcam.
    
    totem-video-thumbnailer does not like these, getting stuck for around a
    minute on them, I have filed bug 677734 for this.
    
    But even with this bug fixed, trying to add 0 byte sized files to the
    thumb view makes no sense, and in the mean time it also neatly works
    around this totem-video-thumbnailer bug.
    
    Fixes bug 677735.
    
    Signed-off-by: Hans de Goede <hdegoede redhat com>

 src/thumbview/cheese-thumb-view.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/thumbview/cheese-thumb-view.c b/src/thumbview/cheese-thumb-view.c
index 5c06ff3..f4694f5 100644
--- a/src/thumbview/cheese-thumb-view.c
+++ b/src/thumbview/cheese-thumb-view.c
@@ -197,9 +197,20 @@ cheese_thumb_view_append_item (CheeseThumbView *thumb_view, GFile *file)
   char         *filename, *basename, *col_filename;
   GError       *error = NULL;
   gboolean      skip  = FALSE;
+  GFileInfo    *info;
+  goffset       size;
 
   CheeseThumbViewIdleData *data;
 
+  info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_SIZE, 0, NULL,
+                            NULL);
+  size = g_file_info_get_size (info);
+  g_object_unref (info);
+
+  /* Ignore 0-sized files, bug 677735. */
+  if (size == 0)
+    return;
+
   filename = g_file_get_path (file);
 
   if (!(g_str_has_suffix (filename, CHEESE_PHOTO_NAME_SUFFIX))



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