-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add `Utils.lookupIcon` * Add `Gtk.IconInfo.filename`
- Loading branch information
Showing
4 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export const lookupIconImpl = Utils.lookUpIcon | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export const getFilenameImpl = | ||
iconInfo => | ||
iconInfo.get_filename() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|