src/Builder4/PopoverFiles.bjs
authorAlan <alan@roojs.com>
Fri, 20 May 2022 07:11:04 +0000 (15:11 +0800)
committerAlan <alan@roojs.com>
Fri, 20 May 2022 07:11:04 +0000 (15:11 +0800)
src/Builder4/PopoverFiles.vala

src/Builder4/PopoverFiles.bjs
src/Builder4/PopoverFiles.vala

index 60d9ee9..3937e06 100644 (file)
     "        var fname = file.getIconFileName(false);",
     "        try {",
     "\t\t    if (FileUtils.test(fname, FileTest.EXISTS)) {",
-    "\t\t        pixbuf = new Gdk.Pixbuf.from_file(fname).scale_simple(92,92, Gdk.InterpType.NEAREST) ;",
+    "\t\t        var pixbuf = new Gdk.Pixbuf.from_file(fname)",
+    "\t\t        pixbuf = pixbuf.scale_simple(92, 92 * (pixbuf.height / pixbuf.width), Gdk.InterpType.NEAREST) ;",
     "\t\t    } ",
     "\t\t} catch (Error e) {",
     "\t\t    // noop",
index 924c5b4..d1ff839 100644 (file)
@@ -167,7 +167,8 @@ public class Xcls_PopoverFiles : Object
             var fname = file.getIconFileName(false);
             try {
                    if (FileUtils.test(fname, FileTest.EXISTS)) {
-                       pixbuf = new Gdk.Pixbuf.from_file(fname).scale_simple(92,92, Gdk.InterpType.NEAREST) ;
+                       var pixbuf = new Gdk.Pixbuf.from_file(fname)
+                       pixbuf = pixbuf.scale_simple(92, 92 * (pixbuf.height / pixbuf.width), Gdk.InterpType.NEAREST) ;
                    } 
                } catch (Error e) {
                    // noop