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

-- * Exported types
    MountOperation(..)                      ,
    MountOperationK                         ,
    toMountOperation                        ,
    noMountOperation                        ,


 -- * Methods
-- ** mountOperationGetParent
    mountOperationGetParent                 ,


-- ** mountOperationGetScreen
    mountOperationGetScreen                 ,


-- ** mountOperationIsShowing
    mountOperationIsShowing                 ,


-- ** mountOperationNew
    mountOperationNew                       ,


-- ** mountOperationSetParent
    mountOperationSetParent                 ,


-- ** mountOperationSetScreen
    mountOperationSetScreen                 ,




 -- * Properties
-- ** IsShowing
    MountOperationIsShowingPropertyInfo     ,
    getMountOperationIsShowing              ,


-- ** Parent
    MountOperationParentPropertyInfo        ,
    constructMountOperationParent           ,
    getMountOperationParent                 ,
    setMountOperationParent                 ,


-- ** Screen
    MountOperationScreenPropertyInfo        ,
    constructMountOperationScreen           ,
    getMountOperationScreen                 ,
    setMountOperationScreen                 ,




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

newtype MountOperation = MountOperation (ForeignPtr MountOperation)
foreign import ccall "gtk_mount_operation_get_type"
    c_gtk_mount_operation_get_type :: IO GType

type instance ParentTypes MountOperation = MountOperationParentTypes
type MountOperationParentTypes = '[Gio.MountOperation, GObject.Object]

instance GObject MountOperation where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_gtk_mount_operation_get_type
    

class GObject o => MountOperationK o
instance (GObject o, IsDescendantOf MountOperation o) => MountOperationK o

toMountOperation :: MountOperationK o => o -> IO MountOperation
toMountOperation = unsafeCastTo MountOperation

noMountOperation :: Maybe MountOperation
noMountOperation = Nothing

-- VVV Prop "is-showing"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable]

getMountOperationIsShowing :: (MonadIO m, MountOperationK o) => o -> m Bool
getMountOperationIsShowing obj = liftIO $ getObjectPropertyBool obj "is-showing"

data MountOperationIsShowingPropertyInfo
instance AttrInfo MountOperationIsShowingPropertyInfo where
    type AttrAllowedOps MountOperationIsShowingPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint MountOperationIsShowingPropertyInfo = (~) ()
    type AttrBaseTypeConstraint MountOperationIsShowingPropertyInfo = MountOperationK
    type AttrGetType MountOperationIsShowingPropertyInfo = Bool
    type AttrLabel MountOperationIsShowingPropertyInfo = "MountOperation::is-showing"
    attrGet _ = getMountOperationIsShowing
    attrSet _ = undefined
    attrConstruct _ = undefined

-- VVV Prop "parent"
   -- Type: TInterface "Gtk" "Window"
   -- Flags: [PropertyReadable,PropertyWritable]

getMountOperationParent :: (MonadIO m, MountOperationK o) => o -> m Window
getMountOperationParent obj = liftIO $ getObjectPropertyObject obj "parent" Window

setMountOperationParent :: (MonadIO m, MountOperationK o, WindowK a) => o -> a -> m ()
setMountOperationParent obj val = liftIO $ setObjectPropertyObject obj "parent" val

constructMountOperationParent :: (WindowK a) => a -> IO ([Char], GValue)
constructMountOperationParent val = constructObjectPropertyObject "parent" val

data MountOperationParentPropertyInfo
instance AttrInfo MountOperationParentPropertyInfo where
    type AttrAllowedOps MountOperationParentPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint MountOperationParentPropertyInfo = WindowK
    type AttrBaseTypeConstraint MountOperationParentPropertyInfo = MountOperationK
    type AttrGetType MountOperationParentPropertyInfo = Window
    type AttrLabel MountOperationParentPropertyInfo = "MountOperation::parent"
    attrGet _ = getMountOperationParent
    attrSet _ = setMountOperationParent
    attrConstruct _ = constructMountOperationParent

-- VVV Prop "screen"
   -- Type: TInterface "Gdk" "Screen"
   -- Flags: [PropertyReadable,PropertyWritable]

getMountOperationScreen :: (MonadIO m, MountOperationK o) => o -> m Gdk.Screen
getMountOperationScreen obj = liftIO $ getObjectPropertyObject obj "screen" Gdk.Screen

setMountOperationScreen :: (MonadIO m, MountOperationK o, Gdk.ScreenK a) => o -> a -> m ()
setMountOperationScreen obj val = liftIO $ setObjectPropertyObject obj "screen" val

constructMountOperationScreen :: (Gdk.ScreenK a) => a -> IO ([Char], GValue)
constructMountOperationScreen val = constructObjectPropertyObject "screen" val

data MountOperationScreenPropertyInfo
instance AttrInfo MountOperationScreenPropertyInfo where
    type AttrAllowedOps MountOperationScreenPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint MountOperationScreenPropertyInfo = Gdk.ScreenK
    type AttrBaseTypeConstraint MountOperationScreenPropertyInfo = MountOperationK
    type AttrGetType MountOperationScreenPropertyInfo = Gdk.Screen
    type AttrLabel MountOperationScreenPropertyInfo = "MountOperation::screen"
    attrGet _ = getMountOperationScreen
    attrSet _ = setMountOperationScreen
    attrConstruct _ = constructMountOperationScreen

