From 771d6df3b3e275a8751cb8c99b03b8d0a4b6888c Mon Sep 17 00:00:00 2001 From: foudfou Date: Tue, 7 Feb 2012 18:42:27 +0100 Subject: [PATCH] detect inexisting file in setIconImage() --- src/modules/ctypes/gdk.jsm | 2 +- src/modules/gtk2/FiretrayStatusIcon.jsm | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/modules/ctypes/gdk.jsm b/src/modules/ctypes/gdk.jsm index 84df88e..1606c79 100644 --- a/src/modules/ctypes/gdk.jsm +++ b/src/modules/ctypes/gdk.jsm @@ -37,7 +37,7 @@ * * ***** END LICENSE BLOCK ***** */ -var EXPORTED_SYMBOLS = [ "gdk", "glib" ]; +var EXPORTED_SYMBOLS = [ "gdk" ]; const GDK_LIBNAME = "gdk-x11-2.0"; const GDK_ABIS = [ 0 ]; diff --git a/src/modules/gtk2/FiretrayStatusIcon.jsm b/src/modules/gtk2/FiretrayStatusIcon.jsm index 337d2cc..6253ed8 100644 --- a/src/modules/gtk2/FiretrayStatusIcon.jsm +++ b/src/modules/gtk2/FiretrayStatusIcon.jsm @@ -111,9 +111,12 @@ firetray.Handler.setIconImage = function(filename) { return false; LOG(filename); + let pixbuf = gdk.gdk_pixbuf_new_from_file(filename, null); + if (strEquals(pixbuf, gdk.GdkPixbuf.ptr(null))) + return false; + try { - gtk.gtk_status_icon_set_from_file(firetray.StatusIcon.trayIcon, - filename); + gtk.gtk_status_icon_set_from_pixbuf(firetray.StatusIcon.trayIcon, pixbuf); } catch (x) { ERROR(x); return false;