"$ margin_top" : 5,
"id" : "+image",
"* args" : "JsRender.JsRender file",
- "* init" : "{\n Gdk.Pixbuf pixbuf;\n var fname = file.getIconFileName(false);\n\n if (FileUtils.test(fname, FileTest.EXISTS)) {\n pixbuf = new Gdk.Pixbuf.from_file(fname);\n } else {\n if (_this.missing_thumb_pixbuf == null) {\n var icon_theme = Gtk.IconTheme.get_default ();\n _this.missing_thumb_pixbuf = icon_theme.load_icon (\"package-x-generic\", 92, 0);\n _this.missing_thumb_pixbuf.ref();\n }\n pixbuf = _this.missing_thumb_pixbuf;\n\n }\n\n var img = new Clutter.Image();\n img.set_data(pixbuf.get_pixels(), \n pixbuf.has_alpha \n ? Cogl.PixelFormat.RGBA_8888\n : Cogl.PixelFormat.RGB_888,\n pixbuf.get_width (),\n pixbuf.get_height (),\n pixbuf.get_rowstride ()\n );\n this.el.set_content(img);\n // should probably do smarter scaling...\n \n \n this.el.set_size(90, 70);\n}\n",
+ "* init" : "{\n Gdk.Pixbuf pixbuf= null;\n \n var fname = file.getIconFileName(false);\n\n try {\n if (FileUtils.test(fname, FileTest.EXISTS)) {\n pixbuf = new Gdk.Pixbuf.from_file(fname);\n } \n catch (Error e) {\n \n }\n }\n if (pixbuf == null) {\n \n if (_this.missing_thumb_pixbuf == null) {\n var icon_theme = Gtk.IconTheme.get_default ();\n _this.missing_thumb_pixbuf = icon_theme.load_icon (\"package-x-generic\", 92, 0);\n _this.missing_thumb_pixbuf.ref();\n }\n pixbuf = _this.missing_thumb_pixbuf;\n\n }\n\n var img = new Clutter.Image();\n img.set_data(pixbuf.get_pixels(), \n pixbuf.has_alpha \n ? Cogl.PixelFormat.RGBA_8888\n : Cogl.PixelFormat.RGB_888,\n pixbuf.get_width (),\n pixbuf.get_height (),\n pixbuf.get_rowstride ()\n );\n this.el.set_content(img);\n // should probably do smarter scaling...\n \n \n this.el.set_size(90, 70);\n}\n",
"$ x_expand" : true,
"* pack" : "add_child",
"xtype" : "Actor",
// init method
{
- Gdk.Pixbuf pixbuf;
+ Gdk.Pixbuf pixbuf= null;
+
var fname = file.getIconFileName(false);
- if (FileUtils.test(fname, FileTest.EXISTS)) {
- pixbuf = new Gdk.Pixbuf.from_file(fname);
- } else {
+ try {
+ if (FileUtils.test(fname, FileTest.EXISTS)) {
+ pixbuf = new Gdk.Pixbuf.from_file(fname);
+ }
+ catch (Error e) {
+
+ }
+ }
+ if (pixbuf == null) {
+
if (_this.missing_thumb_pixbuf == null) {
var icon_theme = Gtk.IconTheme.get_default ();
_this.missing_thumb_pixbuf = icon_theme.load_icon ("package-x-generic", 92, 0);