{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)

'GI.Gio.Objects.ThemedIcon.ThemedIcon' is an implementation of 'GI.Gio.Interfaces.Icon.Icon' that supports icon themes.
'GI.Gio.Objects.ThemedIcon.ThemedIcon' contains a list of all of the icons present in an icon
theme, so that icons can be looked up quickly. 'GI.Gio.Objects.ThemedIcon.ThemedIcon' does
not provide actual pixmaps for icons, just the icon names.
Ideally something like @/gtk_icon_theme_choose_icon()/@ should be used to
resolve the list of names so that fallback icons work nicely with
themes that inherit other themes.
-}

#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
       && !defined(__HADDOCK_VERSION__))

module GI.Gio.Objects.ThemedIcon
    (

-- * Exported types
    ThemedIcon(..)                          ,
    IsThemedIcon                            ,
    toThemedIcon                            ,
    noThemedIcon                            ,


 -- * Methods
-- ** appendName #method:appendName#

#if ENABLE_OVERLOADING
    ThemedIconAppendNameMethodInfo          ,
#endif
    themedIconAppendName                    ,


-- ** getNames #method:getNames#

#if ENABLE_OVERLOADING
    ThemedIconGetNamesMethodInfo            ,
#endif
    themedIconGetNames                      ,


-- ** new #method:new#

    themedIconNew                           ,


-- ** newFromNames #method:newFromNames#

    themedIconNewFromNames                  ,


-- ** newWithDefaultFallbacks #method:newWithDefaultFallbacks#

    themedIconNewWithDefaultFallbacks       ,


-- ** prependName #method:prependName#

#if ENABLE_OVERLOADING
    ThemedIconPrependNameMethodInfo         ,
#endif
    themedIconPrependName                   ,




 -- * Properties
-- ** name #attr:name#
{- | The icon name.
-}
#if ENABLE_OVERLOADING
    ThemedIconNamePropertyInfo              ,
#endif
    constructThemedIconName                 ,
#if ENABLE_OVERLOADING
    themedIconName                          ,
#endif


-- ** names #attr:names#
{- | A 'Nothing'-terminated array of icon names.
-}
#if ENABLE_OVERLOADING
    ThemedIconNamesPropertyInfo             ,
#endif
    constructThemedIconNames                ,
    getThemedIconNames                      ,
#if ENABLE_OVERLOADING
    themedIconNames                         ,
#endif


-- ** useDefaultFallbacks #attr:useDefaultFallbacks#
{- | Whether to use the default fallbacks found by shortening the icon name
at \'-\' characters. If the \"names\" array has more than one element,
ignores any past the first.

For example, if the icon name was \"gnome-dev-cdrom-audio\", the array
would become

=== /C code/
>
>{
>  "gnome-dev-cdrom-audio",
>  "gnome-dev-cdrom",
>  "gnome-dev",
>  "gnome",
>  NULL
>};

-}
#if ENABLE_OVERLOADING
    ThemedIconUseDefaultFallbacksPropertyInfo,
#endif
    constructThemedIconUseDefaultFallbacks  ,
    getThemedIconUseDefaultFallbacks        ,
#if ENABLE_OVERLOADING
    themedIconUseDefaultFallbacks           ,
#endif




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP

import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gio.Interfaces.Icon as Gio.Icon

-- | Memory-managed wrapper type.
newtype ThemedIcon = ThemedIcon (ManagedPtr ThemedIcon)
foreign import ccall "g_themed_icon_get_type"
    c_g_themed_icon_get_type :: IO GType

instance GObject ThemedIcon where
    gobjectType _ = c_g_themed_icon_get_type


-- | Type class for types which can be safely cast to `ThemedIcon`, for instance with `toThemedIcon`.
class GObject o => IsThemedIcon o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError ThemedIcon a) =>
    IsThemedIcon a
#endif
instance IsThemedIcon ThemedIcon
instance GObject.Object.IsObject ThemedIcon
instance Gio.Icon.IsIcon ThemedIcon

