{- |
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.Gio.Objects.FileIcon
    ( 

-- * Exported types
    FileIcon(..)                            ,
    FileIconK                               ,
    toFileIcon                              ,
    noFileIcon                              ,


 -- * Methods
-- ** fileIconGetFile
    fileIconGetFile                         ,


-- ** fileIconNew
    fileIconNew                             ,




 -- * Properties
-- ** File
    FileIconFilePropertyInfo                ,
    constructFileIconFile                   ,
    getFileIconFile                         ,




    ) 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.Gio.Types
import GI.Gio.Callbacks
import qualified GI.GObject as GObject

newtype FileIcon = FileIcon (ForeignPtr FileIcon)
foreign import ccall "g_file_icon_get_type"
    c_g_file_icon_get_type :: IO GType

type instance ParentTypes FileIcon = FileIconParentTypes
type FileIconParentTypes = '[GObject.Object, Icon, LoadableIcon]

instance GObject FileIcon where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_g_file_icon_get_type
    

class GObject o => FileIconK o
instance (GObject o, IsDescendantOf FileIcon o) => FileIconK o

toFileIcon :: FileIconK o => o -> IO FileIcon
toFileIcon = unsafeCastTo FileIcon

noFileIcon :: Maybe FileIcon
noFileIcon = Nothing

-- VVV Prop "file"
   -- Type: TInterface "Gio" "File"
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]

getFileIconFile :: (MonadIO m, FileIconK o) => o -> m File
getFileIconFile obj = liftIO $ getObjectPropertyObject obj "file" File

constructFileIconFile :: (FileK a) => a -> IO ([Char], GValue)
constructFileIconFile val = constructObjectPropertyObject "file" val

data FileIconFilePropertyInfo
instance AttrInfo FileIconFilePropertyInfo where
    type AttrAllowedOps FileIconFilePropertyInfo = '[ 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint FileIconFilePropertyInfo = FileK
    type AttrBaseTypeConstraint FileIconFilePropertyInfo = FileIconK
    type AttrGetType FileIconFilePropertyInfo = File
    type AttrLabel FileIconFilePropertyInfo = "FileIcon::file"
    attrGet _ = getFileIconFile
    attrSet _ = undefined
    attrConstruct _ = constructFileIconFile

type instance AttributeList FileIcon = FileIconAttributeList
type FileIconAttributeList = ('[ '("file", FileIconFilePropertyInfo)] :: [(Symbol, *)])

type instance SignalList FileIcon = FileIconSignalList
type FileIconSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method FileIcon::new
-- method type : Constructor
-- Args : [Arg {argName = "file", argType = TInterface "Gio" "File", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "file", argType = TInterface "Gio" "File", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "FileIcon"
-- throws : False
-- Skip return : False

foreign import ccall "g_file_icon_new" g_file_icon_new :: 
    Ptr File ->                             -- file : TInterface "Gio" "File"
    IO (Ptr FileIcon)


fileIconNew ::
    (MonadIO m, FileK a) =>
    a ->                                    -- file
    m FileIcon
fileIconNew file = liftIO $ do
    let file' = unsafeManagedPtrCastPtr file
    result <- g_file_icon_new file'
    checkUnexpectedReturnNULL "g_file_icon_new" result
    result' <- (wrapObject FileIcon) result
    touchManagedPtr file
    return result'

-- method FileIcon::get_file
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "FileIcon", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "FileIcon", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "File"
-- throws : False
-- Skip return : False

foreign import ccall "g_file_icon_get_file" g_file_icon_get_file :: 
    Ptr FileIcon ->                         -- _obj : TInterface "Gio" "FileIcon"
    IO (Ptr File)


fileIconGetFile ::
    (MonadIO m, FileIconK a) =>
    a ->                                    -- _obj
    m File
fileIconGetFile _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_file_icon_get_file _obj'
    checkUnexpectedReturnNULL "g_file_icon_get_file" result
    result' <- (newObject File) result
    touchManagedPtr _obj
    return result'