| Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
|---|---|
| License | LGPL-2.1 |
| Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
| Safe Haskell | None |
| Language | Haskell2010 |
GI.GtkSource.Objects.LanguageManager
Contents
Description
No description available in the introspection data.
Synopsis
- newtype LanguageManager = LanguageManager (ManagedPtr LanguageManager)
- class GObject 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.
Constructors
| LanguageManager (ManagedPtr LanguageManager) |
Instances
| GObject LanguageManager Source # | |
Defined in GI.GtkSource.Objects.LanguageManager Methods gobjectType :: LanguageManager -> IO GType # | |
| IsObject LanguageManager Source # | |
Defined in GI.GtkSource.Objects.LanguageManager | |
| IsLanguageManager LanguageManager Source # | |
Defined in GI.GtkSource.Objects.LanguageManager | |
class GObject o => IsLanguageManager o Source #
Type class for types which can be safely cast to LanguageManager, for instance with toLanguageManager.
Instances
| (GObject a, (UnknownAncestorError LanguageManager a :: Constraint)) => IsLanguageManager a Source # | |
Defined in GI.GtkSource.Objects.LanguageManager | |
| IsLanguageManager LanguageManager 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 #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => m LanguageManager | Returns: a |
Returns the default LanguageManager instance.
getLanguage
languageManagerGetLanguage Source #
Arguments
| :: (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 #
Arguments
| :: (HasCallStack, MonadIO m, IsLanguageManager a) | |
| => a |
|
| -> m (Maybe [Text]) | Returns:
a |
Returns the ids of the available languages.
getSearchPath
languageManagerGetSearchPath Source #
Arguments
| :: (HasCallStack, MonadIO m, IsLanguageManager a) | |
| => a |
|
| -> m [Text] | Returns: |
Gets the list directories where lm looks for language files.
guessLanguage
languageManagerGuessLanguage Source #
Arguments
| :: (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
Arguments
| :: (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 #
Arguments
| :: (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
setlanguageManager [ #searchPath:=value ]