#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.GtkSource.Objects.File
(
File(..) ,
IsFile ,
toFile ,
noFile ,
#if ENABLE_OVERLOADING
FileCheckFileOnDiskMethodInfo ,
#endif
fileCheckFileOnDisk ,
#if ENABLE_OVERLOADING
FileGetCompressionTypeMethodInfo ,
#endif
fileGetCompressionType ,
#if ENABLE_OVERLOADING
FileGetEncodingMethodInfo ,
#endif
fileGetEncoding ,
#if ENABLE_OVERLOADING
FileGetLocationMethodInfo ,
#endif
fileGetLocation ,
#if ENABLE_OVERLOADING
FileGetNewlineTypeMethodInfo ,
#endif
fileGetNewlineType ,
#if ENABLE_OVERLOADING
FileIsDeletedMethodInfo ,
#endif
fileIsDeleted ,
#if ENABLE_OVERLOADING
FileIsExternallyModifiedMethodInfo ,
#endif
fileIsExternallyModified ,
#if ENABLE_OVERLOADING
FileIsLocalMethodInfo ,
#endif
fileIsLocal ,
#if ENABLE_OVERLOADING
FileIsReadonlyMethodInfo ,
#endif
fileIsReadonly ,
fileNew ,
#if ENABLE_OVERLOADING
FileSetLocationMethodInfo ,
#endif
fileSetLocation ,
#if ENABLE_OVERLOADING
FileCompressionTypePropertyInfo ,
#endif
#if ENABLE_OVERLOADING
fileCompressionType ,
#endif
getFileCompressionType ,
#if ENABLE_OVERLOADING
FileEncodingPropertyInfo ,
#endif
#if ENABLE_OVERLOADING
fileEncoding ,
#endif
getFileEncoding ,
#if ENABLE_OVERLOADING
FileLocationPropertyInfo ,
#endif
clearFileLocation ,
constructFileLocation ,
#if ENABLE_OVERLOADING
fileLocation ,
#endif
getFileLocation ,
setFileLocation ,
#if ENABLE_OVERLOADING
FileNewlineTypePropertyInfo ,
#endif
#if ENABLE_OVERLOADING
fileNewlineType ,
#endif
getFileNewlineType ,
#if ENABLE_OVERLOADING
FileReadOnlyPropertyInfo ,
#endif
#if ENABLE_OVERLOADING
fileReadOnly ,
#endif
getFileReadOnly ,
) 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.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.GtkSource.Enums as GtkSource.Enums
import {-# SOURCE #-} qualified GI.GtkSource.Structs.Encoding as GtkSource.Encoding
newtype File = File (ManagedPtr File)
foreign import ccall "gtk_source_file_get_type"
c_gtk_source_file_get_type :: IO GType
instance GObject File where
gobjectType = c_gtk_source_file_get_type
class (GObject o, O.IsDescendantOf File o) => IsFile o
instance (GObject o, O.IsDescendantOf File o) => IsFile o
instance O.HasParentTypes File
type instance O.ParentTypes File = '[GObject.Object.Object]
toFile :: (MonadIO m, IsFile o) => o -> m File
toFile = liftIO . unsafeCastTo File
noFile :: Maybe File
noFile = Nothing
#if ENABLE_OVERLOADING
type family ResolveFileMethod (t :: Symbol) (o :: *) :: * where
ResolveFileMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveFileMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveFileMethod "checkFileOnDisk" o = FileCheckFileOnDiskMethodInfo
ResolveFileMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveFileMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveFileMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveFileMethod "isDeleted" o = FileIsDeletedMethodInfo
ResolveFileMethod "isExternallyModified" o = FileIsExternallyModifiedMethodInfo
ResolveFileMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveFileMethod "isLocal" o = FileIsLocalMethodInfo
ResolveFileMethod "isReadonly" o = FileIsReadonlyMethodInfo
ResolveFileMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveFileMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveFileMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveFileMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveFileMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveFileMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveFileMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveFileMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveFileMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveFileMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveFileMethod "getCompressionType" o = FileGetCompressionTypeMethodInfo
ResolveFileMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveFileMethod "getEncoding" o = FileGetEncodingMethodInfo
ResolveFileMethod "getLocation" o = FileGetLocationMethodInfo
ResolveFileMethod "getNewlineType" o = FileGetNewlineTypeMethodInfo
ResolveFileMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveFileMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveFileMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveFileMethod "setLocation" o = FileSetLocationMethodInfo
ResolveFileMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveFileMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveFileMethod t File, O.MethodInfo info File p) => OL.IsLabel t (File -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif
getFileCompressionType :: (MonadIO m, IsFile o) => o -> m GtkSource.Enums.CompressionType
getFileCompressionType obj = liftIO $ B.Properties.getObjectPropertyEnum obj "compression-type"
#if ENABLE_OVERLOADING
data FileCompressionTypePropertyInfo
instance AttrInfo FileCompressionTypePropertyInfo where
type AttrAllowedOps FileCompressionTypePropertyInfo = '[ 'AttrGet]
type AttrSetTypeConstraint FileCompressionTypePropertyInfo = (~) ()
type AttrBaseTypeConstraint FileCompressionTypePropertyInfo = IsFile
type AttrGetType FileCompressionTypePropertyInfo = GtkSource.Enums.CompressionType
type AttrLabel FileCompressionTypePropertyInfo = "compression-type"
type AttrOrigin FileCompressionTypePropertyInfo = File
attrGet _ = getFileCompressionType
attrSet _ = undefined
attrConstruct _ = undefined
attrClear _ = undefined
#endif
getFileEncoding :: (MonadIO m, IsFile o) => o -> m GtkSource.Encoding.Encoding
getFileEncoding obj = liftIO $ checkUnexpectedNothing "getFileEncoding" $ B.Properties.getObjectPropertyBoxed obj "encoding" GtkSource.Encoding.Encoding
#if ENABLE_OVERLOADING
data FileEncodingPropertyInfo
instance AttrInfo FileEncodingPropertyInfo where
type AttrAllowedOps FileEncodingPropertyInfo = '[ 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint FileEncodingPropertyInfo = (~) ()
type AttrBaseTypeConstraint FileEncodingPropertyInfo = IsFile
type AttrGetType FileEncodingPropertyInfo = GtkSource.Encoding.Encoding
type AttrLabel FileEncodingPropertyInfo = "encoding"
type AttrOrigin FileEncodingPropertyInfo = File
attrGet _ = getFileEncoding
attrSet _ = undefined
attrConstruct _ = undefined
attrClear _ = undefined
#endif
getFileLocation :: (MonadIO m, IsFile o) => o -> m Gio.File.File
getFileLocation obj = liftIO $ checkUnexpectedNothing "getFileLocation" $ B.Properties.getObjectPropertyObject obj "location" Gio.File.File
setFileLocation :: (MonadIO m, IsFile o, Gio.File.IsFile a) => o -> a -> m ()
setFileLocation obj val = liftIO $ B.Properties.setObjectPropertyObject obj "location" (Just val)
constructFileLocation :: (IsFile o, Gio.File.IsFile a) => a -> IO (GValueConstruct o)
constructFileLocation val = B.Properties.constructObjectPropertyObject "location" (Just val)
clearFileLocation :: (MonadIO m, IsFile o) => o -> m ()
clearFileLocation obj = liftIO $ B.Properties.setObjectPropertyObject obj "location" (Nothing :: Maybe Gio.File.File)
#if ENABLE_OVERLOADING
data FileLocationPropertyInfo
instance AttrInfo FileLocationPropertyInfo where
type AttrAllowedOps FileLocationPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint FileLocationPropertyInfo = Gio.File.IsFile
type AttrBaseTypeConstraint FileLocationPropertyInfo = IsFile
type AttrGetType FileLocationPropertyInfo = Gio.File.File
type AttrLabel FileLocationPropertyInfo = "location"
type AttrOrigin FileLocationPropertyInfo = File
attrGet _ = getFileLocation
attrSet _ = setFileLocation
attrConstruct _ = constructFileLocation
attrClear _ = clearFileLocation
#endif
getFileNewlineType :: (MonadIO m, IsFile o) => o -> m GtkSource.Enums.NewlineType
getFileNewlineType obj = liftIO $ B.Properties.getObjectPropertyEnum obj "newline-type"
#if ENABLE_OVERLOADING
data FileNewlineTypePropertyInfo
instance AttrInfo FileNewlineTypePropertyInfo where
type AttrAllowedOps FileNewlineTypePropertyInfo = '[ 'AttrGet]
type AttrSetTypeConstraint FileNewlineTypePropertyInfo = (~) ()
type AttrBaseTypeConstraint FileNewlineTypePropertyInfo = IsFile
type AttrGetType FileNewlineTypePropertyInfo = GtkSource.Enums.NewlineType
type AttrLabel FileNewlineTypePropertyInfo = "newline-type"
type AttrOrigin FileNewlineTypePropertyInfo = File
attrGet _ = getFileNewlineType
attrSet _ = undefined
attrConstruct _ = undefined
attrClear _ = undefined
#endif
getFileReadOnly :: (MonadIO m, IsFile o) => o -> m Bool
getFileReadOnly obj = liftIO $ B.Properties.getObjectPropertyBool obj "read-only"
#if ENABLE_OVERLOADING
data FileReadOnlyPropertyInfo
instance AttrInfo FileReadOnlyPropertyInfo where
type AttrAllowedOps FileReadOnlyPropertyInfo = '[ 'AttrGet]
type AttrSetTypeConstraint FileReadOnlyPropertyInfo = (~) ()
type AttrBaseTypeConstraint FileReadOnlyPropertyInfo = IsFile
type AttrGetType FileReadOnlyPropertyInfo = Bool
type AttrLabel FileReadOnlyPropertyInfo = "read-only"
type AttrOrigin FileReadOnlyPropertyInfo = File
attrGet _ = getFileReadOnly
attrSet _ = undefined
attrConstruct _ = undefined
attrClear _ = undefined
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList File
type instance O.AttributeList File = FileAttributeList
type FileAttributeList = ('[ '("compressionType", FileCompressionTypePropertyInfo), '("encoding", FileEncodingPropertyInfo), '("location", FileLocationPropertyInfo), '("newlineType", FileNewlineTypePropertyInfo), '("readOnly", FileReadOnlyPropertyInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
fileCompressionType :: AttrLabelProxy "compressionType"
fileCompressionType = AttrLabelProxy
fileEncoding :: AttrLabelProxy "encoding"
fileEncoding = AttrLabelProxy
fileLocation :: AttrLabelProxy "location"
fileLocation = AttrLabelProxy
fileNewlineType :: AttrLabelProxy "newlineType"
fileNewlineType = AttrLabelProxy
fileReadOnly :: AttrLabelProxy "readOnly"
fileReadOnly = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
type instance O.SignalList File = FileSignalList
type FileSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "gtk_source_file_new" gtk_source_file_new ::
IO (Ptr File)
fileNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
m File
fileNew = liftIO $ do
result <- gtk_source_file_new
checkUnexpectedReturnNULL "fileNew" result
result' <- (wrapObject File) result
return result'
#if ENABLE_OVERLOADING
#endif
foreign import ccall "gtk_source_file_check_file_on_disk" gtk_source_file_check_file_on_disk ::
Ptr File ->
IO ()
fileCheckFileOnDisk ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
a
-> m ()
fileCheckFileOnDisk file = liftIO $ do
file' <- unsafeManagedPtrCastPtr file
gtk_source_file_check_file_on_disk file'
touchManagedPtr file
return ()
#if ENABLE_OVERLOADING
data FileCheckFileOnDiskMethodInfo
instance (signature ~ (m ()), MonadIO m, IsFile a) => O.MethodInfo FileCheckFileOnDiskMethodInfo a signature where
overloadedMethod _ = fileCheckFileOnDisk
#endif
foreign import ccall "gtk_source_file_get_compression_type" gtk_source_file_get_compression_type ::
Ptr File ->
IO CUInt
fileGetCompressionType ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
a
-> m GtkSource.Enums.CompressionType
fileGetCompressionType file = liftIO $ do
file' <- unsafeManagedPtrCastPtr file
result <- gtk_source_file_get_compression_type file'
let result' = (toEnum . fromIntegral) result
touchManagedPtr file
return result'
#if ENABLE_OVERLOADING
data FileGetCompressionTypeMethodInfo
instance (signature ~ (m GtkSource.Enums.CompressionType), MonadIO m, IsFile a) => O.MethodInfo FileGetCompressionTypeMethodInfo a signature where
overloadedMethod _ = fileGetCompressionType
#endif
foreign import ccall "gtk_source_file_get_encoding" gtk_source_file_get_encoding ::
Ptr File ->
IO (Ptr GtkSource.Encoding.Encoding)
fileGetEncoding ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
a
-> m GtkSource.Encoding.Encoding
fileGetEncoding file = liftIO $ do
file' <- unsafeManagedPtrCastPtr file
result <- gtk_source_file_get_encoding file'
checkUnexpectedReturnNULL "fileGetEncoding" result
result' <- (newBoxed GtkSource.Encoding.Encoding) result
touchManagedPtr file
return result'
#if ENABLE_OVERLOADING
data FileGetEncodingMethodInfo
instance (signature ~ (m GtkSource.Encoding.Encoding), MonadIO m, IsFile a) => O.MethodInfo FileGetEncodingMethodInfo a signature where
overloadedMethod _ = fileGetEncoding
#endif
foreign import ccall "gtk_source_file_get_location" gtk_source_file_get_location ::
Ptr File ->
IO (Ptr Gio.File.File)
fileGetLocation ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
a
-> m Gio.File.File
fileGetLocation file = liftIO $ do
file' <- unsafeManagedPtrCastPtr file
result <- gtk_source_file_get_location file'
checkUnexpectedReturnNULL "fileGetLocation" result
result' <- (newObject Gio.File.File) result
touchManagedPtr file
return result'
#if ENABLE_OVERLOADING
data FileGetLocationMethodInfo
instance (signature ~ (m Gio.File.File), MonadIO m, IsFile a) => O.MethodInfo FileGetLocationMethodInfo a signature where
overloadedMethod _ = fileGetLocation
#endif
foreign import ccall "gtk_source_file_get_newline_type" gtk_source_file_get_newline_type ::
Ptr File ->
IO CUInt
fileGetNewlineType ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
a
-> m GtkSource.Enums.NewlineType
fileGetNewlineType file = liftIO $ do
file' <- unsafeManagedPtrCastPtr file
result <- gtk_source_file_get_newline_type file'
let result' = (toEnum . fromIntegral) result
touchManagedPtr file
return result'
#if ENABLE_OVERLOADING
data FileGetNewlineTypeMethodInfo
instance (signature ~ (m GtkSource.Enums.NewlineType), MonadIO m, IsFile a) => O.MethodInfo FileGetNewlineTypeMethodInfo a signature where
overloadedMethod _ = fileGetNewlineType
#endif
foreign import ccall "gtk_source_file_is_deleted" gtk_source_file_is_deleted ::
Ptr File ->
IO CInt
fileIsDeleted ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
a
-> m Bool
fileIsDeleted file = liftIO $ do
file' <- unsafeManagedPtrCastPtr file
result <- gtk_source_file_is_deleted file'
let result' = (/= 0) result
touchManagedPtr file
return result'
#if ENABLE_OVERLOADING
data FileIsDeletedMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsFile a) => O.MethodInfo FileIsDeletedMethodInfo a signature where
overloadedMethod _ = fileIsDeleted
#endif
foreign import ccall "gtk_source_file_is_externally_modified" gtk_source_file_is_externally_modified ::
Ptr File ->
IO CInt
fileIsExternallyModified ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
a
-> m Bool
fileIsExternallyModified file = liftIO $ do
file' <- unsafeManagedPtrCastPtr file
result <- gtk_source_file_is_externally_modified file'
let result' = (/= 0) result
touchManagedPtr file
return result'
#if ENABLE_OVERLOADING
data FileIsExternallyModifiedMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsFile a) => O.MethodInfo FileIsExternallyModifiedMethodInfo a signature where
overloadedMethod _ = fileIsExternallyModified
#endif
foreign import ccall "gtk_source_file_is_local" gtk_source_file_is_local ::
Ptr File ->
IO CInt
fileIsLocal ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
a
-> m Bool
fileIsLocal file = liftIO $ do
file' <- unsafeManagedPtrCastPtr file
result <- gtk_source_file_is_local file'
let result' = (/= 0) result
touchManagedPtr file
return result'
#if ENABLE_OVERLOADING
data FileIsLocalMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsFile a) => O.MethodInfo FileIsLocalMethodInfo a signature where
overloadedMethod _ = fileIsLocal
#endif
foreign import ccall "gtk_source_file_is_readonly" gtk_source_file_is_readonly ::
Ptr File ->
IO CInt
fileIsReadonly ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a) =>
a
-> m Bool
fileIsReadonly file = liftIO $ do
file' <- unsafeManagedPtrCastPtr file
result <- gtk_source_file_is_readonly file'
let result' = (/= 0) result
touchManagedPtr file
return result'
#if ENABLE_OVERLOADING
data FileIsReadonlyMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsFile a) => O.MethodInfo FileIsReadonlyMethodInfo a signature where
overloadedMethod _ = fileIsReadonly
#endif
foreign import ccall "gtk_source_file_set_location" gtk_source_file_set_location ::
Ptr File ->
Ptr Gio.File.File ->
IO ()
fileSetLocation ::
(B.CallStack.HasCallStack, MonadIO m, IsFile a, Gio.File.IsFile b) =>
a
-> Maybe (b)
-> m ()
fileSetLocation file location = liftIO $ do
file' <- unsafeManagedPtrCastPtr file
maybeLocation <- case location of
Nothing -> return nullPtr
Just jLocation -> do
jLocation' <- unsafeManagedPtrCastPtr jLocation
return jLocation'
gtk_source_file_set_location file' maybeLocation
touchManagedPtr file
whenJust location touchManagedPtr
return ()
#if ENABLE_OVERLOADING
data FileSetLocationMethodInfo
instance (signature ~ (Maybe (b) -> m ()), MonadIO m, IsFile a, Gio.File.IsFile b) => O.MethodInfo FileSetLocationMethodInfo a signature where
overloadedMethod _ = fileSetLocation
#endif