    -- GENERATED by C->Haskell Compiler, version 0.13.13 (gtk2hs branch) "Bin IO", 27 May 2012 (Haskell)
    -- Edit the ORIGINAL .chs file instead!

    {-# LINE 1 "./System/Glib/Utils.chs" #-}
    -- -*-haskell-*-
    --  GIMP Toolkit (GTK) Miscellaneous utilities
    --
    --  Author : John Millikin
    --
    --  Created: 15 November 2009
    --
    --  Copyright (C) 2009 John Millikin
    --
    --  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 2.1 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.
    --
    -- |
    -- Maintainer  : gtk2hs-users@lists.sourceforge.net
    -- Stability   : provisional
    -- Portability : portable (depends on GHC)
    --
    -- This module binds GLib-specific utility procedures.
    --
    module System.Glib.Utils
      ( getApplicationName
      , setApplicationName
      , getProgramName
      , setProgramName
      ) where

    import System.Glib.FFI
    import System.Glib.UTFString

    {-# LINE 37 "./System/Glib/Utils.chs" #-}

    -- |
    -- Gets a human-readable name for the application, as set by
    -- 'setApplicationName'. This name should be localized if possible, and is
    -- intended for display to the user. Contrast with 'getProgramName', which
    -- gets a non-localized name. If 'setApplicationName' has not been performed,
    -- returns the result of 'getProgramName' (which may be 'Nothing' if
    -- 'setProgramName' has also not been performed).
    --
    getApplicationName :: GlibString string => IO (Maybe string)
    getApplicationName :: forall string. GlibString string => IO (Maybe string)
    getApplicationName = IO (Ptr CChar)
    g_get_application_name 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
    peekUTFString

    -- |
    -- Sets a human-readable name for the application. This name should be
    -- localized if possible, and is intended for display to the user. Contrast
    -- with 'setProgramName', which sets a non-localized name. 'setProgramName'
    -- will be performed automatically by 'initGUI', but 'setApplicationName'
    -- will not.
    --
    -- Note that for thread safety reasons, this computation can only be performed
    -- once.
    --
    -- The application name will be used in contexts such as error messages, or
    -- when displaying an application's name in the task list.
    --
    setApplicationName :: GlibString string => string -> IO ()
    setApplicationName :: forall string. GlibString string => string -> IO ()
    setApplicationName = (string -> (Ptr CChar -> IO ()) -> IO ())
    -> (Ptr CChar -> IO ()) -> string -> IO ()
    forall a b c. (a -> b -> c) -> b -> a -> c
    flip string -> (Ptr CChar -> IO ()) -> IO ()
    forall a. string -> (Ptr CChar -> IO a) -> IO a
    forall s a. GlibString s => s -> (Ptr CChar -> IO a) -> IO a
    withUTFString Ptr CChar -> IO ()
    g_set_application_name
    {-# LINE 64 "./System/Glib/Utils.chs" #-}

    -- |
    -- Gets the name of the program. This name should /not/ be localized, contrast
    -- with 'getApplicationName'. If you are using GDK or GTK+, the program name
    -- is set in 'initGUI' to the last component of argv[0].
    --
    getProgramName :: GlibString string => IO (Maybe string)
    getProgramName :: forall string. GlibString string => IO (Maybe string)
    getProgramName = IO (Ptr CChar)
    g_get_prgname 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
    peekUTFString

    -- |
    -- Sets the name of the program. This name should /not/ be localized, contrast
    -- with 'setApplicationName'. Note that for thread-safety reasons this
    -- computation can only be performed once.
    --
    setProgramName :: GlibString string => string -> IO ()
    setProgramName :: forall string. GlibString string => string -> IO ()
    setProgramName = (string -> (Ptr CChar -> IO ()) -> IO ())
    -> (Ptr CChar -> IO ()) -> string -> IO ()
    forall a b c. (a -> b -> c) -> b -> a -> c
    flip string -> (Ptr CChar -> IO ()) -> IO ()
    forall a. string -> (Ptr CChar -> IO a) -> IO a
    forall s a. GlibString s => s -> (Ptr CChar -> IO a) -> IO a
    withUTFString Ptr CChar -> IO ()
    g_set_prgname
    {-# LINE 80 "./System/Glib/Utils.chs" #-}

    foreign import ccall unsafe "g_get_application_name"
      g_get_application_name :: (IO (Ptr CChar))

    foreign import ccall unsafe "g_set_application_name"
      g_set_application_name :: ((Ptr CChar) -> (IO ()))

    foreign import ccall unsafe "g_get_prgname"
      g_get_prgname :: (IO (Ptr CChar))

    foreign import ccall unsafe "g_set_prgname"
      g_set_prgname :: ((Ptr CChar) -> (IO ()))