Commit ee81f23f authored by Martin Nordholts's avatar Martin Nordholts

app: Add gimp_enum_get_value_name() utility function

parent 3d82d40f
......@@ -685,6 +685,32 @@ gimp_markup_extract_text (const gchar *markup)
return g_string_free (string, FALSE);
}
/**
* gimp_enum_get_value_name:
* @enum_type: Enum type
* @value: Enum value
*
* Returns the value name for a given value of a given enum
* type. Useful to have inline in GIMP_LOG() messages for example.
*
* Returns: The value name.
**/
const gchar *
gimp_enum_get_value_name (GType enum_type,
gint value)
{
const gchar *value_name = NULL;
gimp_enum_get_value (enum_type,
value,
&value_name,
NULL /*value_nick*/,
NULL /*value_desc*/,
NULL /*value_help*/);
return value_name;
}
/**
* gimp_utils_point_to_line_distance:
* @point: The point to calculate the distance for.
......
......@@ -78,6 +78,8 @@ GimpObject * gimp_container_get_neighbor_of_active (GimpContainer *container,
gchar * gimp_markup_extract_text (const gchar *markup);
const gchar* gimp_enum_get_value_name (GType enum_type,
gint value);
/* Common values for the n_snap_lines parameter of
* gimp_constrain_line.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment