gi-gtk-0.3.18.13: GI/Gtk/Structs/SettingsValue.hs
{- |
Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
-}
module GI.Gtk.Structs.SettingsValue
(
-- * Exported types
SettingsValue(..) ,
newZeroSettingsValue ,
noSettingsValue ,
-- * Properties
-- ** Origin
settingsValueReadOrigin ,
-- ** Value
settingsValueReadValue ,
) where
import Prelude ()
import Data.GI.Base.ShortPrelude
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import GI.Gtk.Types
import GI.Gtk.Callbacks
newtype SettingsValue = SettingsValue (ForeignPtr SettingsValue)
-- | Construct a `SettingsValue` struct initialized to zero.
newZeroSettingsValue :: MonadIO m => m SettingsValue
newZeroSettingsValue = liftIO $ callocBytes 32 >>= wrapPtr SettingsValue
noSettingsValue :: Maybe SettingsValue
noSettingsValue = Nothing
settingsValueReadOrigin :: SettingsValue -> IO T.Text
settingsValueReadOrigin s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO CString
val' <- cstringToText val
return val'
settingsValueReadValue :: SettingsValue -> IO GValue
settingsValueReadValue s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 8) :: IO (Ptr GValue)
val' <- (newBoxed GValue) val
return val'
type family ResolveSettingsValueMethod (t :: Symbol) (o :: *) :: * where
ResolveSettingsValueMethod l o = MethodResolutionFailed l o
instance (info ~ ResolveSettingsValueMethod t SettingsValue, MethodInfo info SettingsValue p) => IsLabelProxy t (SettingsValue -> p) where
fromLabelProxy _ = overloadedMethod (MethodProxy :: MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveSettingsValueMethod t SettingsValue, MethodInfo info SettingsValue p) => IsLabel t (SettingsValue -> p) where
fromLabel _ = overloadedMethod (MethodProxy :: MethodProxy info)
#endif