[mistelix] Better handle of file not found
- From: Jordi Mas <jmas src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [mistelix] Better handle of file not found
- Date: Fri, 31 Jul 2009 14:06:36 +0000 (UTC)
commit cddebac348b584f9828d6ec65e6ff18e63777939
Author: Jordi Mas <jmas softcatala org>
Date: Fri Jul 31 16:06:05 2009 +0200
Better handle of file not found
src/Backends/ThumbnailCache/Gnome.cs | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/src/Backends/ThumbnailCache/Gnome.cs b/src/Backends/ThumbnailCache/Gnome.cs
index a211fc9..084102d 100644
--- a/src/Backends/ThumbnailCache/Gnome.cs
+++ b/src/Backends/ThumbnailCache/Gnome.cs
@@ -116,6 +116,10 @@ namespace Mistelix.Backends.ThumbnailCache
factory_raw = (width > 128 || height > 128) ? factory_large : factory_normal;
time = GetTimeModified (uri);
+
+ if (time == 0)
+ return null;
+
// Verifies that the thumbnail exists and it is updated
thumbnail_raw = gnome_desktop_thumbnail_factory_lookup (factory_raw, uri, time);
thumbnail_file = GLib.Marshaller.Utf8PtrToString (thumbnail_raw);
@@ -155,6 +159,9 @@ namespace Mistelix.Backends.ThumbnailCache
try
{
time = GetTimeModified (uri);
+ if (time == 0)
+ return;
+
factory_raw = (pixbuf.Width > 128 || pixbuf.Height > 128) ? factory_large : factory_normal;
gnome_desktop_thumbnail_factory_save_thumbnail (factory_raw, pixbuf.Handle, uri, time);
Logger.Debug ("Gnome.StoreThumbnail. Cached image {0}", uri);
@@ -173,6 +180,11 @@ namespace Mistelix.Backends.ThumbnailCache
file_raw = g_file_new_for_uri (uri);
fileinfo_raw = g_file_query_info (file_raw, "time::modified", 0, IntPtr.Zero, out error_raw);
+ g_object_unref (file_raw);
+
+ if (fileinfo_raw == IntPtr.Zero) // File not found for example
+ return 0;
+
time = g_file_info_get_attribute_uint64 (fileinfo_raw, "time::modified");
return time;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]