{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gtk.Objects.CssProvider
(
CssProvider(..) ,
IsCssProvider ,
toCssProvider ,
noCssProvider ,
#if defined(ENABLE_OVERLOADING)
ResolveCssProviderMethod ,
#endif
cssProviderGetDefault ,
cssProviderGetNamed ,
#if defined(ENABLE_OVERLOADING)
CssProviderLoadFromDataMethodInfo ,
#endif
cssProviderLoadFromData ,
#if defined(ENABLE_OVERLOADING)
CssProviderLoadFromFileMethodInfo ,
#endif
cssProviderLoadFromFile ,
#if defined(ENABLE_OVERLOADING)
CssProviderLoadFromPathMethodInfo ,
#endif
cssProviderLoadFromPath ,
#if defined(ENABLE_OVERLOADING)
CssProviderLoadFromResourceMethodInfo ,
#endif
cssProviderLoadFromResource ,
cssProviderNew ,
#if defined(ENABLE_OVERLOADING)
CssProviderToStringMethodInfo ,
#endif
cssProviderToString ,
C_CssProviderParsingErrorCallback ,
CssProviderParsingErrorCallback ,
#if defined(ENABLE_OVERLOADING)
CssProviderParsingErrorSignalInfo ,
#endif
afterCssProviderParsingError ,
genClosure_CssProviderParsingError ,
mk_CssProviderParsingErrorCallback ,
noCssProviderParsingErrorCallback ,
onCssProviderParsingError ,
wrap_CssProviderParsingErrorCallback ,
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Interfaces.File as Gio.File
import {-# SOURCE #-} qualified GI.Gtk.Interfaces.StyleProvider as Gtk.StyleProvider
import {-# SOURCE #-} qualified GI.Gtk.Structs.CssSection as Gtk.CssSection
newtype CssProvider = CssProvider (ManagedPtr CssProvider)
deriving (CssProvider -> CssProvider -> Bool
(CssProvider -> CssProvider -> Bool)
-> (CssProvider -> CssProvider -> Bool) -> Eq CssProvider
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CssProvider -> CssProvider -> Bool
$c/= :: CssProvider -> CssProvider -> Bool
== :: CssProvider -> CssProvider -> Bool
$c== :: CssProvider -> CssProvider -> Bool
Eq)
foreign import ccall "gtk_css_provider_get_type"
c_gtk_css_provider_get_type :: IO GType
instance GObject CssProvider where
gobjectType :: IO GType
gobjectType = IO GType
c_gtk_css_provider_get_type
instance B.GValue.IsGValue CssProvider where
toGValue :: CssProvider -> IO GValue
toGValue o :: CssProvider
o = do
GType
gtype <- IO GType
c_gtk_css_provider_get_type
CssProvider -> (Ptr CssProvider -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr CssProvider
o (GType
-> (GValue -> Ptr CssProvider -> IO ())
-> Ptr CssProvider
-> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr CssProvider -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
fromGValue :: GValue -> IO CssProvider
fromGValue gv :: GValue
gv = do
Ptr CssProvider
ptr <- GValue -> IO (Ptr CssProvider)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr CssProvider)
(ManagedPtr CssProvider -> CssProvider)
-> Ptr CssProvider -> IO CssProvider
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr CssProvider -> CssProvider
CssProvider Ptr CssProvider
ptr
class (GObject o, O.IsDescendantOf CssProvider o) => IsCssProvider o
instance (GObject o, O.IsDescendantOf CssProvider o) => IsCssProvider o
instance O.HasParentTypes CssProvider
type instance O.ParentTypes CssProvider = '[GObject.Object.Object, Gtk.StyleProvider.StyleProvider]
toCssProvider :: (MonadIO m, IsCssProvider o) => o -> m CssProvider
toCssProvider :: o -> m CssProvider
toCssProvider = IO CssProvider -> m CssProvider
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO CssProvider -> m CssProvider)
-> (o -> IO CssProvider) -> o -> m CssProvider
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr CssProvider -> CssProvider) -> o -> IO CssProvider
forall o o'.
(HasCallStack, GObject o, GObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr CssProvider -> CssProvider
CssProvider
noCssProvider :: Maybe CssProvider
noCssProvider :: Maybe CssProvider
noCssProvider = Maybe CssProvider
forall a. Maybe a
Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveCssProviderMethod (t :: Symbol) (o :: *) :: * where
ResolveCssProviderMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveCssProviderMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveCssProviderMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveCssProviderMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveCssProviderMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveCssProviderMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveCssProviderMethod "loadFromData" o = CssProviderLoadFromDataMethodInfo
ResolveCssProviderMethod "loadFromFile" o = CssProviderLoadFromFileMethodInfo
ResolveCssProviderMethod "loadFromPath" o = CssProviderLoadFromPathMethodInfo
ResolveCssProviderMethod "loadFromResource" o = CssProviderLoadFromResourceMethodInfo
ResolveCssProviderMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveCssProviderMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveCssProviderMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveCssProviderMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveCssProviderMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveCssProviderMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveCssProviderMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveCssProviderMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveCssProviderMethod "toString" o = CssProviderToStringMethodInfo
ResolveCssProviderMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveCssProviderMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveCssProviderMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveCssProviderMethod "getIconFactory" o = Gtk.StyleProvider.StyleProviderGetIconFactoryMethodInfo
ResolveCssProviderMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveCssProviderMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveCssProviderMethod "getStyle" o = Gtk.StyleProvider.StyleProviderGetStyleMethodInfo
ResolveCssProviderMethod "getStyleProperty" o = Gtk.StyleProvider.StyleProviderGetStylePropertyMethodInfo
ResolveCssProviderMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveCssProviderMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveCssProviderMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveCssProviderMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveCssProviderMethod t CssProvider, O.MethodInfo info CssProvider p) => OL.IsLabel t (CssProvider -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif
type CssProviderParsingErrorCallback =
Gtk.CssSection.CssSection
-> GError
-> IO ()
noCssProviderParsingErrorCallback :: Maybe CssProviderParsingErrorCallback
noCssProviderParsingErrorCallback :: Maybe CssProviderParsingErrorCallback
noCssProviderParsingErrorCallback = Maybe CssProviderParsingErrorCallback
forall a. Maybe a
Nothing
type C_CssProviderParsingErrorCallback =
Ptr () ->
Ptr Gtk.CssSection.CssSection ->
Ptr GError ->
Ptr () ->
IO ()
foreign import ccall "wrapper"
mk_CssProviderParsingErrorCallback :: C_CssProviderParsingErrorCallback -> IO (FunPtr C_CssProviderParsingErrorCallback)
genClosure_CssProviderParsingError :: MonadIO m => CssProviderParsingErrorCallback -> m (GClosure C_CssProviderParsingErrorCallback)
genClosure_CssProviderParsingError :: CssProviderParsingErrorCallback
-> m (GClosure C_CssProviderParsingErrorCallback)
genClosure_CssProviderParsingError cb :: CssProviderParsingErrorCallback
cb = IO (GClosure C_CssProviderParsingErrorCallback)
-> m (GClosure C_CssProviderParsingErrorCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_CssProviderParsingErrorCallback)
-> m (GClosure C_CssProviderParsingErrorCallback))
-> IO (GClosure C_CssProviderParsingErrorCallback)
-> m (GClosure C_CssProviderParsingErrorCallback)
forall a b. (a -> b) -> a -> b
$ do
let cb' :: C_CssProviderParsingErrorCallback
cb' = CssProviderParsingErrorCallback
-> C_CssProviderParsingErrorCallback
wrap_CssProviderParsingErrorCallback CssProviderParsingErrorCallback
cb
C_CssProviderParsingErrorCallback
-> IO (FunPtr C_CssProviderParsingErrorCallback)
mk_CssProviderParsingErrorCallback C_CssProviderParsingErrorCallback
cb' IO (FunPtr C_CssProviderParsingErrorCallback)
-> (FunPtr C_CssProviderParsingErrorCallback
-> IO (GClosure C_CssProviderParsingErrorCallback))
-> IO (GClosure C_CssProviderParsingErrorCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_CssProviderParsingErrorCallback
-> IO (GClosure C_CssProviderParsingErrorCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure
wrap_CssProviderParsingErrorCallback ::
CssProviderParsingErrorCallback ->
C_CssProviderParsingErrorCallback
wrap_CssProviderParsingErrorCallback :: CssProviderParsingErrorCallback
-> C_CssProviderParsingErrorCallback
wrap_CssProviderParsingErrorCallback _cb :: CssProviderParsingErrorCallback
_cb _ section :: Ptr CssSection
section error_ :: Ptr GError
error_ _ = do
(ManagedPtr CssSection -> CssSection)
-> Ptr CssSection -> (CssSection -> IO ()) -> IO ()
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
(ManagedPtr a -> a) -> Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient ManagedPtr CssSection -> CssSection
Gtk.CssSection.CssSection Ptr CssSection
section ((CssSection -> IO ()) -> IO ()) -> (CssSection -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \section' :: CssSection
section' -> do
GError
error_' <- ((ManagedPtr GError -> GError) -> Ptr GError -> IO GError
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr GError -> GError
GError) Ptr GError
error_
CssProviderParsingErrorCallback
_cb CssSection
section' GError
error_'
onCssProviderParsingError :: (IsCssProvider a, MonadIO m) => a -> CssProviderParsingErrorCallback -> m SignalHandlerId
onCssProviderParsingError :: a -> CssProviderParsingErrorCallback -> m SignalHandlerId
onCssProviderParsingError obj :: a
obj cb :: CssProviderParsingErrorCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
let cb' :: C_CssProviderParsingErrorCallback
cb' = CssProviderParsingErrorCallback
-> C_CssProviderParsingErrorCallback
wrap_CssProviderParsingErrorCallback CssProviderParsingErrorCallback
cb
FunPtr C_CssProviderParsingErrorCallback
cb'' <- C_CssProviderParsingErrorCallback
-> IO (FunPtr C_CssProviderParsingErrorCallback)
mk_CssProviderParsingErrorCallback C_CssProviderParsingErrorCallback
cb'
a
-> Text
-> FunPtr C_CssProviderParsingErrorCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj "parsing-error" FunPtr C_CssProviderParsingErrorCallback
cb'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing
afterCssProviderParsingError :: (IsCssProvider a, MonadIO m) => a -> CssProviderParsingErrorCallback -> m SignalHandlerId
afterCssProviderParsingError :: a -> CssProviderParsingErrorCallback -> m SignalHandlerId
afterCssProviderParsingError obj :: a
obj cb :: CssProviderParsingErrorCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
let cb' :: C_CssProviderParsingErrorCallback
cb' = CssProviderParsingErrorCallback
-> C_CssProviderParsingErrorCallback
wrap_CssProviderParsingErrorCallback CssProviderParsingErrorCallback
cb
FunPtr C_CssProviderParsingErrorCallback
cb'' <- C_CssProviderParsingErrorCallback
-> IO (FunPtr C_CssProviderParsingErrorCallback)
mk_CssProviderParsingErrorCallback C_CssProviderParsingErrorCallback
cb'
a
-> Text
-> FunPtr C_CssProviderParsingErrorCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj "parsing-error" FunPtr C_CssProviderParsingErrorCallback
cb'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
Nothing
#if defined(ENABLE_OVERLOADING)
data CssProviderParsingErrorSignalInfo
instance SignalInfo CssProviderParsingErrorSignalInfo where
type HaskellCallbackType CssProviderParsingErrorSignalInfo = CssProviderParsingErrorCallback
connectSignal obj cb connectMode detail = do
let cb' = wrap_CssProviderParsingErrorCallback cb
cb'' <- mk_CssProviderParsingErrorCallback cb'
connectSignalFunPtr obj "parsing-error" cb'' connectMode detail
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList CssProvider
type instance O.AttributeList CssProvider = CssProviderAttributeList
type CssProviderAttributeList = ('[ ] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList CssProvider = CssProviderSignalList
type CssProviderSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo), '("parsingError", CssProviderParsingErrorSignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "gtk_css_provider_new" gtk_css_provider_new ::
IO (Ptr CssProvider)
cssProviderNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
m CssProvider
cssProviderNew :: m CssProvider
cssProviderNew = IO CssProvider -> m CssProvider
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO CssProvider -> m CssProvider)
-> IO CssProvider -> m CssProvider
forall a b. (a -> b) -> a -> b
$ do
Ptr CssProvider
result <- IO (Ptr CssProvider)
gtk_css_provider_new
Text -> Ptr CssProvider -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "cssProviderNew" Ptr CssProvider
result
CssProvider
result' <- ((ManagedPtr CssProvider -> CssProvider)
-> Ptr CssProvider -> IO CssProvider
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr CssProvider -> CssProvider
CssProvider) Ptr CssProvider
result
CssProvider -> IO CssProvider
forall (m :: * -> *) a. Monad m => a -> m a
return CssProvider
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "gtk_css_provider_load_from_data" gtk_css_provider_load_from_data ::
Ptr CssProvider ->
Ptr Word8 ->
Int64 ->
Ptr (Ptr GError) ->
IO CInt
cssProviderLoadFromData ::
(B.CallStack.HasCallStack, MonadIO m, IsCssProvider a) =>
a
-> ByteString
-> m ()
cssProviderLoadFromData :: a -> ByteString -> m ()
cssProviderLoadFromData cssProvider :: a
cssProvider data_ :: ByteString
data_ = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
let length_ :: Int64
length_ = Int -> Int64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Int64) -> Int -> Int64
forall a b. (a -> b) -> a -> b
$ ByteString -> Int
B.length ByteString
data_
Ptr CssProvider
cssProvider' <- a -> IO (Ptr CssProvider)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
cssProvider
Ptr Word8
data_' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
data_
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr CssProvider
-> Ptr Word8 -> Int64 -> Ptr (Ptr GError) -> IO CInt
gtk_css_provider_load_from_data Ptr CssProvider
cssProvider' Ptr Word8
data_' Int64
length_
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
cssProvider
Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
data_'
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
data_'
)
#if defined(ENABLE_OVERLOADING)
data CssProviderLoadFromDataMethodInfo
instance (signature ~ (ByteString -> m ()), MonadIO m, IsCssProvider a) => O.MethodInfo CssProviderLoadFromDataMethodInfo a signature where
overloadedMethod = cssProviderLoadFromData
#endif
foreign import ccall "gtk_css_provider_load_from_file" gtk_css_provider_load_from_file ::
Ptr CssProvider ->
Ptr Gio.File.File ->
Ptr (Ptr GError) ->
IO CInt
cssProviderLoadFromFile ::
(B.CallStack.HasCallStack, MonadIO m, IsCssProvider a, Gio.File.IsFile b) =>
a
-> b
-> m ()
cssProviderLoadFromFile :: a -> b -> m ()
cssProviderLoadFromFile cssProvider :: a
cssProvider file :: b
file = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr CssProvider
cssProvider' <- a -> IO (Ptr CssProvider)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
cssProvider
Ptr File
file' <- b -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
file
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr CssProvider -> Ptr File -> Ptr (Ptr GError) -> IO CInt
gtk_css_provider_load_from_file Ptr CssProvider
cssProvider' Ptr File
file'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
cssProvider
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
file
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data CssProviderLoadFromFileMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsCssProvider a, Gio.File.IsFile b) => O.MethodInfo CssProviderLoadFromFileMethodInfo a signature where
overloadedMethod = cssProviderLoadFromFile
#endif
foreign import ccall "gtk_css_provider_load_from_path" gtk_css_provider_load_from_path ::
Ptr CssProvider ->
CString ->
Ptr (Ptr GError) ->
IO CInt
cssProviderLoadFromPath ::
(B.CallStack.HasCallStack, MonadIO m, IsCssProvider a) =>
a
-> T.Text
-> m ()
cssProviderLoadFromPath :: a -> Text -> m ()
cssProviderLoadFromPath cssProvider :: a
cssProvider path :: Text
path = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr CssProvider
cssProvider' <- a -> IO (Ptr CssProvider)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
cssProvider
CString
path' <- Text -> IO CString
textToCString Text
path
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr CssProvider -> CString -> Ptr (Ptr GError) -> IO CInt
gtk_css_provider_load_from_path Ptr CssProvider
cssProvider' CString
path'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
cssProvider
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
path'
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
path'
)
#if defined(ENABLE_OVERLOADING)
data CssProviderLoadFromPathMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m, IsCssProvider a) => O.MethodInfo CssProviderLoadFromPathMethodInfo a signature where
overloadedMethod = cssProviderLoadFromPath
#endif
foreign import ccall "gtk_css_provider_load_from_resource" gtk_css_provider_load_from_resource ::
Ptr CssProvider ->
CString ->
IO ()
cssProviderLoadFromResource ::
(B.CallStack.HasCallStack, MonadIO m, IsCssProvider a) =>
a
-> T.Text
-> m ()
cssProviderLoadFromResource :: a -> Text -> m ()
cssProviderLoadFromResource cssProvider :: a
cssProvider resourcePath :: Text
resourcePath = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr CssProvider
cssProvider' <- a -> IO (Ptr CssProvider)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
cssProvider
CString
resourcePath' <- Text -> IO CString
textToCString Text
resourcePath
Ptr CssProvider -> CString -> IO ()
gtk_css_provider_load_from_resource Ptr CssProvider
cssProvider' CString
resourcePath'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
cssProvider
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
resourcePath'
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data CssProviderLoadFromResourceMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m, IsCssProvider a) => O.MethodInfo CssProviderLoadFromResourceMethodInfo a signature where
overloadedMethod = cssProviderLoadFromResource
#endif
foreign import ccall "gtk_css_provider_to_string" gtk_css_provider_to_string ::
Ptr CssProvider ->
IO CString
cssProviderToString ::
(B.CallStack.HasCallStack, MonadIO m, IsCssProvider a) =>
a
-> m T.Text
cssProviderToString :: a -> m Text
cssProviderToString provider :: a
provider = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
Ptr CssProvider
provider' <- a -> IO (Ptr CssProvider)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
provider
CString
result <- Ptr CssProvider -> IO CString
gtk_css_provider_to_string Ptr CssProvider
provider'
Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "cssProviderToString" CString
result
Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
provider
Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'
#if defined(ENABLE_OVERLOADING)
data CssProviderToStringMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsCssProvider a) => O.MethodInfo CssProviderToStringMethodInfo a signature where
overloadedMethod = cssProviderToString
#endif
foreign import ccall "gtk_css_provider_get_default" gtk_css_provider_get_default ::
IO (Ptr CssProvider)
{-# DEPRECATED cssProviderGetDefault ["(Since version 3.24)","Use 'GI.Gtk.Objects.CssProvider.cssProviderNew' instead."] #-}
cssProviderGetDefault ::
(B.CallStack.HasCallStack, MonadIO m) =>
m CssProvider
cssProviderGetDefault :: m CssProvider
cssProviderGetDefault = IO CssProvider -> m CssProvider
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO CssProvider -> m CssProvider)
-> IO CssProvider -> m CssProvider
forall a b. (a -> b) -> a -> b
$ do
Ptr CssProvider
result <- IO (Ptr CssProvider)
gtk_css_provider_get_default
Text -> Ptr CssProvider -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "cssProviderGetDefault" Ptr CssProvider
result
CssProvider
result' <- ((ManagedPtr CssProvider -> CssProvider)
-> Ptr CssProvider -> IO CssProvider
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr CssProvider -> CssProvider
CssProvider) Ptr CssProvider
result
CssProvider -> IO CssProvider
forall (m :: * -> *) a. Monad m => a -> m a
return CssProvider
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "gtk_css_provider_get_named" gtk_css_provider_get_named ::
CString ->
CString ->
IO (Ptr CssProvider)
cssProviderGetNamed ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> Maybe (T.Text)
-> m CssProvider
cssProviderGetNamed :: Text -> Maybe Text -> m CssProvider
cssProviderGetNamed name :: Text
name variant :: Maybe Text
variant = IO CssProvider -> m CssProvider
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO CssProvider -> m CssProvider)
-> IO CssProvider -> m CssProvider
forall a b. (a -> b) -> a -> b
$ do
CString
name' <- Text -> IO CString
textToCString Text
name
CString
maybeVariant <- case Maybe Text
variant of
Nothing -> CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
Just jVariant :: Text
jVariant -> do
CString
jVariant' <- Text -> IO CString
textToCString Text
jVariant
CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jVariant'
Ptr CssProvider
result <- CString -> CString -> IO (Ptr CssProvider)
gtk_css_provider_get_named CString
name' CString
maybeVariant
Text -> Ptr CssProvider -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "cssProviderGetNamed" Ptr CssProvider
result
CssProvider
result' <- ((ManagedPtr CssProvider -> CssProvider)
-> Ptr CssProvider -> IO CssProvider
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr CssProvider -> CssProvider
CssProvider) Ptr CssProvider
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
name'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeVariant
CssProvider -> IO CssProvider
forall (m :: * -> *) a. Monad m => a -> m a
return CssProvider
result'
#if defined(ENABLE_OVERLOADING)
#endif