Picks a [class@Language] for given file name and content type, according to the information in lang files.
Either filename
or content_type
may be null. This function can be used as
follows:
```c GtkSourceLanguage *lang; GtkSourceLanguageManager *manager; lm = gtk_source_language_manager_get_default (); lang = gtk_source_language_manager_guess_language (manager, filename, NULL); gtk_source_buffer_set_language (buffer, lang); ```
or
```c GtkSourceLanguage *lang = NULL; GtkSourceLanguageManager *manager; 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; }
manager = gtk_source_language_manager_get_default (); lang = gtk_source_language_manager_guess_language (manager, filename, content_type) ; gtk_source_buffer_set_language (buffer, lang);
g_free (content_type); ```
etc. Use [[email protected]_mime_types] and [[email protected]_globs] if you need full control over file -> language mapping.
this | |
filename |
a filename in Glib filename encoding, or null. |
content_type |
a content type (as in GIO API), or null. |
a Language, or null if there is no suitable
language for given |