{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gio.Objects.FileIcon
(
FileIcon(..) ,
IsFileIcon ,
toFileIcon ,
#if defined(ENABLE_OVERLOADING)
ResolveFileIconMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
FileIconGetFileMethodInfo ,
#endif
fileIconGetFile ,
fileIconNew ,
#if defined(ENABLE_OVERLOADING)
FileIconFilePropertyInfo ,
#endif
constructFileIconFile ,
#if defined(ENABLE_OVERLOADING)
fileIconFile ,
#endif
getFileIconFile ,
) 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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
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 Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
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 GHC.Records as R
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gio.Interfaces.File as Gio.File
import {-# SOURCE #-} qualified GI.Gio.Interfaces.Icon as Gio.Icon
import {-# SOURCE #-} qualified GI.Gio.Interfaces.LoadableIcon as Gio.LoadableIcon
newtype FileIcon = FileIcon (SP.ManagedPtr FileIcon)
deriving (FileIcon -> FileIcon -> Bool
(FileIcon -> FileIcon -> Bool)
-> (FileIcon -> FileIcon -> Bool) -> Eq FileIcon
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FileIcon -> FileIcon -> Bool
$c/= :: FileIcon -> FileIcon -> Bool
== :: FileIcon -> FileIcon -> Bool
$c== :: FileIcon -> FileIcon -> Bool
Eq)
instance SP.ManagedPtrNewtype FileIcon where
toManagedPtr :: FileIcon -> ManagedPtr FileIcon
toManagedPtr (FileIcon ManagedPtr FileIcon
p) = ManagedPtr FileIcon
p
foreign import ccall "g_file_icon_get_type"
c_g_file_icon_get_type :: IO B.Types.GType
instance B.Types.TypedObject FileIcon where
glibType :: IO GType
glibType = IO GType
c_g_file_icon_get_type
instance B.Types.GObject FileIcon
class (SP.GObject o, O.IsDescendantOf FileIcon o) => IsFileIcon o
instance (SP.GObject o, O.IsDescendantOf FileIcon o) => IsFileIcon o
instance O.HasParentTypes FileIcon
type instance O.ParentTypes FileIcon = '[GObject.Object.Object, Gio.Icon.Icon, Gio.LoadableIcon.LoadableIcon]
toFileIcon :: (MIO.MonadIO m, IsFileIcon o) => o -> m FileIcon
toFileIcon :: forall (m :: * -> *) o.
(MonadIO m, IsFileIcon o) =>
o -> m FileIcon
toFileIcon = IO FileIcon -> m FileIcon
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO FileIcon -> m FileIcon)
-> (o -> IO FileIcon) -> o -> m FileIcon
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr FileIcon -> FileIcon) -> o -> IO FileIcon
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr FileIcon -> FileIcon
FileIcon
instance B.GValue.IsGValue (Maybe FileIcon) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_g_file_icon_get_type
gvalueSet_ :: Ptr GValue -> Maybe FileIcon -> IO ()
gvalueSet_ Ptr GValue
gv Maybe FileIcon
P.Nothing = Ptr GValue -> Ptr FileIcon -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr FileIcon
forall a. Ptr a
FP.nullPtr :: FP.Ptr FileIcon)
gvalueSet_ Ptr GValue
gv (P.Just FileIcon
obj) = FileIcon -> (Ptr FileIcon -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr FileIcon
obj (Ptr GValue -> Ptr FileIcon -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe FileIcon)
gvalueGet_ Ptr GValue
gv = do
Ptr FileIcon
ptr <- Ptr GValue -> IO (Ptr FileIcon)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr FileIcon)
if Ptr FileIcon
ptr Ptr FileIcon -> Ptr FileIcon -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr FileIcon
forall a. Ptr a
FP.nullPtr
then FileIcon -> Maybe FileIcon
forall a. a -> Maybe a
P.Just (FileIcon -> Maybe FileIcon) -> IO FileIcon -> IO (Maybe FileIcon)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr FileIcon -> FileIcon) -> Ptr FileIcon -> IO FileIcon
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr FileIcon -> FileIcon
FileIcon Ptr FileIcon
ptr
else Maybe FileIcon -> IO (Maybe FileIcon)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe FileIcon
forall a. Maybe a
P.Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveFileIconMethod (t :: Symbol) (o :: *) :: * where
ResolveFileIconMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveFileIconMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveFileIconMethod "equal" o = Gio.Icon.IconEqualMethodInfo
ResolveFileIconMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveFileIconMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveFileIconMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveFileIconMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveFileIconMethod "load" o = Gio.LoadableIcon.LoadableIconLoadMethodInfo
ResolveFileIconMethod "loadAsync" o = Gio.LoadableIcon.LoadableIconLoadAsyncMethodInfo
ResolveFileIconMethod "loadFinish" o = Gio.LoadableIcon.LoadableIconLoadFinishMethodInfo
ResolveFileIconMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveFileIconMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveFileIconMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveFileIconMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveFileIconMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveFileIconMethod "serialize" o = Gio.Icon.IconSerializeMethodInfo
ResolveFileIconMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveFileIconMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveFileIconMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveFileIconMethod "toString" o = Gio.Icon.IconToStringMethodInfo
ResolveFileIconMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveFileIconMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveFileIconMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveFileIconMethod "getFile" o = FileIconGetFileMethodInfo
ResolveFileIconMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveFileIconMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveFileIconMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveFileIconMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveFileIconMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveFileIconMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveFileIconMethod t FileIcon, O.OverloadedMethod info FileIcon p) => OL.IsLabel t (FileIcon -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveFileIconMethod t FileIcon, O.OverloadedMethod info FileIcon p, R.HasField t FileIcon p) => R.HasField t FileIcon p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveFileIconMethod t FileIcon, O.OverloadedMethodInfo info FileIcon) => OL.IsLabel t (O.MethodProxy info FileIcon) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
getFileIconFile :: (MonadIO m, IsFileIcon o) => o -> m Gio.File.File
getFileIconFile :: forall (m :: * -> *) o. (MonadIO m, IsFileIcon o) => o -> m File
getFileIconFile o
obj = IO File -> m File
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO File -> m File) -> IO File -> m File
forall a b. (a -> b) -> a -> b
$ Text -> IO (Maybe File) -> IO File
forall a. HasCallStack => Text -> IO (Maybe a) -> IO a
checkUnexpectedNothing Text
"getFileIconFile" (IO (Maybe File) -> IO File) -> IO (Maybe File) -> IO File
forall a b. (a -> b) -> a -> b
$ o -> String -> (ManagedPtr File -> File) -> IO (Maybe File)
forall a b.
(GObject a, GObject b) =>
a -> String -> (ManagedPtr b -> b) -> IO (Maybe b)
B.Properties.getObjectPropertyObject o
obj String
"file" ManagedPtr File -> File
Gio.File.File
constructFileIconFile :: (IsFileIcon o, MIO.MonadIO m, Gio.File.IsFile a) => a -> m (GValueConstruct o)
constructFileIconFile :: forall o (m :: * -> *) a.
(IsFileIcon o, MonadIO m, IsFile a) =>
a -> m (GValueConstruct o)
constructFileIconFile a
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ do
IO (GValueConstruct o) -> IO (GValueConstruct o)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
-> IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Maybe a -> IO (GValueConstruct o)
forall a o.
GObject a =>
String -> Maybe a -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyObject String
"file" (a -> Maybe a
forall a. a -> Maybe a
P.Just a
val)
#if defined(ENABLE_OVERLOADING)
data FileIconFilePropertyInfo
instance AttrInfo FileIconFilePropertyInfo where
type AttrAllowedOps FileIconFilePropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
type AttrBaseTypeConstraint FileIconFilePropertyInfo = IsFileIcon
type AttrSetTypeConstraint FileIconFilePropertyInfo = Gio.File.IsFile
type AttrTransferTypeConstraint FileIconFilePropertyInfo = Gio.File.IsFile
type AttrTransferType FileIconFilePropertyInfo = Gio.File.File
type AttrGetType FileIconFilePropertyInfo = Gio.File.File
type AttrLabel FileIconFilePropertyInfo = "file"
type AttrOrigin FileIconFilePropertyInfo = FileIcon
attrGet = getFileIconFile
attrSet = undefined
attrTransfer _ v = do
unsafeCastTo Gio.File.File v
attrConstruct = constructFileIconFile
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.FileIcon.file"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.29/docs/GI-Gio-Objects-FileIcon.html#g:attr:file"
})
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList FileIcon
type instance O.AttributeList FileIcon = FileIconAttributeList
type FileIconAttributeList = ('[ '("file", FileIconFilePropertyInfo)] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
fileIconFile :: AttrLabelProxy "file"
fileIconFile = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList FileIcon = FileIconSignalList
type FileIconSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "g_file_icon_new" g_file_icon_new ::
Ptr Gio.File.File ->
IO (Ptr FileIcon)
fileIconNew ::
(B.CallStack.HasCallStack, MonadIO m, Gio.File.IsFile a) =>
a
-> m FileIcon
fileIconNew :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsFile a) =>
a -> m FileIcon
fileIconNew a
file = IO FileIcon -> m FileIcon
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FileIcon -> m FileIcon) -> IO FileIcon -> m FileIcon
forall a b. (a -> b) -> a -> b
$ do
Ptr File
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
Ptr FileIcon
result <- Ptr File -> IO (Ptr FileIcon)
g_file_icon_new Ptr File
file'
Text -> Ptr FileIcon -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"fileIconNew" Ptr FileIcon
result
FileIcon
result' <- ((ManagedPtr FileIcon -> FileIcon) -> Ptr FileIcon -> IO FileIcon
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr FileIcon -> FileIcon
FileIcon) Ptr FileIcon
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
file
FileIcon -> IO FileIcon
forall (m :: * -> *) a. Monad m => a -> m a
return FileIcon
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_file_icon_get_file" g_file_icon_get_file ::
Ptr FileIcon ->
IO (Ptr Gio.File.File)
fileIconGetFile ::
(B.CallStack.HasCallStack, MonadIO m, IsFileIcon a) =>
a
-> m Gio.File.File
fileIconGetFile :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsFileIcon a) =>
a -> m File
fileIconGetFile a
icon = IO File -> m File
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO File -> m File) -> IO File -> m File
forall a b. (a -> b) -> a -> b
$ do
Ptr FileIcon
icon' <- a -> IO (Ptr FileIcon)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
icon
Ptr File
result <- Ptr FileIcon -> IO (Ptr File)
g_file_icon_get_file Ptr FileIcon
icon'
Text -> Ptr File -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"fileIconGetFile" Ptr File
result
File
result' <- ((ManagedPtr File -> File) -> Ptr File -> IO File
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr File -> File
Gio.File.File) Ptr File
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
icon
File -> IO File
forall (m :: * -> *) a. Monad m => a -> m a
return File
result'
#if defined(ENABLE_OVERLOADING)
data FileIconGetFileMethodInfo
instance (signature ~ (m Gio.File.File), MonadIO m, IsFileIcon a) => O.OverloadedMethod FileIconGetFileMethodInfo a signature where
overloadedMethod = fileIconGetFile
instance O.OverloadedMethodInfo FileIconGetFileMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.FileIcon.fileIconGetFile",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.29/docs/GI-Gio-Objects-FileIcon.html#v:fileIconGetFile"
})
#endif