type instance AttributeList MountOperation = MountOperationAttributeList
type MountOperationAttributeList = ('[ '("anonymous", Gio.MountOperationAnonymousPropertyInfo), '("choice", Gio.MountOperationChoicePropertyInfo), '("domain", Gio.MountOperationDomainPropertyInfo), '("is-showing", MountOperationIsShowingPropertyInfo), '("parent", MountOperationParentPropertyInfo), '("password", Gio.MountOperationPasswordPropertyInfo), '("password-save", Gio.MountOperationPasswordSavePropertyInfo), '("screen", MountOperationScreenPropertyInfo), '("username", Gio.MountOperationUsernamePropertyInfo)] :: [(Symbol, *)])

type instance SignalList MountOperation = MountOperationSignalList
type MountOperationSignalList = ('[ '("aborted", Gio.MountOperationAbortedSignalInfo), '("ask-password", Gio.MountOperationAskPasswordSignalInfo), '("ask-question", Gio.MountOperationAskQuestionSignalInfo), '("notify", GObject.ObjectNotifySignalInfo), '("reply", Gio.MountOperationReplySignalInfo), '("show-processes", Gio.MountOperationShowProcessesSignalInfo), '("show-unmount-progress", Gio.MountOperationShowUnmountProgressSignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method MountOperation::new
-- method type : Constructor
-- Args : [Arg {argName = "parent", argType = TInterface "Gtk" "Window", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "parent", argType = TInterface "Gtk" "Window", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gtk" "MountOperation"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_mount_operation_new" gtk_mount_operation_new :: 
    Ptr Window ->                           -- parent : TInterface "Gtk" "Window"
    IO (Ptr MountOperation)


mountOperationNew ::
    (MonadIO m, WindowK a) =>
    Maybe (a) ->                            -- parent
    m MountOperation
mountOperationNew parent = liftIO $ do
    maybeParent <- case parent of
        Nothing -> return nullPtr
        Just jParent -> do
            let jParent' = unsafeManagedPtrCastPtr jParent
            return jParent'
    result <- gtk_mount_operation_new maybeParent
    checkUnexpectedReturnNULL "gtk_mount_operation_new" result
    result' <- (wrapObject MountOperation) result
    whenJust parent touchManagedPtr
    return result'

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

foreign import ccall "gtk_mount_operation_get_parent" gtk_mount_operation_get_parent :: 
    Ptr MountOperation ->                   -- _obj : TInterface "Gtk" "MountOperation"
    IO (Ptr Window)


mountOperationGetParent ::
    (MonadIO m, MountOperationK a) =>
    a ->                                    -- _obj
    m Window
mountOperationGetParent _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gtk_mount_operation_get_parent _obj'
    checkUnexpectedReturnNULL "gtk_mount_operation_get_parent" result
    result' <- (newObject Window) result
    touchManagedPtr _obj
    return result'

-- method MountOperation::get_screen
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "MountOperation", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "MountOperation", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gdk" "Screen"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_mount_operation_get_screen" gtk_mount_operation_get_screen :: 
    Ptr MountOperation ->                   -- _obj : TInterface "Gtk" "MountOperation"
    IO (Ptr Gdk.Screen)


mountOperationGetScreen ::
    (MonadIO m, MountOperationK a) =>
    a ->                                    -- _obj
    m Gdk.Screen
mountOperationGetScreen _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gtk_mount_operation_get_screen _obj'
    checkUnexpectedReturnNULL "gtk_mount_operation_get_screen" result
    result' <- (newObject Gdk.Screen) result
    touchManagedPtr _obj
    return result'

-- method MountOperation::is_showing
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "MountOperation", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "MountOperation", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gtk_mount_operation_is_showing" gtk_mount_operation_is_showing :: 
    Ptr MountOperation ->                   -- _obj : TInterface "Gtk" "MountOperation"
    IO CInt


mountOperationIsShowing ::
    (MonadIO m, MountOperationK a) =>
    a ->                                    -- _obj
    m Bool
mountOperationIsShowing _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gtk_mount_operation_is_showing _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

-- method MountOperation::set_parent
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "MountOperation", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "parent", argType = TInterface "Gtk" "Window", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "MountOperation", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "parent", argType = TInterface "Gtk" "Window", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gtk_mount_operation_set_parent" gtk_mount_operation_set_parent :: 
    Ptr MountOperation ->                   -- _obj : TInterface "Gtk" "MountOperation"
    Ptr Window ->                           -- parent : TInterface "Gtk" "Window"
    IO ()


mountOperationSetParent ::
    (MonadIO m, MountOperationK a, WindowK b) =>
    a ->                                    -- _obj
    Maybe (b) ->                            -- parent
    m ()
mountOperationSetParent _obj parent = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeParent <- case parent of
        Nothing -> return nullPtr
        Just jParent -> do
            let jParent' = unsafeManagedPtrCastPtr jParent
            return jParent'
    gtk_mount_operation_set_parent _obj' maybeParent
    touchManagedPtr _obj
    whenJust parent touchManagedPtr
    return ()

-- method MountOperation::set_screen
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "MountOperation", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "screen", argType = TInterface "Gdk" "Screen", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "MountOperation", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "screen", argType = TInterface "Gdk" "Screen", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gtk_mount_operation_set_screen" gtk_mount_operation_set_screen :: 
    Ptr MountOperation ->                   -- _obj : TInterface "Gtk" "MountOperation"
    Ptr Gdk.Screen ->                       -- screen : TInterface "Gdk" "Screen"
    IO ()


mountOperationSetScreen ::
    (MonadIO m, MountOperationK a, Gdk.ScreenK b) =>
    a ->                                    -- _obj
    b ->                                    -- screen
    m ()
mountOperationSetScreen _obj screen = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let screen' = unsafeManagedPtrCastPtr screen
    gtk_mount_operation_set_screen _obj' screen'
    touchManagedPtr _obj
    touchManagedPtr screen
    return ()