fix load-icon for abolute paths

This commit is contained in:
Daniel Barlow 2022-03-24 22:46:58 +00:00
parent 7f1eddafce
commit 1fcd4fc933

View File

@ -32,16 +32,19 @@
(local found-icons {}) (local found-icons {})
(fn load-icon [name] (fn load-icon [name]
(if (= (name:sub 1 1) "/") (let [pixbuf
;; From a direct path (if (= (name:sub 1 1) "/")
(GdkPixbuf.Pixbuf.new_from_file_at_scale name HEIGHT -1 true) ;; From a direct path
;; From icon theme (GdkPixbuf.Pixbuf.new_from_file_at_scale name HEIGHT -1 true)
(Gtk.Image.new_from_pixbuf (find-icon-pixbuf name)))) ;; From icon theme
(find-icon-pixbuf name))]
(Gtk.Image.new_from_pixbuf pixbuf)))
(fn find-icon [name] (fn find-icon [name]
(let [icon (. found-icons name)] (let [icon (. found-icons name)]
(or icon (or icon
(let [icon (load-icon name)] (let [(icon err) (load-icon name)]
(if (not icon) (print err))
(tset found-icons name icon) (tset found-icons name icon)
icon)))) icon))))