{-# LINE 2 "./System/GIO/Volumes/Mount.chs" #-}
-- GIMP Toolkit (GTK) Binding for Haskell: binding to gio -*-haskell-*-
--
-- Author : Andy Stewart
-- Created: 30-Apirl-2010
--
-- Copyright (c) 2010 Andy Stewart
--
-- This library is free software: you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public License
-- as published by the Free Software Foundation, either version 3 of
-- the License, or (at your option) any later version.
--
-- This library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public
-- License along with this program. If not, see
-- <http:
--
-- GIO, the C library which this Haskell library depends on, is
-- available under LGPL Version 2. The documentation included with
-- this library is based on the original GIO documentation.
--
-- | Maintainer : gtk2hs-devel@lists.sourceforge.net
-- Stability : alpha
-- Portability : portable (depends on GHC)
module System.GIO.Volumes.Mount (
-- * Details
--
-- | The 'Mount' interface represents user-visible mounts. Note, when porting from GnomeVFS, 'Mount' is the
-- moral equivalent of GnomeVFSVolume.
--
-- 'Mount' is a "mounted" filesystem that you can access. Mounted is in quotes because it's not the same
-- as a 1 mount, it might be a gvfs mount, but you can still access the files on it if you use
-- GIO. Might or might not be related to a volume object.
--
-- Unmounting a 'Mount' instance is an asynchronous operation. For more information about asynchronous
-- operations, see 'AsyncReady' and GSimpleAsyncReady. To unmount a 'Mount' instance, first call
-- 'mountUnmountWithOperation' the 'Mount' instance and a 'AsyncReadyCallback'. The
-- callback will be fired when the operation has resolved (either with success or failure), and a
-- 'AsyncReady' structure will be passed to the callback. That callback should then call
-- 'mountUnmountWithOperationFinish' with the 'Mount' and the 'AsyncReady' data to see if the
-- operation was completed successfully. If an error is present when
-- 'mountUnmountWithOperationFinish' is called, then it will be filled with any error
-- information.

-- * Types
    Mount(..),
    MountClass,

-- * Methods
    mountGetName,
    mountGetUUID,
    mountGetIcon,
    mountGetDrive,
    mountGetRoot,
    mountGetVolume,

    mountGetDefaultLocation,

    mountCanUnmount,

    mountUnmountWithOperation,
    mountUnmountWithOperationFinish,

    mountRemount,
    mountRemountFinish,
    mountCanEject,

    mountEjectWithOperation,
    mountEjectWithOperationFinish,


    mountGuessContentType,
    mountGuessContentTypeFinish,
    mountGuessContentTypeSync,


    mountIsShadowed,
    mountShadow,
    mountUnshadow,


-- * Signals
    mountChanged,

    mountPreUnmount,

    mountUnmounted,
    ) where

import Control.Monad
import Data.Maybe (fromMaybe)
import System.GIO.Enums
import System.Glib.Attributes
import System.Glib.FFI
import System.Glib.Flags
import System.Glib.GError
import System.Glib.GList
import System.Glib.GObject
import System.Glib.Properties
import System.Glib.Signals
import System.Glib.UTFString
import System.GIO.Async.AsyncResult
{-# LINE 108 "./System/GIO/Volumes/Mount.chs" #-}
import System.GIO.Signals
{-# LINE 109 "./System/GIO/Volumes/Mount.chs" #-}
import System.GIO.Types
{-# LINE 110 "./System/GIO/Volumes/Mount.chs" #-}


{-# LINE 112 "./System/GIO/Volumes/Mount.chs" #-}

--------------------
-- Methods
-- | Gets the name of mount.
mountGetName :: (MountClass mount, GlibString string) => mount
 -> IO string -- ^ returns the name for the given mount.
mountGetName :: forall mount string.
(MountClass mount, GlibString string) =>
mount -> IO string
mountGetName mount
mount =
  (\(Mount ForeignPtr Mount
arg1) -> ForeignPtr Mount -> (Ptr Mount -> IO (Ptr CChar)) -> IO (Ptr CChar)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Mount
arg1 ((Ptr Mount -> IO (Ptr CChar)) -> IO (Ptr CChar))
-> (Ptr Mount -> IO (Ptr CChar)) -> IO (Ptr CChar)
forall a b. (a -> b) -> a -> b
$ \Ptr Mount
argPtr1 ->Ptr Mount -> IO (Ptr CChar)
g_mount_get_name Ptr Mount
argPtr1) (mount -> Mount
forall o. MountClass o => o -> Mount
toMount mount
mount)
  IO (Ptr CChar) -> (Ptr CChar -> IO string) -> IO string
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Ptr CChar -> IO string
forall s. GlibString s => Ptr CChar -> IO s
readUTFString

-- | Gets the UUID for the mount. The reference is typically based on the file system UUID for the mount
-- in question and should be considered an opaque string. Returns 'Nothing' if there is no UUID available.
mountGetUUID :: (MountClass mount, GlibString string) => mount
 -> IO (Maybe string) -- ^ returns the UUID for mount or 'Nothing' if no UUID can be computed.
mountGetUUID :: forall mount string.
(MountClass mount, GlibString string) =>
mount -> IO (Maybe string)
mountGetUUID mount
mount = do
  (\(Mount ForeignPtr Mount
arg1) -> ForeignPtr Mount -> (Ptr Mount -> IO (Ptr CChar)) -> IO (Ptr CChar)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Mount
arg1 ((Ptr Mount -> IO (Ptr CChar)) -> IO (Ptr CChar))
-> (Ptr Mount -> IO (Ptr CChar)) -> IO (Ptr CChar)
forall a b. (a -> b) -> a -> b
$ \Ptr Mount
argPtr1 ->Ptr Mount -> IO (Ptr CChar)
g_mount_get_uuid Ptr Mount
argPtr1) (mount -> Mount
forall o. MountClass o => o -> Mount
toMount mount
mount)
  IO (Ptr CChar)
-> (Ptr CChar -> IO (Maybe string)) -> IO (Maybe string)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (Ptr CChar -> IO string) -> Ptr CChar -> IO (Maybe string)
forall a b. (Ptr a -> IO b) -> Ptr a -> IO (Maybe b)
maybePeek Ptr CChar -> IO string
forall s. GlibString s => Ptr CChar -> IO s
readUTFString

-- | Gets the icon for mount.
mountGetIcon :: MountClass mount => mount
 -> IO Icon -- ^ returns a 'Icon'.
mountGetIcon :: forall mount. MountClass mount => mount -> IO Icon
mountGetIcon mount
mount =
  (ForeignPtr Icon -> Icon, FinalizerPtr Icon)
-> IO (Ptr Icon) -> IO Icon
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
wrapNewGObject (ForeignPtr Icon -> Icon, FinalizerPtr Icon)
forall {a}. (ForeignPtr Icon -> Icon, FinalizerPtr a)
mkIcon (IO (Ptr Icon) -> IO Icon) -> IO (Ptr Icon) -> IO Icon
forall a b. (a -> b) -> a -> b
$
  (\(Mount ForeignPtr Mount
arg1) -> ForeignPtr Mount -> (Ptr Mount -> IO (Ptr Icon)) -> IO (Ptr Icon)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Mount
arg1 ((Ptr Mount -> IO (Ptr Icon)) -> IO (Ptr Icon))
-> (Ptr Mount -> IO (Ptr Icon)) -> IO (Ptr Icon)
forall a b. (a -> b) -> a -> b
$ \Ptr Mount
argPtr1 ->Ptr Mount -> IO (Ptr Icon)
g_mount_get_icon Ptr Mount
argPtr1) (mount -> Mount
forall o. MountClass o => o -> Mount
toMount mount
mount)

-- | Gets the drive for the mount.
--
-- This is a convenience method for getting the 'Volume' and then using that object to get the 'Drive'.
mountGetDrive :: MountClass mount => mount
 -> IO (Maybe Drive) -- ^ returns the 'Drive' for mount or 'Nothing' if no 'Drive' can be computed.
mountGetDrive :: forall mount. MountClass mount => mount -> IO (Maybe Drive)
mountGetDrive mount
mount =
  (IO (Ptr Drive) -> IO Drive) -> IO (Ptr Drive) -> IO (Maybe Drive)
forall a. (IO (Ptr a) -> IO a) -> IO (Ptr a) -> IO (Maybe a)
maybeNull ((ForeignPtr Drive -> Drive, FinalizerPtr Drive)
-> IO (Ptr Drive) -> IO Drive
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
wrapNewGObject (ForeignPtr Drive -> Drive, FinalizerPtr Drive)
forall {a}. (ForeignPtr Drive -> Drive, FinalizerPtr a)
mkDrive) (IO (Ptr Drive) -> IO (Maybe Drive))
-> IO (Ptr Drive) -> IO (Maybe Drive)
forall a b. (a -> b) -> a -> b
$
  (\(Mount ForeignPtr Mount
arg1) -> ForeignPtr Mount -> (Ptr Mount -> IO (Ptr Drive)) -> IO (Ptr Drive)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Mount
arg1 ((Ptr Mount -> IO (Ptr Drive)) -> IO (Ptr Drive))
-> (Ptr Mount -> IO (Ptr Drive)) -> IO (Ptr Drive)
forall a b. (a -> b) -> a -> b
$ \Ptr Mount
argPtr1 ->Ptr Mount -> IO (Ptr Drive)
g_mount_get_drive Ptr Mount
argPtr1) (mount -> Mount
forall o. MountClass o => o -> Mount
toMount mount
mount)

-- | Gets the root directory on mount.
mountGetRoot :: MountClass mount => mount
 -> IO File
mountGetRoot :: forall mount. MountClass mount => mount -> IO File
mountGetRoot mount
mount =
  (ForeignPtr File -> File, FinalizerPtr File)
-> IO (Ptr File) -> IO File
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
wrapNewGObject (ForeignPtr File -> File, FinalizerPtr File)
forall {a}. (ForeignPtr File -> File, FinalizerPtr a)
mkFile (IO (Ptr File) -> IO File) -> IO (Ptr File) -> IO File
forall a b. (a -> b) -> a -> b
$
  (\(Mount ForeignPtr Mount
arg1) -> ForeignPtr Mount -> (Ptr Mount -> IO (Ptr File)) -> IO (Ptr File)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Mount
arg1 ((Ptr Mount -> IO (Ptr File)) -> IO (Ptr File))
-> (Ptr Mount -> IO (Ptr File)) -> IO (Ptr File)
forall a b. (a -> b) -> a -> b
$ \Ptr Mount
argPtr1 ->Ptr Mount -> IO (Ptr File)
g_mount_get_root Ptr Mount
argPtr1) (mount -> Mount
forall o. MountClass o => o -> Mount
toMount mount
mount)

-- | Gets the volume directory on mount.
mountGetVolume :: MountClass mount => mount
 -> IO (Maybe Volume) -- ^ returns a 'Volume' or 'Nothing' if mount is not associated with a volume.
mountGetVolume :: forall mount. MountClass mount => mount -> IO (Maybe Volume)
mountGetVolume mount
mount =
  (IO (Ptr Volume) -> IO Volume)
-> IO (Ptr Volume) -> IO (Maybe Volume)
forall a. (IO (Ptr a) -> IO a) -> IO (Ptr a) -> IO (Maybe a)
maybeNull ((ForeignPtr Volume -> Volume, FinalizerPtr Volume)
-> IO (Ptr Volume) -> IO Volume
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
wrapNewGObject (ForeignPtr Volume -> Volume, FinalizerPtr Volume)
forall {a}. (ForeignPtr Volume -> Volume, FinalizerPtr a)
mkVolume) (IO (Ptr Volume) -> IO (Maybe Volume))
-> IO (Ptr Volume) -> IO (Maybe Volume)
forall a b. (a -> b) -> a -> b
$
  (\(Mount ForeignPtr Mount
arg1) -> ForeignPtr Mount
-> (Ptr Mount -> IO (Ptr Volume)) -> IO (Ptr Volume)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Mount
arg1 ((Ptr Mount -> IO (Ptr Volume)) -> IO (Ptr Volume))
-> (Ptr Mount -> IO (Ptr Volume)) -> IO (Ptr Volume)
forall a b. (a -> b) -> a -> b
$ \Ptr Mount
argPtr1 ->Ptr Mount -> IO (Ptr Volume)
g_mount_get_volume Ptr Mount
argPtr1) (mount -> Mount
forall o. MountClass o => o -> Mount
toMount mount
mount)


-- | Gets the default location of mount. The default location of the given mount is a path that reflects
-- the main entry point for the user (e.g. the home directory, or the root of the volume).
-- | Gets the root directory on mount.
mountGetDefaultLocation :: MountClass mount => mount
 -> IO File
mountGetDefaultLocation :: forall mount. MountClass mount => mount -> IO File
mountGetDefaultLocation mount
mount =
  (ForeignPtr File -> File, FinalizerPtr File)
-> IO (Ptr File) -> IO File
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
wrapNewGObject (ForeignPtr File -> File, FinalizerPtr File)
forall {a}. (ForeignPtr File -> File, FinalizerPtr a)
mkFile (IO (Ptr File) -> IO File) -> IO (Ptr File) -> IO File
forall a b. (a -> b) -> a -> b
$
  (\(Mount ForeignPtr Mount
arg1) -> ForeignPtr Mount -> (Ptr Mount -> IO (Ptr File)) -> IO (Ptr File)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Mount
arg1 ((Ptr Mount -> IO (Ptr File)) -> IO (Ptr File))
-> (Ptr Mount -> IO (Ptr File)) -> IO (Ptr File)
forall a b. (a -> b) -> a -> b
$ \Ptr Mount
argPtr1 ->Ptr Mount -> IO (Ptr File)
g_mount_get_default_location Ptr Mount
argPtr1) (mount -> Mount
forall o. MountClass o => o -> Mount
toMount mount
mount)


-- | Checks if mount can be mounted.
mountCanUnmount :: MountClass mount => mount
 -> IO Bool -- ^ returns 'True' if the mount can be unmounted.
mountCanUnmount :: forall mount. MountClass mount => mount -> IO Bool
mountCanUnmount mount
mount =
  (CInt -> Bool) -> IO CInt -> IO Bool
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM CInt -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (IO CInt -> IO Bool) -> IO CInt -> IO Bool
forall a b. (a -> b) -> a -> b
$
  (\(Mount ForeignPtr Mount
arg1) -> ForeignPtr Mount -> (Ptr Mount -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Mount
arg1 ((Ptr Mount -> IO CInt) -> IO CInt)
-> (Ptr Mount -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr Mount
argPtr1 ->Ptr Mount -> IO CInt
g_mount_can_unmount Ptr Mount
argPtr1) (mount -> Mount
forall o. MountClass o => o -> Mount
toMount mount
mount)


-- | Unmounts a mount. This is an asynchronous operation, and is finished by calling
-- 'mountUnmountWithOperationFinish' with the mount and 'AsyncResult' data returned in the
-- callback.
mountUnmountWithOperation :: MountClass mount
 => mount
 -> [MountUnmountFlags] -- ^ @flags@ flags affecting the unmount if required for eject
 -> Maybe MountOperation -- ^ @mountOperation@ a 'MountOperation' or 'Nothing' to avoid user interaction.
 -> Maybe Cancellable -- ^ @cancellable@ optional 'Cancellable' object, 'Nothing' to ignore.
 -> AsyncReadyCallback -- ^ @callback@ a 'AsyncReadyCallback'
 -> IO ()
mountUnmountWithOperation :: forall mount.
MountClass mount =>
mount
-> [MountUnmountFlags]
-> Maybe MountOperation
-> Maybe Cancellable
-> AsyncReadyCallback
-> IO ()
mountUnmountWithOperation mount
mount [MountUnmountFlags]
flags Maybe MountOperation
mountOperation Maybe Cancellable
cancellable AsyncReadyCallback
callback = do
      GAsyncReadyCallback
cCallback <- AsyncReadyCallback -> IO GAsyncReadyCallback
marshalAsyncReadyCallback AsyncReadyCallback
callback
      (\(Mount ForeignPtr Mount
arg1) CInt
arg2 (MountOperation ForeignPtr MountOperation
arg3) (Cancellable ForeignPtr Cancellable
arg4) GAsyncReadyCallback
arg5 Ptr ()
arg6 -> ForeignPtr Mount -> (Ptr Mount -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Mount
arg1 ((Ptr Mount -> IO ()) -> IO ()) -> (Ptr Mount -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Mount
argPtr1 ->ForeignPtr MountOperation -> (Ptr MountOperation -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr MountOperation
arg3 ((Ptr MountOperation -> IO ()) -> IO ())
-> (Ptr MountOperation -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr MountOperation
argPtr3 ->ForeignPtr Cancellable -> (Ptr Cancellable -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Cancellable
arg4 ((Ptr Cancellable -> IO ()) -> IO ())
-> (Ptr Cancellable -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Cancellable
argPtr4 ->Ptr Mount
-> CInt
-> Ptr MountOperation
-> Ptr Cancellable
-> GAsyncReadyCallback
-> Ptr ()
-> IO ()
g_mount_unmount_with_operation Ptr Mount
argPtr1 CInt
arg2 Ptr MountOperation
argPtr3 Ptr Cancellable
argPtr4 GAsyncReadyCallback
arg5 Ptr ()
arg6)
{-# LINE 192 "./System/GIO/Volumes/Mount.chs" #-}
        (mount -> Mount
forall o. MountClass o => o -> Mount
toMount mount
mount)
        ((Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt)
-> ([MountUnmountFlags] -> Int) -> [MountUnmountFlags] -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [MountUnmountFlags] -> Int
forall a. Flags a => [a] -> Int
fromFlags) [MountUnmountFlags]
flags)
        (MountOperation -> Maybe MountOperation -> MountOperation
forall a. a -> Maybe a -> a
fromMaybe (ForeignPtr MountOperation -> MountOperation
MountOperation ForeignPtr MountOperation
forall a. ForeignPtr a
nullForeignPtr) Maybe MountOperation
mountOperation)
        (Cancellable -> Maybe Cancellable -> Cancellable
forall a. a -> Maybe a -> a
fromMaybe (ForeignPtr Cancellable -> Cancellable
Cancellable ForeignPtr Cancellable
forall a. ForeignPtr a
nullForeignPtr) Maybe Cancellable
cancellable)
        GAsyncReadyCallback
cCallback
        (GAsyncReadyCallback -> Ptr ()
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr GAsyncReadyCallback
cCallback)

-- | Finishes unmounting a mount. If any errors occurred during the operation, error will be set to
-- contain the errors and 'False' will be returned.
--
-- Throws a 'GError' if an error occurs.
mountUnmountWithOperationFinish :: MountClass mount
 => mount
 -> AsyncResult -- ^ @result@ a 'AsyncResult'.
 -> IO ()
mountUnmountWithOperationFinish :: forall mount. MountClass mount => mount -> AsyncResult -> IO ()
mountUnmountWithOperationFinish mount
mount AsyncResult
result =
    (Ptr (Ptr ()) -> IO ()) -> IO ()
forall a. (Ptr (Ptr ()) -> IO a) -> IO a
propagateGError (\Ptr (Ptr ())
gErrorPtr -> do
                       (\(Mount ForeignPtr Mount
arg1) (AsyncResult ForeignPtr AsyncResult
arg2) Ptr (Ptr ())
arg3 -> ForeignPtr Mount -> (Ptr Mount -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Mount
arg1 ((Ptr Mount -> IO CInt) -> IO CInt)
-> (Ptr Mount -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr Mount
argPtr1 ->ForeignPtr AsyncResult -> (Ptr AsyncResult -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr AsyncResult
arg2 ((Ptr AsyncResult -> IO CInt) -> IO CInt)
-> (Ptr AsyncResult -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr AsyncResult
argPtr2 ->Ptr Mount -> Ptr AsyncResult -> Ptr (Ptr ()) -> IO CInt
g_mount_unmount_with_operation_finish Ptr Mount
argPtr1 Ptr AsyncResult
argPtr2 Ptr (Ptr ())
arg3)
{-# LINE 210 "./System/GIO/Volumes/Mount.chs" #-}
                          (mount -> Mount
forall o. MountClass o => o -> Mount
toMount mount
mount)
                          AsyncResult
result
                          Ptr (Ptr ())
gErrorPtr
                       () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ())


-- | Remounts a mount. This is an asynchronous operation, and is finished by calling
-- 'mountRemountFinish' with the mount and 'AsyncResult's data returned in the callback.
--
-- Remounting is useful when some setting affecting the operation of the volume has been changed, as
-- these may need a remount to take affect. While this is semantically equivalent with unmounting and
-- then remounting not all backends might need to actually be unmounted.
mountRemount :: MountClass mount
 => mount
 -> [MountMountFlags] -- ^ @flags@ flags affecting the unmount if required for eject
 -> Maybe MountOperation -- ^ @mountOperation@ a 'MountOperation' or 'Nothing' to avoid user interaction.
 -> Maybe Cancellable -- ^ @cancellable@ optional 'Cancellable' object, 'Nothing' to ignore.
 -> AsyncReadyCallback -- ^ @callback@ a 'AsyncReadyCallback'
 -> IO ()
mountRemount :: forall mount.
MountClass mount =>
mount
-> [MountMountFlags]
-> Maybe MountOperation
-> Maybe Cancellable
-> AsyncReadyCallback
-> IO ()
mountRemount mount
mount [MountMountFlags]
flags Maybe MountOperation
mountOperation Maybe Cancellable
cancellable AsyncReadyCallback
callback = do
      GAsyncReadyCallback
cCallback <- AsyncReadyCallback -> IO GAsyncReadyCallback
marshalAsyncReadyCallback AsyncReadyCallback
callback
      (\(Mount ForeignPtr Mount
arg1) CInt
arg2 (MountOperation ForeignPtr MountOperation
arg3) (Cancellable ForeignPtr Cancellable
arg4) GAsyncReadyCallback
arg5 Ptr ()
arg6 -> ForeignPtr Mount -> (Ptr Mount -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Mount
arg1 ((Ptr Mount -> IO ()) -> IO ()) -> (Ptr Mount -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Mount
argPtr1 ->ForeignPtr MountOperation -> (Ptr MountOperation -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr MountOperation
arg3 ((Ptr MountOperation -> IO ()) -> IO ())
-> (Ptr MountOperation -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr MountOperation
argPtr3 ->ForeignPtr Cancellable -> (Ptr Cancellable -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Cancellable
arg4 ((Ptr Cancellable -> IO ()) -> IO ())
-> (Ptr Cancellable -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Cancellable
argPtr4 ->Ptr Mount
-> CInt
-> Ptr MountOperation
-> Ptr Cancellable
-> GAsyncReadyCallback
-> Ptr ()
-> IO ()
g_mount_remount Ptr Mount
argPtr1 CInt
arg2 Ptr MountOperation
argPtr3 Ptr Cancellable
argPtr4 GAsyncReadyCallback
arg5 Ptr ()
arg6)
{-# LINE 232 "./System/GIO/Volumes/Mount.chs" #-}
        (mount -> Mount
forall o. MountClass o => o -> Mount
toMount mount
mount)
        ((Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt)
-> ([MountMountFlags] -> Int) -> [MountMountFlags] -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [MountMountFlags] -> Int
forall a. Flags a => [a] -> Int
fromFlags) [MountMountFlags]
flags)
        (MountOperation -> Maybe MountOperation -> MountOperation
forall a. a -> Maybe a -> a
fromMaybe (ForeignPtr MountOperation -> MountOperation
MountOperation ForeignPtr MountOperation
forall a. ForeignPtr a
nullForeignPtr) Maybe MountOperation
mountOperation)
        (Cancellable -> Maybe Cancellable -> Cancellable
forall a. a -> Maybe a -> a
fromMaybe (ForeignPtr Cancellable -> Cancellable
Cancellable ForeignPtr Cancellable
forall a. ForeignPtr a
nullForeignPtr) Maybe Cancellable
cancellable)
        GAsyncReadyCallback
cCallback
        (GAsyncReadyCallback -> Ptr ()
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr GAsyncReadyCallback
cCallback)

-- | Finishes remounting a mount. If any errors occurred during the operation, error will be set to
-- contain the errors and 'False' will be returned.
--
-- Throws a 'GError' if an error occurs.
mountRemountFinish :: MountClass mount
 => mount
 -> AsyncResult -- ^ @result@ a 'AsyncResult'.
 -> IO ()
mountRemountFinish :: forall mount. MountClass mount => mount -> AsyncResult -> IO ()
mountRemountFinish mount
mount AsyncResult
result =
    (Ptr (Ptr ()) -> IO ()) -> IO ()
forall a. (Ptr (Ptr ()) -> IO a) -> IO a
propagateGError (\Ptr (Ptr ())
gErrorPtr -> do
                        (\(Mount ForeignPtr Mount
arg1) (AsyncResult ForeignPtr AsyncResult
arg2) Ptr (Ptr ())
arg3 -> ForeignPtr Mount -> (Ptr Mount -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Mount
arg1 ((Ptr Mount -> IO CInt) -> IO CInt)
-> (Ptr Mount -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr Mount
argPtr1 ->ForeignPtr AsyncResult -> (Ptr AsyncResult -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr AsyncResult
arg2 ((Ptr AsyncResult -> IO CInt) -> IO CInt)
-> (Ptr AsyncResult -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr AsyncResult
argPtr2 ->Ptr Mount -> Ptr AsyncResult -> Ptr (Ptr ()) -> IO CInt
g_mount_remount_finish Ptr Mount
argPtr1 Ptr AsyncResult
argPtr2 Ptr (Ptr ())
arg3)
{-# LINE 250 "./System/GIO/Volumes/Mount.chs" #-}
                           (mount -> Mount
forall o. MountClass o => o -> Mount
toMount mount
mount)
                           AsyncResult
result
                           Ptr (Ptr ())
gErrorPtr
                        () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ())

-- | Checks if mount can be eject.
mountCanEject :: MountClass mount => mount
 -> IO Bool -- ^ returns 'True' if the mount can be ejected.
mountCanEject :: forall mount. MountClass mount => mount -> IO Bool
mountCanEject mount
mount =
  (CInt -> Bool) -> IO CInt -> IO Bool
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM CInt -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (IO CInt -> IO Bool) -> IO CInt -> IO Bool
forall a b. (a -> b) -> a -> b
$
  (\(Mount ForeignPtr Mount
arg1) -> ForeignPtr Mount -> (Ptr Mount -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Mount
arg1 ((Ptr Mount -> IO CInt) -> IO CInt)
-> (Ptr Mount -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr Mount
argPtr1 ->Ptr Mount -> IO CInt
g_mount_can_eject Ptr Mount
argPtr1) (mount -> Mount
forall o. MountClass o => o -> Mount
toMount mount
mount)


-- | Ejects a mount. This is an asynchronous operation, and is finished by calling
-- 'mountEjectWithOperationFinish' with the mount and 'AsyncResult' data returned in the callback.
mountEjectWithOperation :: MountClass mount
 => mount
 -> [MountUnmountFlags] -- ^ @flags@ flags affecting the unmount if required for eject
 -> Maybe MountOperation -- ^ @mountOperation@ a 'MountOperation' or 'Nothing' to avoid user interaction.
 -> Maybe Cancellable -- ^ @cancellable@ optional 'Cancellable' object, 'Nothing' to ignore.
 -> AsyncReadyCallback -- ^ @callback@ a 'AsyncReadyCallback'
 -> IO ()
mountEjectWithOperation :: forall mount.
MountClass mount =>
mount
-> [MountUnmountFlags]
-> Maybe MountOperation
-> Maybe Cancellable
-> AsyncReadyCallback
-> IO ()
mountEjectWithOperation mount
mount [MountUnmountFlags]
flags Maybe MountOperation
mountOperation Maybe Cancellable
cancellable AsyncReadyCallback
callback = do
      GAsyncReadyCallback
cCallback <- AsyncReadyCallback -> IO GAsyncReadyCallback
marshalAsyncReadyCallback AsyncReadyCallback
callback
      (\(Mount ForeignPtr Mount
arg1) CInt
arg2 (MountOperation ForeignPtr MountOperation
arg3) (Cancellable ForeignPtr Cancellable
arg4) GAsyncReadyCallback
arg5 Ptr ()
arg6 -> ForeignPtr Mount -> (Ptr Mount -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Mount
arg1 ((Ptr Mount -> IO ()) -> IO ()) -> (Ptr Mount -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Mount
argPtr1 ->ForeignPtr MountOperation -> (Ptr MountOperation -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr MountOperation
arg3 ((Ptr MountOperation -> IO ()) -> IO ())
-> (Ptr MountOperation -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr MountOperation
argPtr3 ->ForeignPtr Cancellable -> (Ptr Cancellable -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Cancellable
arg4 ((Ptr Cancellable -> IO ()) -> IO ())
-> (Ptr Cancellable -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Cancellable
argPtr4 ->Ptr Mount
-> CInt
-> Ptr MountOperation
-> Ptr Cancellable
-> GAsyncReadyCallback
-> Ptr ()
-> IO ()
g_mount_eject_with_operation Ptr Mount
argPtr1 CInt
arg2 Ptr MountOperation
argPtr3 Ptr Cancellable
argPtr4 GAsyncReadyCallback
arg5 Ptr ()
arg6)
{-# LINE 275 "./System/GIO/Volumes/Mount.chs" #-}
        (mount -> Mount
forall o. MountClass o => o -> Mount
toMount mount
mount)
        ((Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt)
-> ([MountUnmountFlags] -> Int) -> [MountUnmountFlags] -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [MountUnmountFlags] -> Int
forall a. Flags a => [a] -> Int
fromFlags) [MountUnmountFlags]
flags)
        (MountOperation -> Maybe MountOperation -> MountOperation
forall a. a -> Maybe a -> a
fromMaybe (ForeignPtr MountOperation -> MountOperation
MountOperation ForeignPtr MountOperation
forall a. ForeignPtr a
nullForeignPtr) Maybe MountOperation
mountOperation)
        (Cancellable -> Maybe Cancellable -> Cancellable
forall a. a -> Maybe a -> a
fromMaybe (ForeignPtr Cancellable -> Cancellable
Cancellable ForeignPtr Cancellable
forall a. ForeignPtr a
nullForeignPtr) Maybe Cancellable
cancellable)
        GAsyncReadyCallback
cCallback
        (GAsyncReadyCallback -> Ptr ()
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr GAsyncReadyCallback
cCallback)

-- | Finishes ejecting a mount. If any errors occurred during the operation.
--
-- Throws a 'GError' if an error occurs.
mountEjectWithOperationFinish :: MountClass mount
 => mount
 -> AsyncResult -- ^ @result@ a 'AsyncResult'.
 -> IO ()
mountEjectWithOperationFinish :: forall mount. MountClass mount => mount -> AsyncResult -> IO ()
mountEjectWithOperationFinish mount
mount AsyncResult
result =
    (Ptr (Ptr ()) -> IO ()) -> IO ()
forall a. (Ptr (Ptr ()) -> IO a) -> IO a
propagateGError (\Ptr (Ptr ())
gErrorPtr -> do
                        (\(Mount ForeignPtr Mount
arg1) (AsyncResult ForeignPtr AsyncResult
arg2) Ptr (Ptr ())
arg3 -> ForeignPtr Mount -> (Ptr Mount -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Mount
arg1 ((Ptr Mount -> IO CInt) -> IO CInt)
-> (Ptr Mount -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr Mount
argPtr1 ->ForeignPtr AsyncResult -> (Ptr AsyncResult -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr AsyncResult
arg2 ((Ptr AsyncResult -> IO CInt) -> IO CInt)
-> (Ptr AsyncResult -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr AsyncResult
argPtr2 ->Ptr Mount -> Ptr AsyncResult -> Ptr (Ptr ()) -> IO CInt
g_mount_eject_with_operation_finish Ptr Mount
argPtr1 Ptr AsyncResult
argPtr2 Ptr (Ptr ())
arg3)
{-# LINE 292 "./System/GIO/Volumes/Mount.chs" #-}
                            (mount -> Mount
forall o. MountClass o => o -> Mount
toMount mount
mount)
                            AsyncResult
result
                            Ptr (Ptr ())
gErrorPtr
                        () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ())



-- | Tries to guess the type of content stored on mount. Returns one or more textual identifiers of
-- well-known content types (typically prefixed with \"x-content/\"), e.g. x-content/image-dcf for camera
-- memory cards. See the shared-mime-info specification for more on x-content types.
--
-- This is an asynchronous operation (see 'mountGuessContentTypeSync' for the synchronous
-- version), and is finished by calling 'mountGuessContentTypeFinish' with the mount and
-- 'AsyncResult' data returned in the callback.
mountGuessContentType :: MountClass mount => mount
 -> Bool -- ^ @forceRescan@ Whether to force a rescan of the content. Otherwise a cached result will be used if available
 -> Maybe Cancellable -- ^ @cancellable@ optional 'Cancellable' object, 'Nothing' to ignore
 -> AsyncReadyCallback -- ^ @callback@ a 'AsyncReadyCallback'
 -> IO ()
mountGuessContentType :: forall mount.
MountClass mount =>
mount -> Bool -> Maybe Cancellable -> AsyncReadyCallback -> IO ()
mountGuessContentType mount
mount Bool
forceRescan Maybe Cancellable
cancellable AsyncReadyCallback
callback = do
      GAsyncReadyCallback
cCallback <- AsyncReadyCallback -> IO GAsyncReadyCallback
marshalAsyncReadyCallback AsyncReadyCallback
callback
      (\(Mount ForeignPtr Mount
arg1) CInt
arg2 (Cancellable ForeignPtr Cancellable
arg3) GAsyncReadyCallback
arg4 Ptr ()
arg5 -> ForeignPtr Mount -> (Ptr Mount -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Mount
arg1 ((Ptr Mount -> IO ()) -> IO ()) -> (Ptr Mount -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Mount
argPtr1 ->ForeignPtr Cancellable -> (Ptr Cancellable -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Cancellable
arg3 ((Ptr Cancellable -> IO ()) -> IO ())
-> (Ptr Cancellable -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Cancellable
argPtr3 ->Ptr Mount
-> CInt
-> Ptr Cancellable
-> GAsyncReadyCallback
-> Ptr ()
-> IO ()
g_mount_guess_content_type Ptr Mount
argPtr1 CInt
arg2 Ptr Cancellable
argPtr3 GAsyncReadyCallback
arg4 Ptr ()
arg5)
{-# LINE 314 "./System/GIO/Volumes/Mount.chs" #-}
        (mount -> Mount
forall o. MountClass o => o -> Mount
toMount mount
mount)
        (Bool -> CInt
forall a. Num a => Bool -> a
fromBool Bool
forceRescan)
        (Cancellable -> Maybe Cancellable -> Cancellable
forall a. a -> Maybe a -> a
fromMaybe (ForeignPtr Cancellable -> Cancellable
Cancellable ForeignPtr Cancellable
forall a. ForeignPtr a
nullForeignPtr) Maybe Cancellable
cancellable)
        GAsyncReadyCallback
cCallback
        (GAsyncReadyCallback -> Ptr ()
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr GAsyncReadyCallback
cCallback)

-- | Finishes guessing content types of mount. If any errors occurred during the operation, error will be
-- set to contain the errors and 'False' will be returned. In particular, you may get an
-- 'IoErrorNotSupported' if the mount does not support content guessing.
mountGuessContentTypeFinish :: (MountClass mount, GlibString string) => mount
 -> AsyncResult -- ^ @result@ a 'AsyncResult'.
 -> IO [string] -- ^ returns 'True' if the mount was successfully ejected. 'False' otherwise.
mountGuessContentTypeFinish :: forall mount string.
(MountClass mount, GlibString string) =>
mount -> AsyncResult -> IO [string]
mountGuessContentTypeFinish mount
mount AsyncResult
result =
    (Ptr (Ptr ()) -> IO (Ptr (Ptr CChar))) -> IO (Ptr (Ptr CChar))
forall a. (Ptr (Ptr ()) -> IO a) -> IO a
propagateGError ((\(Mount ForeignPtr Mount
arg1) (AsyncResult ForeignPtr AsyncResult
arg2) Ptr (Ptr ())
arg3 -> ForeignPtr Mount
-> (Ptr Mount -> IO (Ptr (Ptr CChar))) -> IO (Ptr (Ptr CChar))
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Mount
arg1 ((Ptr Mount -> IO (Ptr (Ptr CChar))) -> IO (Ptr (Ptr CChar)))
-> (Ptr Mount -> IO (Ptr (Ptr CChar))) -> IO (Ptr (Ptr CChar))
forall a b. (a -> b) -> a -> b
$ \Ptr Mount
argPtr1 ->ForeignPtr AsyncResult
-> (Ptr AsyncResult -> IO (Ptr (Ptr CChar)))
-> IO (Ptr (Ptr CChar))
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr AsyncResult
arg2 ((Ptr AsyncResult -> IO (Ptr (Ptr CChar))) -> IO (Ptr (Ptr CChar)))
-> (Ptr AsyncResult -> IO (Ptr (Ptr CChar)))
-> IO (Ptr (Ptr CChar))
forall a b. (a -> b) -> a -> b
$ \Ptr AsyncResult
argPtr2 ->Ptr Mount
-> Ptr AsyncResult -> Ptr (Ptr ()) -> IO (Ptr (Ptr CChar))
g_mount_guess_content_type_finish Ptr Mount
argPtr1 Ptr AsyncResult
argPtr2 Ptr (Ptr ())
arg3) (mount -> Mount
forall o. MountClass o => o -> Mount
toMount mount
mount) AsyncResult
result)
    IO (Ptr (Ptr CChar))
-> (Ptr (Ptr CChar) -> IO [string]) -> IO [string]
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Ptr (Ptr CChar) -> IO [string]
forall s. GlibString s => Ptr (Ptr CChar) -> IO [s]
readUTFStringArray0

-- | Tries to guess the type of content stored on mount. Returns one or more textual identifiers of
-- well-known content types (typically prefixed with \"x-content/\"), e.g. x-content/image-dcf for camera
-- memory cards. See the shared-mime-info specification for more on x-content types.
--
-- This is an synchronous operation and as such may block doing IO; see 'mountGuessContentType'
-- for the asynchronous version.
mountGuessContentTypeSync :: (MountClass mount, GlibString string) => mount
 -> Bool -- ^ @forceRescan@ Whether to force a rescan of the content. Otherwise a cached result will be used if available
 -> Maybe Cancellable -- ^ @cancellable@ optional 'Cancellable' object, 'Nothing' to ignore
 -> IO [string]
mountGuessContentTypeSync :: forall mount string.
(MountClass mount, GlibString string) =>
mount -> Bool -> Maybe Cancellable -> IO [string]
mountGuessContentTypeSync mount
mount Bool
forceRescan Maybe Cancellable
cancellable =
    (Ptr (Ptr ()) -> IO (Ptr (Ptr CChar))) -> IO (Ptr (Ptr CChar))
forall a. (Ptr (Ptr ()) -> IO a) -> IO a
propagateGError ((\(Mount ForeignPtr Mount
arg1) CInt
arg2 (Cancellable ForeignPtr Cancellable
arg3) Ptr (Ptr ())
arg4 -> ForeignPtr Mount
-> (Ptr Mount -> IO (Ptr (Ptr CChar))) -> IO (Ptr (Ptr CChar))
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Mount
arg1 ((Ptr Mount -> IO (Ptr (Ptr CChar))) -> IO (Ptr (Ptr CChar)))
-> (Ptr Mount -> IO (Ptr (Ptr CChar))) -> IO (Ptr (Ptr CChar))
forall a b. (a -> b) -> a -> b
$ \Ptr Mount
argPtr1 ->ForeignPtr Cancellable
-> (Ptr Cancellable -> IO (Ptr (Ptr CChar)))
-> IO (Ptr (Ptr CChar))
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Cancellable
arg3 ((Ptr Cancellable -> IO (Ptr (Ptr CChar))) -> IO (Ptr (Ptr CChar)))
-> (Ptr Cancellable -> IO (Ptr (Ptr CChar)))
-> IO (Ptr (Ptr CChar))
forall a b. (a -> b) -> a -> b
$ \Ptr Cancellable
argPtr3 ->Ptr Mount
-> CInt -> Ptr Cancellable -> Ptr (Ptr ()) -> IO (Ptr (Ptr CChar))
g_mount_guess_content_type_sync Ptr Mount
argPtr1 CInt
arg2 Ptr Cancellable
argPtr3 Ptr (Ptr ())
arg4)
{-# LINE 342 "./System/GIO/Volumes/Mount.chs" #-}
                       (mount -> Mount
forall o. MountClass o => o -> Mount
toMount mount
mount)
                       (Bool -> CInt
forall a. Num a => Bool -> a
fromBool Bool
forceRescan)
                       (Cancellable -> Maybe Cancellable -> Cancellable
forall a. a -> Maybe a -> a
fromMaybe (ForeignPtr Cancellable -> Cancellable
Cancellable ForeignPtr Cancellable
forall a. ForeignPtr a
nullForeignPtr) Maybe Cancellable
cancellable)
                    )
    IO (Ptr (Ptr CChar))
-> (Ptr (Ptr CChar) -> IO [string]) -> IO [string]
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Ptr (Ptr CChar) -> IO [string]
forall s. GlibString s => Ptr (Ptr CChar) -> IO [s]
readUTFStringArray0



-- | Determines if mount is shadowed. Applications or libraries should avoid displaying mount in the user
-- interface if it is shadowed.
--
-- A mount is said to be shadowed if there exists one or more user visible objects (currently 'Mount'
-- objects) with a root that is inside the root of mount.
--
-- One application of shadow mounts is when exposing a single file system that is used to address
-- several logical volumes. In this situation, a 'VolumeMonitor' implementation would create two 'Volume'
-- objects (for example, one for the camera functionality of the device and one for a SD card reader on
-- the device) with activation URIs gphoto2:
-- gphoto2:
-- mounted, said 'VolumeMonitor' implementation would create two 'Mount' objects (each with their root
-- matching the corresponding volume activation root) that would shadow the original mount.
--
-- The proxy monitor in GVfs 2.26 and later, automatically creates and manage shadow mounts (and
-- shadows the underlying mount) if the activation root on a 'Volume' is set.
mountIsShadowed :: MountClass mount => mount
 -> IO Bool -- ^ returns 'True' if mount is shadowed.
mountIsShadowed :: forall mount. MountClass mount => mount -> IO Bool
mountIsShadowed mount
mount =
  (CInt -> Bool) -> IO CInt -> IO Bool
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM CInt -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (IO CInt -> IO Bool) -> IO CInt -> IO Bool
forall a b. (a -> b) -> a -> b
$
  (\(Mount ForeignPtr Mount
arg1) -> ForeignPtr Mount -> (Ptr Mount -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Mount
arg1 ((Ptr Mount -> IO CInt) -> IO CInt)
-> (Ptr Mount -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr Mount
argPtr1 ->Ptr Mount -> IO CInt
g_mount_is_shadowed Ptr Mount
argPtr1) (mount -> Mount
forall o. MountClass o => o -> Mount
toMount mount
mount)

-- | Increments the shadow count on mount. Usually used by 'VolumeMonitor' implementations when creating a
-- shadow mount for mount, see 'mountIsShadowed' for more information. The caller will need to emit
-- the "changed" signal on mount manually.
mountShadow :: MountClass mount => mount -> IO ()
mountShadow :: forall mount. MountClass mount => mount -> IO ()
mountShadow mount
mount =
  (\(Mount ForeignPtr Mount
arg1) -> ForeignPtr Mount -> (Ptr Mount -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Mount
arg1 ((Ptr Mount -> IO ()) -> IO ()) -> (Ptr Mount -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Mount
argPtr1 ->Ptr Mount -> IO ()
g_mount_shadow Ptr Mount
argPtr1) (mount -> Mount
forall o. MountClass o => o -> Mount
toMount mount
mount)

-- | Decrements the shadow count on mount. Usually used by 'VolumeMonitor' implementations when destroying
-- a shadow mount for mount, see 'mountIsShadowed' for more information. The caller will need to
-- emit the "changed" signal on mount manually.
mountUnshadow :: MountClass mount => mount -> IO ()
mountUnshadow :: forall mount. MountClass mount => mount -> IO ()
mountUnshadow mount
mount =
  (\(Mount ForeignPtr Mount
arg1) -> ForeignPtr Mount -> (Ptr Mount -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Mount
arg1 ((Ptr Mount -> IO ()) -> IO ()) -> (Ptr Mount -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Mount
argPtr1 ->Ptr Mount -> IO ()
g_mount_unshadow Ptr Mount
argPtr1) (mount -> Mount
forall o. MountClass o => o -> Mount
toMount mount
mount)


--------------------
-- Signals
-- | Emitted when the mount has been changed.
mountChanged :: MountClass mount => Signal mount (IO ())
mountChanged :: forall mount. MountClass mount => Signal mount (IO ())
mountChanged = (Bool -> mount -> IO () -> IO (ConnectId mount))
-> Signal mount (IO ())
forall object handler.
(Bool -> object -> handler -> IO (ConnectId object))
-> Signal object handler
Signal (SignalName -> Bool -> mount -> IO () -> IO (ConnectId mount)
forall obj.
GObjectClass obj =>
SignalName -> Bool -> obj -> IO () -> IO (ConnectId obj)
connect_NONE__NONE SignalName
"changed")


-- | This signal is emitted when the 'Mount' is about to be unmounted.
mountPreUnmount :: MountClass mount => Signal mount (IO ())
mountPreUnmount :: forall mount. MountClass mount => Signal mount (IO ())
mountPreUnmount = (Bool -> mount -> IO () -> IO (ConnectId mount))
-> Signal mount (IO ())
forall object handler.
(Bool -> object -> handler -> IO (ConnectId object))
-> Signal object handler
Signal (SignalName -> Bool -> mount -> IO () -> IO (ConnectId mount)
forall obj.
GObjectClass obj =>
SignalName -> Bool -> obj -> IO () -> IO (ConnectId obj)
connect_NONE__NONE SignalName
"pre-unmount")


-- | This signal is emitted when the 'Mount' have been unmounted. If the recipient is holding references
-- to the object they should release them so the object can be finalized.
mountUnmounted :: MountClass mount => Signal mount (IO ())
mountUnmounted :: forall mount. MountClass mount => Signal mount (IO ())
mountUnmounted = (Bool -> mount -> IO () -> IO (ConnectId mount))
-> Signal mount (IO ())
forall object handler.
(Bool -> object -> handler -> IO (ConnectId object))
-> Signal object handler
Signal (SignalName -> Bool -> mount -> IO () -> IO (ConnectId mount)
forall obj.
GObjectClass obj =>
SignalName -> Bool -> obj -> IO () -> IO (ConnectId obj)
connect_NONE__NONE SignalName
"unmounted")

foreign import ccall safe "g_mount_get_name"
  g_mount_get_name :: ((Ptr Mount) -> (IO (Ptr CChar)))

foreign import ccall safe "g_mount_get_uuid"
  g_mount_get_uuid :: ((Ptr Mount) -> (IO (Ptr CChar)))

foreign import ccall safe "g_mount_get_icon"
  g_mount_get_icon :: ((Ptr Mount) -> (IO (Ptr Icon)))

foreign import ccall safe "g_mount_get_drive"
  g_mount_get_drive :: ((Ptr Mount) -> (IO (Ptr Drive)))

foreign import ccall safe "g_mount_get_root"
  g_mount_get_root :: ((Ptr Mount) -> (IO (Ptr File)))

foreign import ccall safe "g_mount_get_volume"
  g_mount_get_volume :: ((Ptr Mount) -> (IO (Ptr Volume)))

foreign import ccall safe "g_mount_get_default_location"
  g_mount_get_default_location :: ((Ptr Mount) -> (IO (Ptr File)))

foreign import ccall safe "g_mount_can_unmount"
  g_mount_can_unmount :: ((Ptr Mount) -> (IO CInt))

foreign import ccall safe "g_mount_unmount_with_operation"
  g_mount_unmount_with_operation :: ((Ptr Mount) -> (CInt -> ((Ptr MountOperation) -> ((Ptr Cancellable) -> ((FunPtr ((Ptr ()) -> ((Ptr AsyncResult) -> ((Ptr ()) -> (IO ()))))) -> ((Ptr ()) -> (IO ())))))))

foreign import ccall safe "g_mount_unmount_with_operation_finish"
  g_mount_unmount_with_operation_finish :: ((Ptr Mount) -> ((Ptr AsyncResult) -> ((Ptr (Ptr ())) -> (IO CInt))))

foreign import ccall safe "g_mount_remount"
  g_mount_remount :: ((Ptr Mount) -> (CInt -> ((Ptr MountOperation) -> ((Ptr Cancellable) -> ((FunPtr ((Ptr ()) -> ((Ptr AsyncResult) -> ((Ptr ()) -> (IO ()))))) -> ((Ptr ()) -> (IO ())))))))

foreign import ccall safe "g_mount_remount_finish"
  g_mount_remount_finish :: ((Ptr Mount) -> ((Ptr AsyncResult) -> ((Ptr (Ptr ())) -> (IO CInt))))

foreign import ccall safe "g_mount_can_eject"
  g_mount_can_eject :: ((Ptr Mount) -> (IO CInt))

foreign import ccall safe "g_mount_eject_with_operation"
  g_mount_eject_with_operation :: ((Ptr Mount) -> (CInt -> ((Ptr MountOperation) -> ((Ptr Cancellable) -> ((FunPtr ((Ptr ()) -> ((Ptr AsyncResult) -> ((Ptr ()) -> (IO ()))))) -> ((Ptr ()) -> (IO ())))))))

foreign import ccall safe "g_mount_eject_with_operation_finish"
  g_mount_eject_with_operation_finish :: ((Ptr Mount) -> ((Ptr AsyncResult) -> ((Ptr (Ptr ())) -> (IO CInt))))

foreign import ccall safe "g_mount_guess_content_type"
  g_mount_guess_content_type :: ((Ptr Mount) -> (CInt -> ((Ptr Cancellable) -> ((FunPtr ((Ptr ()) -> ((Ptr AsyncResult) -> ((Ptr ()) -> (IO ()))))) -> ((Ptr ()) -> (IO ()))))))

foreign import ccall safe "g_mount_guess_content_type_finish"
  g_mount_guess_content_type_finish :: ((Ptr Mount) -> ((Ptr AsyncResult) -> ((Ptr (Ptr ())) -> (IO (Ptr (Ptr CChar))))))

foreign import ccall safe "g_mount_guess_content_type_sync"
  g_mount_guess_content_type_sync :: ((Ptr Mount) -> (CInt -> ((Ptr Cancellable) -> ((Ptr (Ptr ())) -> (IO (Ptr (Ptr CChar)))))))

foreign import ccall safe "g_mount_is_shadowed"
  g_mount_is_shadowed :: ((Ptr Mount) -> (IO CInt))

foreign import ccall safe "g_mount_shadow"
  g_mount_shadow :: ((Ptr Mount) -> (IO ()))

foreign import ccall safe "g_mount_unshadow"
  g_mount_unshadow :: ((Ptr Mount) -> (IO ()))