-- | Cast to `ThemedIcon`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toThemedIcon :: (MonadIO m, IsThemedIcon o) => o -> m ThemedIcon
toThemedIcon = liftIO . unsafeCastTo ThemedIcon

-- | A convenience alias for `Nothing` :: `Maybe` `ThemedIcon`.
noThemedIcon :: Maybe ThemedIcon
noThemedIcon = Nothing

#if ENABLE_OVERLOADING
type family ResolveThemedIconMethod (t :: Symbol) (o :: *) :: * where
    ResolveThemedIconMethod "appendName" o = ThemedIconAppendNameMethodInfo
    ResolveThemedIconMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveThemedIconMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveThemedIconMethod "equal" o = Gio.Icon.IconEqualMethodInfo
    ResolveThemedIconMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveThemedIconMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveThemedIconMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveThemedIconMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveThemedIconMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveThemedIconMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveThemedIconMethod "prependName" o = ThemedIconPrependNameMethodInfo
    ResolveThemedIconMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveThemedIconMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveThemedIconMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveThemedIconMethod "serialize" o = Gio.Icon.IconSerializeMethodInfo
    ResolveThemedIconMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveThemedIconMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveThemedIconMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveThemedIconMethod "toString" o = Gio.Icon.IconToStringMethodInfo
    ResolveThemedIconMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveThemedIconMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveThemedIconMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveThemedIconMethod "getNames" o = ThemedIconGetNamesMethodInfo
    ResolveThemedIconMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveThemedIconMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveThemedIconMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveThemedIconMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveThemedIconMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveThemedIconMethod t ThemedIcon, O.MethodInfo info ThemedIcon p) => O.IsLabelProxy t (ThemedIcon -> p) where
    fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveThemedIconMethod t ThemedIcon, O.MethodInfo info ThemedIcon p) => O.IsLabel t (ThemedIcon -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif

#endif

-- VVV Prop "name"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Nothing,Nothing)

{- |
Construct a `GValueConstruct` with valid value for the “@name@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructThemedIconName :: (IsThemedIcon o) => T.Text -> IO (GValueConstruct o)
constructThemedIconName val = constructObjectPropertyString "name" (Just val)

#if ENABLE_OVERLOADING
data ThemedIconNamePropertyInfo
instance AttrInfo ThemedIconNamePropertyInfo where
    type AttrAllowedOps ThemedIconNamePropertyInfo = '[ 'AttrConstruct, 'AttrClear]
    type AttrSetTypeConstraint ThemedIconNamePropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint ThemedIconNamePropertyInfo = IsThemedIcon
    type AttrGetType ThemedIconNamePropertyInfo = ()
    type AttrLabel ThemedIconNamePropertyInfo = "name"
    type AttrOrigin ThemedIconNamePropertyInfo = ThemedIcon
    attrGet _ = undefined
    attrSet _ = undefined
    attrConstruct _ = constructThemedIconName
    attrClear _ = undefined
#endif

-- VVV Prop "names"
   -- Type: TCArray True (-1) (-1) (TBasicType TUTF8)
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Just False,Nothing)

{- |
Get the value of the “@names@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' themedIcon #names
@
-}
getThemedIconNames :: (MonadIO m, IsThemedIcon o) => o -> m [T.Text]
getThemedIconNames obj = liftIO $ checkUnexpectedNothing "getThemedIconNames" $ getObjectPropertyStringArray obj "names"

