Picks a gsv.SourceLanguage 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:
a gsv.SourceLanguage, or NULL if there
is no suitable language for given filename and/or content_type. Return
value is owned by lm and should not be freed.
Picks a gsv.SourceLanguage 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:
<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 Source.languageGetMimeTypes and Source.languageGetGlobs if you need full control over file -> language mapping.