[tracker] tracker-search-tool: Fix warnings in TrackerUtils
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker] tracker-search-tool: Fix warnings in TrackerUtils
- Date: Mon, 16 Nov 2009 11:25:36 +0000 (UTC)
commit 200a9c04a1f51023f47e6bbe7341277f8e92e05a
Author: Jürg Billeter <j bitron ch>
Date: Mon Nov 16 12:09:52 2009 +0100
tracker-search-tool: Fix warnings in TrackerUtils
Fix return types and error handling in thumbnail retrieval code.
src/tracker-search-tool/tracker-utils.gs | 22 ++++++++++++++--------
1 files changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/src/tracker-search-tool/tracker-utils.gs b/src/tracker-search-tool/tracker-utils.gs
index 33835db..462349c 100644
--- a/src/tracker-search-tool/tracker-utils.gs
+++ b/src/tracker-search-tool/tracker-utils.gs
@@ -113,21 +113,24 @@ class TrackerUtils
return false
- def static inline GetThemePixbufByName (icon_name : string, size : int, screen : Gdk.Screen) : Gdk.Pixbuf
+ def static inline GetThemePixbufByName (icon_name : string, size : int, screen : Gdk.Screen) : Gdk.Pixbuf?
var icon = new ThemedIcon (icon_name);
return GetThemeIconPixbuf (icon, size, screen)
- def static GetThumbNail (info : FileInfo, thumb_size : int, icon_size : int, screen : Gdk.Screen) : Gdk.Pixbuf
+ def static GetThumbNail (info : FileInfo, thumb_size : int, icon_size : int, screen : Gdk.Screen) : Gdk.Pixbuf?
pixbuf : Gdk.Pixbuf = null
+
+ try
+ var thumbpath = info.get_attribute_byte_string (FILE_ATTRIBUTE_THUMBNAIL_PATH)
- var thumbpath = info.get_attribute_byte_string (FILE_ATTRIBUTE_THUMBNAIL_PATH)
-
- if thumbpath is not null
- pixbuf = new Gdk.Pixbuf.from_file_at_size (thumbpath, thumb_size, thumb_size)
+ if thumbpath is not null
+ pixbuf = new Gdk.Pixbuf.from_file_at_size (thumbpath, thumb_size, thumb_size)
+ except e: Error
+ pass
if pixbuf is null
pixbuf = GetThemeIconPixbuf (info.get_icon (), icon_size, screen)
@@ -138,7 +141,7 @@ class TrackerUtils
return pixbuf
- def static GetThemeIconPixbuf (icon : Icon, size : int, screen : Gdk.Screen) : Gdk.Pixbuf
+ def static GetThemeIconPixbuf (icon : Icon, size : int, screen : Gdk.Screen) : Gdk.Pixbuf?
icon_info : IconInfo
@@ -146,7 +149,10 @@ class TrackerUtils
icon_info = theme.lookup_by_gicon (icon, size, IconLookupFlags.USE_BUILTIN)
- return icon_info.load_icon ()
+ try
+ return icon_info.load_icon ()
+ except e: Error
+ return null
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]