module System.GIO.Icons.ThemedIcon (
ThemedIcon(..),
ThemedIconClass,
themedIconNew,
themedIconNewFromNames,
themedIconPrependName,
themedIconAppendName,
themedIconGetNames,
) where
import Control.Monad
import Data.ByteString (ByteString)
import Data.ByteString (useAsCString)
import Data.ByteString.Unsafe (unsafePackCStringFinalizer)
import System.GIO.Enums
import System.Glib.FFI
import System.Glib.Flags
import System.Glib.GError
import System.Glib.GObject
import System.Glib.UTFString
import System.GIO.Types
themedIconNew :: ByteString
-> IO ThemedIcon
themedIconNew iconName =
useAsCString iconName $ \ iconNamePtr ->
g_themed_icon_new iconNamePtr
>>= (wrapNewGObject mkThemedIcon . return) . castPtr
themedIconNewFromNames :: GlibString string
=> [string]
-> IO ThemedIcon
themedIconNewFromNames iconNames = do
let len = if null iconNames then (1) else length iconNames
withUTFStringArray iconNames $ \ iconNamesPtr ->
g_themed_icon_new_from_names iconNamesPtr (fromIntegral len)
>>= (wrapNewGObject mkThemedIcon . return) . castPtr
themedIconPrependName :: (ThemedIconClass icon, GlibString string) => icon
-> string
-> IO ()
themedIconPrependName icon iconname =
withUTFString iconname $ \ iconnamePtr ->
(\(ThemedIcon arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->g_themed_icon_prepend_name argPtr1 arg2) (toThemedIcon icon) iconnamePtr
themedIconAppendName :: (ThemedIconClass icon, GlibString string) => icon
-> string
-> IO ()
themedIconAppendName icon iconname =
withUTFString iconname $ \ iconnamePtr ->
(\(ThemedIcon arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->g_themed_icon_append_name argPtr1 arg2) (toThemedIcon icon) iconnamePtr
themedIconGetNames :: (ThemedIconClass icon, GlibString string) => icon
-> IO [string]
themedIconGetNames icon =
(\(ThemedIcon arg1) -> withForeignPtr arg1 $ \argPtr1 ->g_themed_icon_get_names argPtr1) (toThemedIcon icon)
>>= readUTFStringArray0
foreign import ccall safe "g_themed_icon_new"
g_themed_icon_new :: ((Ptr CChar) -> (IO (Ptr Icon)))
foreign import ccall safe "g_themed_icon_new_from_names"
g_themed_icon_new_from_names :: ((Ptr (Ptr CChar)) -> (CInt -> (IO (Ptr Icon))))
foreign import ccall safe "g_themed_icon_prepend_name"
g_themed_icon_prepend_name :: ((Ptr ThemedIcon) -> ((Ptr CChar) -> (IO ())))
foreign import ccall safe "g_themed_icon_append_name"
g_themed_icon_append_name :: ((Ptr ThemedIcon) -> ((Ptr CChar) -> (IO ())))
foreign import ccall safe "g_themed_icon_get_names"
g_themed_icon_get_names :: ((Ptr ThemedIcon) -> (IO (Ptr (Ptr CChar))))