{- |
Construct a `GValueConstruct` with valid value for the “@names@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructThemedIconNames :: (IsThemedIcon o) => [T.Text] -> IO (GValueConstruct o)
constructThemedIconNames val = constructObjectPropertyStringArray "names" (Just val)

#if ENABLE_OVERLOADING
data ThemedIconNamesPropertyInfo
instance AttrInfo ThemedIconNamesPropertyInfo where
    type AttrAllowedOps ThemedIconNamesPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint ThemedIconNamesPropertyInfo = (~) [T.Text]
    type AttrBaseTypeConstraint ThemedIconNamesPropertyInfo = IsThemedIcon
    type AttrGetType ThemedIconNamesPropertyInfo = [T.Text]
    type AttrLabel ThemedIconNamesPropertyInfo = "names"
    type AttrOrigin ThemedIconNamesPropertyInfo = ThemedIcon
    attrGet _ = getThemedIconNames
    attrSet _ = undefined
    attrConstruct _ = constructThemedIconNames
    attrClear _ = undefined
#endif

-- VVV Prop "use-default-fallbacks"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Nothing,Nothing)

{- |
Get the value of the “@use-default-fallbacks@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' themedIcon #useDefaultFallbacks
@
-}
getThemedIconUseDefaultFallbacks :: (MonadIO m, IsThemedIcon o) => o -> m Bool
getThemedIconUseDefaultFallbacks obj = liftIO $ getObjectPropertyBool obj "use-default-fallbacks"

