Exemplo n.º 1
0
/**
 * gtk_source_language_get_style_fallback:
 * @language: a #GtkSourceLanguage.
 * @style_id: a style ID.
 *
 * Returns the ID of the style to use if the specified @style_id
 * is not present in the current style scheme.
 *
 * Returns: (nullable) (transfer none): the ID of the style to use if the
 * specified @style_id is not present in the current style scheme or %NULL
 * if the style has no fallback defined.
 * The returned string is owned by the @language and must not be modified.
 *
 * Since: 3.4
 */
const gchar *
gtk_source_language_get_style_fallback (GtkSourceLanguage *language,
					const gchar       *style_id)
{
	GtkSourceStyleInfo *info;

	g_return_val_if_fail (GTK_SOURCE_IS_LANGUAGE (language), NULL);
	g_return_val_if_fail (language->priv->id != NULL, NULL);
	g_return_val_if_fail (style_id != NULL, NULL);

	info = get_style_info (language, style_id);

	return info ? info->map_to : NULL;
}
/**
 * gtk_source_language_get_style_name:
 * @language: a #GtkSourceLanguage
 * @style_id: a style ID
 *
 * Returns the name of the style with ID @style_id defined by this @language.
 *
 * Returns: the name of the style with ID @style_id defined by this @language or
 * %NULL if the style has no name or there is no style with ID @style_id defined
 * by this @language. The returned string is owned by the @language and must
 * not be modified.
 */
const gchar *
gtk_source_language_get_style_name (GtkSourceLanguage *language,
				    const gchar       *style_id)
{
	GtkSourceStyleInfo *info;

	g_return_val_if_fail (GTK_IS_SOURCE_LANGUAGE (language), NULL);
	g_return_val_if_fail (language->priv->id != NULL, NULL);
	g_return_val_if_fail (style_id != NULL, NULL);

	info = get_style_info (language, style_id);
	if (info == NULL)
		return NULL;

	return info->name;
}