Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (inaki@blueleaf.cc) |
Safe Haskell | None |
Language | Haskell2010 |
No description available in the introspection data.
Synopsis
- newtype LanguageManager = LanguageManager (ManagedPtr LanguageManager)
- class (GObject o, IsDescendantOf LanguageManager o) => IsLanguageManager o
- toLanguageManager :: (MonadIO m, IsLanguageManager o) => o -> m LanguageManager
- noLanguageManager :: Maybe LanguageManager
- languageManagerGetDefault :: (HasCallStack, MonadIO m) => m LanguageManager
- languageManagerGetLanguage :: (HasCallStack, MonadIO m, IsLanguageManager a) => a -> Text -> m (Maybe Language)
- languageManagerGetLanguageIds :: (HasCallStack, MonadIO m, IsLanguageManager a) => a -> m (Maybe [Text])
- languageManagerGetSearchPath :: (HasCallStack, MonadIO m, IsLanguageManager a) => a -> m [Text]
- languageManagerGuessLanguage :: (HasCallStack, MonadIO m, IsLanguageManager a) => a -> Maybe Text -> Maybe Text -> m (Maybe Language)
- languageManagerNew :: (HasCallStack, MonadIO m) => m LanguageManager
- languageManagerSetSearchPath :: (HasCallStack, MonadIO m, IsLanguageManager a) => a -> Maybe [Text] -> m ()
- getLanguageManagerLanguageIds :: (MonadIO m, IsLanguageManager o) => o -> m (Maybe [Text])
- clearLanguageManagerSearchPath :: (MonadIO m, IsLanguageManager o) => o -> m ()
- constructLanguageManagerSearchPath :: IsLanguageManager o => [Text] -> IO (GValueConstruct o)
- getLanguageManagerSearchPath :: (MonadIO m, IsLanguageManager o) => o -> m [Text]
- setLanguageManagerSearchPath :: (MonadIO m, IsLanguageManager o) => o -> [Text] -> m ()
Exported types
newtype LanguageManager Source #
Memory-managed wrapper type.
LanguageManager (ManagedPtr LanguageManager) |
Instances
GObject LanguageManager Source # | |
Defined in GI.GtkSource.Objects.LanguageManager gobjectType :: IO GType | |
HasParentTypes LanguageManager Source # | |
Defined in GI.GtkSource.Objects.LanguageManager | |
type ParentTypes LanguageManager Source # | |
Defined in GI.GtkSource.Objects.LanguageManager |
class (GObject o, IsDescendantOf LanguageManager o) => IsLanguageManager o Source #
Type class for types which can be safely cast to LanguageManager
, for instance with toLanguageManager
.
Instances
(GObject o, IsDescendantOf LanguageManager o) => IsLanguageManager o Source # | |
Defined in GI.GtkSource.Objects.LanguageManager |
toLanguageManager :: (MonadIO m, IsLanguageManager o) => o -> m LanguageManager Source #
Cast to LanguageManager
, for types for which this is known to be safe. For general casts, use castTo
.
noLanguageManager :: Maybe LanguageManager Source #
A convenience alias for Nothing
:: Maybe
LanguageManager
.
Methods
getDefault
languageManagerGetDefault Source #
:: (HasCallStack, MonadIO m) | |
=> m LanguageManager | Returns: a |
Returns the default LanguageManager
instance.
getLanguage
languageManagerGetLanguage Source #
:: (HasCallStack, MonadIO m, IsLanguageManager a) | |
=> a |
|
-> Text |
|
-> m (Maybe Language) | Returns: a |
Gets the Language
identified by the given id
in the language
manager.
getLanguageIds
languageManagerGetLanguageIds Source #
:: (HasCallStack, MonadIO m, IsLanguageManager a) | |
=> a |
|
-> m (Maybe [Text]) | Returns:
a |
Returns the ids of the available languages.
getSearchPath
languageManagerGetSearchPath Source #
:: (HasCallStack, MonadIO m, IsLanguageManager a) | |
=> a |
|
-> m [Text] | Returns: |
Gets the list directories where lm
looks for language files.
guessLanguage
languageManagerGuessLanguage Source #
:: (HasCallStack, MonadIO m, IsLanguageManager a) | |
=> a |
|
-> Maybe Text |
|
-> Maybe Text |
|
-> m (Maybe Language) | Returns: a |
Picks a Language
for given file name and content type,
according to the information in lang files. Either filename
or
contentType
may be Nothing
. This function can be used as follows:
<informalexample><programlisting> GtkSourceLanguage *lang; lang = gtk_source_language_manager_guess_language (filename, NULL); gtk_source_buffer_set_language (buffer, lang); </programlisting></informalexample>
or
<informalexample><programlisting> GtkSourceLanguage *lang = NULL; gboolean result_uncertain; gchar *content_type;
content_type = g_content_type_guess (filename, NULL, 0, &result_uncertain); if (result_uncertain) { g_free (content_type); content_type = NULL; }
lang = gtk_source_language_manager_guess_language (manager, filename, content_type); gtk_source_buffer_set_language (buffer, lang);
g_free (content_type); </programlisting></informalexample>
etc. Use languageGetMimeTypes
and languageGetGlobs
if you need full control over file -> language mapping.
Since: 2.4
new
:: (HasCallStack, MonadIO m) | |
=> m LanguageManager | Returns: a new |
Creates a new language manager. If you do not need more than one language
manager or a private language manager instance then use
languageManagerGetDefault
instead.
setSearchPath
languageManagerSetSearchPath Source #
:: (HasCallStack, MonadIO m, IsLanguageManager a) | |
=> a |
|
-> Maybe [Text] | |
-> m () |
Sets the list of directories where the lm
looks for
language files.
If dirs
is Nothing
, the search path is reset to default.
<note>
<para>
At the moment this function can be called only before the
language files are loaded for the first time. In practice
to set a custom search path for a LanguageManager
,
you have to call this function right after creating it.
</para>
</note>
Properties
languageIds
No description available in the introspection data.
getLanguageManagerLanguageIds :: (MonadIO m, IsLanguageManager o) => o -> m (Maybe [Text]) Source #
Get the value of the “language-ids
” property.
When overloading is enabled, this is equivalent to
get
languageManager #languageIds
searchPath
No description available in the introspection data.
clearLanguageManagerSearchPath :: (MonadIO m, IsLanguageManager o) => o -> m () Source #
Set the value of the “search-path
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#searchPath
constructLanguageManagerSearchPath :: IsLanguageManager o => [Text] -> IO (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “search-path
” property. This is rarely needed directly, but it is used by new
.
getLanguageManagerSearchPath :: (MonadIO m, IsLanguageManager o) => o -> m [Text] Source #
Get the value of the “search-path
” property.
When overloading is enabled, this is equivalent to
get
languageManager #searchPath
setLanguageManagerSearchPath :: (MonadIO m, IsLanguageManager o) => o -> [Text] -> m () Source #
Set the value of the “search-path
” property.
When overloading is enabled, this is equivalent to
set
languageManager [ #searchPath:=
value ]