gio-0.12.2: Binding to the GIO.

Portability | portable (depends on GHC)
Stability | alpha
Maintainer | gtk2hs-devel@lists.sourceforge.net

System.GIO.Icons.Icon

Contents

- Details
- Types
- Methods

Description

Synopsis

- newtype Icon = Icon (ForeignPtr Icon)
- class GObjectClass o => IconClass o
- iconEqual :: (IconClass icon1, IconClass icon2) => icon1 -> icon2 -> IO Bool
- iconToString :: IconClass icon => icon -> IO ByteString
- iconNewForString :: ByteString -> IO Icon

# Details

`Icon` is a very minimal interface for icons. It provides functions for checking the equality of two icons, hashing of icons and serializing an icon to and from strings.

`Icon` does not provide the actual pixmap for the icon as this is out of GIO's scope, however implementations of `Icon` may contain the name of an icon (see `ThemedIcon`), or the path to an icon (see GLoadableIcon).

To obtain a hash of a `Icon`, see `iconHash`.

To check if two `Icon`s are equal, see `iconEqual`.

For serializing a `Icon`, use `iconToString`.

If your application or library provides one or more `Icon` implementations you need to ensure that each GType is registered with the type system prior to calling `iconNewForString`.

# Types

newtype Icon

Constructors

Icon (ForeignPtr Icon) |

Instances

Eq Icon |
Ord Icon |
GObjectClass Icon |
IconClass Icon |

class GObjectClass o => IconClass o

Instances

IconClass Icon |

# Methods

iconEqual

Arguments

:: (IconClass icon1, IconClass icon2) |
=> icon1 |
-> icon2 |
-> IO Bool | returns `True` if icon1 is equal to icon2. `False` otherwise.

Checks if two icons are equal.

iconToString :: IconClass icon => icon -> IO ByteString

Generates a textual representation of icon that can be used for serialization such as when passing icon to a different process or saving it to persistent storage. Use `iconNewForString` to get icon back from the returned string.

The encoding of the returned string is proprietary to `Icon` except in the following two cases

- If icon is a `FileIcon`, the returned string is a native path (such as pathto/my icon.png) without escaping if the `File` for icon is a native file. If the file is not native, the returned string is the result of `fileGetUri`.
- If icon is a `ThemedIcon` with exactly one name, the encoding is simply the name (such as network-server).

iconNewForString :: ByteString -> IO Icon

Generate a `Icon` instance from str. This function can fail if str is not valid - see `iconToString` for discussion.

If your application or library provides one or more `Icon` implementations you need to ensure that each GType is registered with the type system prior to calling `iconNewForString`.