gi-gtksource-3.0.22: GtkSource bindings
CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

GI.GtkSource.Objects.LanguageManager

Description

No description available in the introspection data.

Synopsis

Exported types

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

Instances details
(GObject o, IsDescendantOf LanguageManager o) => IsLanguageManager o Source # 
Instance details

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.

Methods

Overloaded methods

getDefault

languageManagerGetDefault Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m LanguageManager

Returns: a LanguageManager. Return value is owned by GtkSourceView library and must not be unref'ed.

Returns the default LanguageManager instance.

getLanguage

languageManagerGetLanguage Source #

Arguments

:: (HasCallStack, MonadIO m, IsLanguageManager a) 
=> a

lm: a LanguageManager.

-> Text

id: a language id.

-> m (Maybe Language)

Returns: a Language, or Nothing if there is no language identified by the given id. Return value is owned by lm and should not be freed.

Gets the Language identified by the given id in the language manager.

getLanguageIds

languageManagerGetLanguageIds Source #

Arguments

:: (HasCallStack, MonadIO m, IsLanguageManager a) 
=> a

lm: a LanguageManager.

-> m (Maybe [Text])

Returns: a Nothing-terminated array of strings containing the ids of the available languages or Nothing if no language is available. The array is sorted alphabetically according to the language name. The array is owned by lm and must not be modified.

Returns the ids of the available languages.

getSearchPath

languageManagerGetSearchPath Source #

Arguments

:: (HasCallStack, MonadIO m, IsLanguageManager a) 
=> a

lm: a LanguageManager.

-> m [Text]

Returns: Nothing-terminated array containg a list of language files directories. The array is owned by lm and must not be modified.

Gets the list directories where lm looks for language files.

guessLanguage

languageManagerGuessLanguage Source #

Arguments

:: (HasCallStack, MonadIO m, IsLanguageManager a) 
=> a

lm: a LanguageManager.

-> Maybe Text

filename: a filename in Glib filename encoding, or Nothing.

-> Maybe Text

contentType: a content type (as in GIO API), or Nothing.

-> m (Maybe Language)

Returns: a Language, or Nothing if there is no suitable language for given filename and/or contentType. Return value is owned by lm and should not be freed.

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

languageManagerNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m LanguageManager

Returns: a new LanguageManager.

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

lm: a LanguageManager.

-> Maybe [Text]

dirs: a Nothing-terminated array of strings or Nothing.

-> 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 ]