module GI.Gio.Objects.ApplicationCommandLine
(
ApplicationCommandLine(..) ,
ApplicationCommandLineK ,
toApplicationCommandLine ,
noApplicationCommandLine ,
applicationCommandLineCreateFileForArg ,
applicationCommandLineGetArguments ,
applicationCommandLineGetCwd ,
applicationCommandLineGetEnviron ,
applicationCommandLineGetExitStatus ,
applicationCommandLineGetIsRemote ,
applicationCommandLineGetOptionsDict ,
applicationCommandLineGetPlatformData ,
applicationCommandLineGetStdin ,
applicationCommandLineGetenv ,
applicationCommandLineSetExitStatus ,
ApplicationCommandLineArgumentsPropertyInfo,
constructApplicationCommandLineArguments,
ApplicationCommandLineIsRemotePropertyInfo,
getApplicationCommandLineIsRemote ,
ApplicationCommandLineOptionsPropertyInfo,
constructApplicationCommandLineOptions ,
ApplicationCommandLinePlatformDataPropertyInfo,
constructApplicationCommandLinePlatformData,
) 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.GLib as GLib
import qualified GI.GObject as GObject
newtype ApplicationCommandLine = ApplicationCommandLine (ForeignPtr ApplicationCommandLine)
foreign import ccall "g_application_command_line_get_type"
c_g_application_command_line_get_type :: IO GType
type instance ParentTypes ApplicationCommandLine = ApplicationCommandLineParentTypes
type ApplicationCommandLineParentTypes = '[GObject.Object]
instance GObject ApplicationCommandLine where
gobjectIsInitiallyUnowned _ = False
gobjectType _ = c_g_application_command_line_get_type
class GObject o => ApplicationCommandLineK o
instance (GObject o, IsDescendantOf ApplicationCommandLine o) => ApplicationCommandLineK o
toApplicationCommandLine :: ApplicationCommandLineK o => o -> IO ApplicationCommandLine
toApplicationCommandLine = unsafeCastTo ApplicationCommandLine
noApplicationCommandLine :: Maybe ApplicationCommandLine
noApplicationCommandLine = Nothing
constructApplicationCommandLineArguments :: GVariant -> IO ([Char], GValue)
constructApplicationCommandLineArguments val = constructObjectPropertyVariant "arguments" val
data ApplicationCommandLineArgumentsPropertyInfo
instance AttrInfo ApplicationCommandLineArgumentsPropertyInfo where
type AttrAllowedOps ApplicationCommandLineArgumentsPropertyInfo = '[ 'AttrConstruct]
type AttrSetTypeConstraint ApplicationCommandLineArgumentsPropertyInfo = (~) GVariant
type AttrBaseTypeConstraint ApplicationCommandLineArgumentsPropertyInfo = ApplicationCommandLineK
type AttrGetType ApplicationCommandLineArgumentsPropertyInfo = ()
type AttrLabel ApplicationCommandLineArgumentsPropertyInfo = "ApplicationCommandLine::arguments"
attrGet _ = undefined
attrSet _ = undefined
attrConstruct _ = constructApplicationCommandLineArguments
getApplicationCommandLineIsRemote :: (MonadIO m, ApplicationCommandLineK o) => o -> m Bool
getApplicationCommandLineIsRemote obj = liftIO $ getObjectPropertyBool obj "is-remote"
data ApplicationCommandLineIsRemotePropertyInfo
instance AttrInfo ApplicationCommandLineIsRemotePropertyInfo where
type AttrAllowedOps ApplicationCommandLineIsRemotePropertyInfo = '[ 'AttrGet]
type AttrSetTypeConstraint ApplicationCommandLineIsRemotePropertyInfo = (~) ()
type AttrBaseTypeConstraint ApplicationCommandLineIsRemotePropertyInfo = ApplicationCommandLineK
type AttrGetType ApplicationCommandLineIsRemotePropertyInfo = Bool
type AttrLabel ApplicationCommandLineIsRemotePropertyInfo = "ApplicationCommandLine::is-remote"
attrGet _ = getApplicationCommandLineIsRemote
attrSet _ = undefined
attrConstruct _ = undefined
constructApplicationCommandLineOptions :: GVariant -> IO ([Char], GValue)
constructApplicationCommandLineOptions val = constructObjectPropertyVariant "options" val
data ApplicationCommandLineOptionsPropertyInfo
instance AttrInfo ApplicationCommandLineOptionsPropertyInfo where
type AttrAllowedOps ApplicationCommandLineOptionsPropertyInfo = '[ 'AttrConstruct]
type AttrSetTypeConstraint ApplicationCommandLineOptionsPropertyInfo = (~) GVariant
type AttrBaseTypeConstraint ApplicationCommandLineOptionsPropertyInfo = ApplicationCommandLineK
type AttrGetType ApplicationCommandLineOptionsPropertyInfo = ()
type AttrLabel ApplicationCommandLineOptionsPropertyInfo = "ApplicationCommandLine::options"
attrGet _ = undefined
attrSet _ = undefined
attrConstruct _ = constructApplicationCommandLineOptions
constructApplicationCommandLinePlatformData :: GVariant -> IO ([Char], GValue)
constructApplicationCommandLinePlatformData val = constructObjectPropertyVariant "platform-data" val
data ApplicationCommandLinePlatformDataPropertyInfo
instance AttrInfo ApplicationCommandLinePlatformDataPropertyInfo where
type AttrAllowedOps ApplicationCommandLinePlatformDataPropertyInfo = '[ 'AttrConstruct]
type AttrSetTypeConstraint ApplicationCommandLinePlatformDataPropertyInfo = (~) GVariant
type AttrBaseTypeConstraint ApplicationCommandLinePlatformDataPropertyInfo = ApplicationCommandLineK
type AttrGetType ApplicationCommandLinePlatformDataPropertyInfo = ()
type AttrLabel ApplicationCommandLinePlatformDataPropertyInfo = "ApplicationCommandLine::platform-data"
attrGet _ = undefined
attrSet _ = undefined
attrConstruct _ = constructApplicationCommandLinePlatformData
type instance AttributeList ApplicationCommandLine = ApplicationCommandLineAttributeList
type ApplicationCommandLineAttributeList = ('[ '("arguments", ApplicationCommandLineArgumentsPropertyInfo), '("is-remote", ApplicationCommandLineIsRemotePropertyInfo), '("options", ApplicationCommandLineOptionsPropertyInfo), '("platform-data", ApplicationCommandLinePlatformDataPropertyInfo)] :: [(Symbol, *)])
type instance SignalList ApplicationCommandLine = ApplicationCommandLineSignalList
type ApplicationCommandLineSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])
foreign import ccall "g_application_command_line_create_file_for_arg" g_application_command_line_create_file_for_arg ::
Ptr ApplicationCommandLine ->
CString ->
IO (Ptr File)
applicationCommandLineCreateFileForArg ::
(MonadIO m, ApplicationCommandLineK a) =>
a ->
T.Text ->
m File
applicationCommandLineCreateFileForArg _obj arg = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
arg' <- textToCString arg
result <- g_application_command_line_create_file_for_arg _obj' arg'
checkUnexpectedReturnNULL "g_application_command_line_create_file_for_arg" result
result' <- (wrapObject File) result
touchManagedPtr _obj
freeMem arg'
return result'
foreign import ccall "g_application_command_line_get_arguments" g_application_command_line_get_arguments ::
Ptr ApplicationCommandLine ->
Ptr Int32 ->
IO (Ptr CString)
applicationCommandLineGetArguments ::
(MonadIO m, ApplicationCommandLineK a) =>
a ->
m [T.Text]
applicationCommandLineGetArguments _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
argc <- allocMem :: IO (Ptr Int32)
result <- g_application_command_line_get_arguments _obj' argc
argc' <- peek argc
checkUnexpectedReturnNULL "g_application_command_line_get_arguments" result
result' <- (unpackUTF8CArrayWithLength argc') result
(mapCArrayWithLength argc') freeMem result
freeMem result
touchManagedPtr _obj
freeMem argc
return result'
foreign import ccall "g_application_command_line_get_cwd" g_application_command_line_get_cwd ::
Ptr ApplicationCommandLine ->
IO CString
applicationCommandLineGetCwd ::
(MonadIO m, ApplicationCommandLineK a) =>
a ->
m T.Text
applicationCommandLineGetCwd _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- g_application_command_line_get_cwd _obj'
checkUnexpectedReturnNULL "g_application_command_line_get_cwd" result
result' <- cstringToText result
touchManagedPtr _obj
return result'
foreign import ccall "g_application_command_line_get_environ" g_application_command_line_get_environ ::
Ptr ApplicationCommandLine ->
IO (Ptr CString)
applicationCommandLineGetEnviron ::
(MonadIO m, ApplicationCommandLineK a) =>
a ->
m [T.Text]
applicationCommandLineGetEnviron _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- g_application_command_line_get_environ _obj'
checkUnexpectedReturnNULL "g_application_command_line_get_environ" result
result' <- unpackZeroTerminatedUTF8CArray result
touchManagedPtr _obj
return result'
foreign import ccall "g_application_command_line_get_exit_status" g_application_command_line_get_exit_status ::
Ptr ApplicationCommandLine ->
IO Int32
applicationCommandLineGetExitStatus ::
(MonadIO m, ApplicationCommandLineK a) =>
a ->
m Int32
applicationCommandLineGetExitStatus _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- g_application_command_line_get_exit_status _obj'
touchManagedPtr _obj
return result
foreign import ccall "g_application_command_line_get_is_remote" g_application_command_line_get_is_remote ::
Ptr ApplicationCommandLine ->
IO CInt
applicationCommandLineGetIsRemote ::
(MonadIO m, ApplicationCommandLineK a) =>
a ->
m Bool
applicationCommandLineGetIsRemote _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- g_application_command_line_get_is_remote _obj'
let result' = (/= 0) result
touchManagedPtr _obj
return result'
foreign import ccall "g_application_command_line_get_options_dict" g_application_command_line_get_options_dict ::
Ptr ApplicationCommandLine ->
IO (Ptr GLib.VariantDict)
applicationCommandLineGetOptionsDict ::
(MonadIO m, ApplicationCommandLineK a) =>
a ->
m GLib.VariantDict
applicationCommandLineGetOptionsDict _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- g_application_command_line_get_options_dict _obj'
checkUnexpectedReturnNULL "g_application_command_line_get_options_dict" result
result' <- (newBoxed GLib.VariantDict) result
touchManagedPtr _obj
return result'
foreign import ccall "g_application_command_line_get_platform_data" g_application_command_line_get_platform_data ::
Ptr ApplicationCommandLine ->
IO (Ptr GVariant)
applicationCommandLineGetPlatformData ::
(MonadIO m, ApplicationCommandLineK a) =>
a ->
m GVariant
applicationCommandLineGetPlatformData _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- g_application_command_line_get_platform_data _obj'
checkUnexpectedReturnNULL "g_application_command_line_get_platform_data" result
result' <- wrapGVariantPtr result
touchManagedPtr _obj
return result'
foreign import ccall "g_application_command_line_get_stdin" g_application_command_line_get_stdin ::
Ptr ApplicationCommandLine ->
IO (Ptr InputStream)
applicationCommandLineGetStdin ::
(MonadIO m, ApplicationCommandLineK a) =>
a ->
m InputStream
applicationCommandLineGetStdin _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- g_application_command_line_get_stdin _obj'
checkUnexpectedReturnNULL "g_application_command_line_get_stdin" result
result' <- (wrapObject InputStream) result
touchManagedPtr _obj
return result'
foreign import ccall "g_application_command_line_getenv" g_application_command_line_getenv ::
Ptr ApplicationCommandLine ->
CString ->
IO CString
applicationCommandLineGetenv ::
(MonadIO m, ApplicationCommandLineK a) =>
a ->
T.Text ->
m T.Text
applicationCommandLineGetenv _obj name = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
name' <- textToCString name
result <- g_application_command_line_getenv _obj' name'
checkUnexpectedReturnNULL "g_application_command_line_getenv" result
result' <- cstringToText result
touchManagedPtr _obj
freeMem name'
return result'
foreign import ccall "g_application_command_line_set_exit_status" g_application_command_line_set_exit_status ::
Ptr ApplicationCommandLine ->
Int32 ->
IO ()
applicationCommandLineSetExitStatus ::
(MonadIO m, ApplicationCommandLineK a) =>
a ->
Int32 ->
m ()
applicationCommandLineSetExitStatus _obj exit_status = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
g_application_command_line_set_exit_status _obj' exit_status
touchManagedPtr _obj
return ()