{- |
Construct a `GValueConstruct` with valid value for the “@use-default-fallbacks@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructThemedIconUseDefaultFallbacks :: (IsThemedIcon o) => Bool -> IO (GValueConstruct o)
constructThemedIconUseDefaultFallbacks val = constructObjectPropertyBool "use-default-fallbacks" val

#if ENABLE_OVERLOADING
data ThemedIconUseDefaultFallbacksPropertyInfo
instance AttrInfo ThemedIconUseDefaultFallbacksPropertyInfo where
    type AttrAllowedOps ThemedIconUseDefaultFallbacksPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint ThemedIconUseDefaultFallbacksPropertyInfo = (~) Bool
    type AttrBaseTypeConstraint ThemedIconUseDefaultFallbacksPropertyInfo = IsThemedIcon
    type AttrGetType ThemedIconUseDefaultFallbacksPropertyInfo = Bool
    type AttrLabel ThemedIconUseDefaultFallbacksPropertyInfo = "use-default-fallbacks"
    type AttrOrigin ThemedIconUseDefaultFallbacksPropertyInfo = ThemedIcon
    attrGet _ = getThemedIconUseDefaultFallbacks
    attrSet _ = undefined
    attrConstruct _ = constructThemedIconUseDefaultFallbacks
    attrClear _ = undefined
#endif

#if ENABLE_OVERLOADING
instance O.HasAttributeList ThemedIcon
type instance O.AttributeList ThemedIcon = ThemedIconAttributeList
type ThemedIconAttributeList = ('[ '("name", ThemedIconNamePropertyInfo), '("names", ThemedIconNamesPropertyInfo), '("useDefaultFallbacks", ThemedIconUseDefaultFallbacksPropertyInfo)] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
themedIconName :: AttrLabelProxy "name"
themedIconName = AttrLabelProxy

themedIconNames :: AttrLabelProxy "names"
themedIconNames = AttrLabelProxy

themedIconUseDefaultFallbacks :: AttrLabelProxy "useDefaultFallbacks"
themedIconUseDefaultFallbacks = AttrLabelProxy

#endif

#if ENABLE_OVERLOADING
type instance O.SignalList ThemedIcon = ThemedIconSignalList
type ThemedIconSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

-- method ThemedIcon::new
-- method type : Constructor
-- Args : [Arg {argCName = "iconname", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a string containing an icon name.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "ThemedIcon"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_themed_icon_new" g_themed_icon_new ::
    CString ->                              -- iconname : TBasicType TUTF8
    IO (Ptr ThemedIcon)

{- |
Creates a new themed icon for /@iconname@/.
-}
themedIconNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@iconname@/: a string containing an icon name. -}
    -> m ThemedIcon
    {- ^ __Returns:__ a new 'GI.Gio.Objects.ThemedIcon.ThemedIcon'. -}
themedIconNew iconname = liftIO $ do
    iconname' <- textToCString iconname
    result <- g_themed_icon_new iconname'
    checkUnexpectedReturnNULL "themedIconNew" result
    result' <- (wrapObject ThemedIcon) result
    freeMem iconname'
    return result'

#if ENABLE_OVERLOADING
#endif

-- method ThemedIcon::new_from_names
-- method type : Constructor
-- Args : [Arg {argCName = "iconnames", argType = TCArray False (-1) 1 (TBasicType TUTF8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an array of strings containing icon names.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "len", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the length of the @iconnames array, or -1 if @iconnames is\n    %NULL-terminated", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : [Arg {argCName = "len", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the length of the @iconnames array, or -1 if @iconnames is\n    %NULL-terminated", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "ThemedIcon"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_themed_icon_new_from_names" g_themed_icon_new_from_names ::
    Ptr CString ->                          -- iconnames : TCArray False (-1) 1 (TBasicType TUTF8)
    Int32 ->                                -- len : TBasicType TInt
    IO (Ptr ThemedIcon)

{- |
Creates a new themed icon for /@iconnames@/.
-}
themedIconNewFromNames ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    [T.Text]
    {- ^ /@iconnames@/: an array of strings containing icon names. -}
    -> m ThemedIcon
    {- ^ __Returns:__ a new 'GI.Gio.Objects.ThemedIcon.ThemedIcon' -}
themedIconNewFromNames iconnames = liftIO $ do
    let len = fromIntegral $ length iconnames
    iconnames' <- packUTF8CArray iconnames
    result <- g_themed_icon_new_from_names iconnames' len
    checkUnexpectedReturnNULL "themedIconNewFromNames" result
    result' <- (wrapObject ThemedIcon) result
    (mapCArrayWithLength len) freeMem iconnames'
    freeMem iconnames'
    return result'

#if ENABLE_OVERLOADING
#endif

-- method ThemedIcon::new_with_default_fallbacks
-- method type : Constructor
-- Args : [Arg {argCName = "iconname", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a string containing an icon name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "ThemedIcon"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_themed_icon_new_with_default_fallbacks" g_themed_icon_new_with_default_fallbacks ::
    CString ->                              -- iconname : TBasicType TUTF8
    IO (Ptr ThemedIcon)

{- |
Creates a new themed icon for /@iconname@/, and all the names
that can be created by shortening /@iconname@/ at \'-\' characters.

In the following example, /@icon1@/ and /@icon2@/ are equivalent:

=== /C code/
>
>const char *names[] = {
>  "gnome-dev-cdrom-audio",
>  "gnome-dev-cdrom",
>  "gnome-dev",
>  "gnome"
>};
>
>icon1 = g_themed_icon_new_from_names (names, 4);
>icon2 = g_themed_icon_new_with_default_fallbacks ("gnome-dev-cdrom-audio");
-}
themedIconNewWithDefaultFallbacks ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@iconname@/: a string containing an icon name -}
    -> m ThemedIcon
    {- ^ __Returns:__ a new 'GI.Gio.Objects.ThemedIcon.ThemedIcon'. -}
themedIconNewWithDefaultFallbacks iconname = liftIO $ do
    iconname' <- textToCString iconname
    result <- g_themed_icon_new_with_default_fallbacks iconname'
    checkUnexpectedReturnNULL "themedIconNewWithDefaultFallbacks" result
    result' <- (wrapObject ThemedIcon) result
    freeMem iconname'
    return result'

#if ENABLE_OVERLOADING
#endif

-- method ThemedIcon::append_name
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "icon", argType = TInterface (Name {namespace = "Gio", name = "ThemedIcon"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GThemedIcon", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "iconname", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "name of icon to append to list of icons from within @icon.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_themed_icon_append_name" g_themed_icon_append_name ::
    Ptr ThemedIcon ->                       -- icon : TInterface (Name {namespace = "Gio", name = "ThemedIcon"})
    CString ->                              -- iconname : TBasicType TUTF8
    IO ()

{- |
Append a name to the list of icons from within /@icon@/.

Note that doing so invalidates the hash computed by prior calls
to 'GI.Gio.Functions.iconHash'.
-}
themedIconAppendName ::
    (B.CallStack.HasCallStack, MonadIO m, IsThemedIcon a) =>
    a
    {- ^ /@icon@/: a 'GI.Gio.Objects.ThemedIcon.ThemedIcon' -}
    -> T.Text
    {- ^ /@iconname@/: name of icon to append to list of icons from within /@icon@/. -}
    -> m ()
themedIconAppendName icon iconname = liftIO $ do
    icon' <- unsafeManagedPtrCastPtr icon
    iconname' <- textToCString iconname
    g_themed_icon_append_name icon' iconname'
    touchManagedPtr icon
    freeMem iconname'
    return ()

#if ENABLE_OVERLOADING
data ThemedIconAppendNameMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m, IsThemedIcon a) => O.MethodInfo ThemedIconAppendNameMethodInfo a signature where
    overloadedMethod _ = themedIconAppendName

#endif

-- method ThemedIcon::get_names
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "icon", argType = TInterface (Name {namespace = "Gio", name = "ThemedIcon"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GThemedIcon.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TCArray True (-1) (-1) (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "g_themed_icon_get_names" g_themed_icon_get_names ::
    Ptr ThemedIcon ->                       -- icon : TInterface (Name {namespace = "Gio", name = "ThemedIcon"})
    IO (Ptr CString)

{- |
Gets the names of icons from within /@icon@/.
-}
themedIconGetNames ::
    (B.CallStack.HasCallStack, MonadIO m, IsThemedIcon a) =>
    a
    {- ^ /@icon@/: a 'GI.Gio.Objects.ThemedIcon.ThemedIcon'. -}
    -> m [T.Text]
    {- ^ __Returns:__ a list of icon names. -}
themedIconGetNames icon = liftIO $ do
    icon' <- unsafeManagedPtrCastPtr icon
    result <- g_themed_icon_get_names icon'
    checkUnexpectedReturnNULL "themedIconGetNames" result
    result' <- unpackZeroTerminatedUTF8CArray result
    touchManagedPtr icon
    return result'

#if ENABLE_OVERLOADING
data ThemedIconGetNamesMethodInfo
instance (signature ~ (m [T.Text]), MonadIO m, IsThemedIcon a) => O.MethodInfo ThemedIconGetNamesMethodInfo a signature where
    overloadedMethod _ = themedIconGetNames

#endif

-- method ThemedIcon::prepend_name
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "icon", argType = TInterface (Name {namespace = "Gio", name = "ThemedIcon"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GThemedIcon", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "iconname", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "name of icon to prepend to list of icons from within @icon.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_themed_icon_prepend_name" g_themed_icon_prepend_name ::
    Ptr ThemedIcon ->                       -- icon : TInterface (Name {namespace = "Gio", name = "ThemedIcon"})
    CString ->                              -- iconname : TBasicType TUTF8
    IO ()

{- |
Prepend a name to the list of icons from within /@icon@/.

Note that doing so invalidates the hash computed by prior calls
to 'GI.Gio.Functions.iconHash'.

/Since: 2.18/
-}
themedIconPrependName ::
    (B.CallStack.HasCallStack, MonadIO m, IsThemedIcon a) =>
    a
    {- ^ /@icon@/: a 'GI.Gio.Objects.ThemedIcon.ThemedIcon' -}
    -> T.Text
    {- ^ /@iconname@/: name of icon to prepend to list of icons from within /@icon@/. -}
    -> m ()
themedIconPrependName icon iconname = liftIO $ do
    icon' <- unsafeManagedPtrCastPtr icon
    iconname' <- textToCString iconname
    g_themed_icon_prepend_name icon' iconname'
    touchManagedPtr icon
    freeMem iconname'
    return ()

#if ENABLE_OVERLOADING
data ThemedIconPrependNameMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m, IsThemedIcon a) => O.MethodInfo ThemedIconPrependNameMethodInfo a signature where
    overloadedMethod _ = themedIconPrependName

#endif