diff --git a/src/AGS/Utils/Icon.js b/src/AGS/Utils/Icon.js new file mode 100644 index 0000000..e4a829a --- /dev/null +++ b/src/AGS/Utils/Icon.js @@ -0,0 +1,2 @@ +export const lookupIconImpl = Utils.lookUpIcon + diff --git a/src/AGS/Utils/Icon.purs b/src/AGS/Utils/Icon.purs new file mode 100644 index 0000000..30d7217 --- /dev/null +++ b/src/AGS/Utils/Icon.purs @@ -0,0 +1,16 @@ +module AGS.Utils.Icon (lookupIcon) where + +import Prelude + +import Data.Maybe (Maybe) +import Data.Nullable (Nullable, toMaybe) +import Effect (Effect) +import Effect.Uncurried (EffectFn2, runEffectFn2) +import Gtk.IconInfo (GtkIconInfo) + +-- | Look up an icon given its name and size. +lookupIcon ∷ String → Int → Effect (Maybe GtkIconInfo) +lookupIcon name size = map toMaybe (runEffectFn2 lookupIconImpl name size) + +foreign import lookupIconImpl ∷ EffectFn2 String Int (Nullable GtkIconInfo) + diff --git a/src/Gtk/IconInfo.js b/src/Gtk/IconInfo.js new file mode 100644 index 0000000..8b70af3 --- /dev/null +++ b/src/Gtk/IconInfo.js @@ -0,0 +1,4 @@ +export const getFilenameImpl = + iconInfo => + iconInfo.get_filename() + diff --git a/src/Gtk/IconInfo.purs b/src/Gtk/IconInfo.purs new file mode 100644 index 0000000..3db037b --- /dev/null +++ b/src/Gtk/IconInfo.purs @@ -0,0 +1,14 @@ +module Gtk.IconInfo (GtkIconInfo, filename) where + +import Data.Maybe (Maybe) +import Data.Nullable (Nullable, toMaybe) +import Prelude ((<<<)) + +foreign import data GtkIconInfo ∷ Type + +-- | Returns the full path to the icon, unless it's a builtin icon. +filename ∷ GtkIconInfo → Maybe String +filename = toMaybe <<< getFilenameImpl + +foreign import getFilenameImpl ∷ GtkIconInfo → Nullable String +