fix load-icon for abolute paths

phoen
Daniel Barlow 2022-03-24 22:46:58 +00:00
parent 7f1eddafce
commit 1fcd4fc933
1 changed files with 9 additions and 6 deletions

View File

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