Commit 280856e1 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

renamed gimp_flags_get_value() to gimp_flags_get_first_value(). Reordered

2004-11-10  Michael Natterer  <mitch@gimp.org>

	* libgimpbase/gimputils.[ch]: renamed gimp_flags_get_value() to
	gimp_flags_get_first_value(). Reordered functions so enum and
	flags functions are grouped together. Added missing docs.

	* libgimpbase/gimpbase.def: changed accordingly.
parent 5b5823ba
2004-11-10 Michael Natterer <mitch@gimp.org>
* libgimpbase/gimputils.[ch]: renamed gimp_flags_get_value() to
gimp_flags_get_first_value(). Reordered functions so enum and
flags functions are grouped together. Added missing docs.
* libgimpbase/gimpbase.def: changed accordingly.
2004-11-09 Jay Cox <jaycox@gimp.org>
 
* plug-ins/common/psd.c: Skip resources with unknown signatures
......
......@@ -18,7 +18,7 @@ EXPORTS
gimp_escape_uline
gimp_filename_to_utf8
gimp_flags_get_first_desc
gimp_flags_get_value
gimp_flags_get_first_value
gimp_flags_get_value_descriptions
gimp_flags_set_value_descriptions
gimp_flags_value_get_desc
......
......@@ -302,6 +302,17 @@ gimp_escape_uline (const gchar *str)
return escaped;
}
/**
* gimp_enum_get_desc:
* @enum_class: a #GEnumClass
* @value: a value from @enum_class
*
* Retrieves #GimpEnumDesc associated with the given value, or %NULL.
*
* Return value: the value's #GimpEnumDesc.
*
* Since: GIMP 2.2
**/
GimpEnumDesc *
gimp_enum_get_desc (GEnumClass *enum_class,
gint value)
......@@ -326,30 +337,6 @@ gimp_enum_get_desc (GEnumClass *enum_class,
return NULL;
}
GimpFlagsDesc *
gimp_flags_get_first_desc (GFlagsClass *flags_class,
guint value)
{
const GimpFlagsDesc *value_desc;
g_return_val_if_fail (G_IS_FLAGS_CLASS (flags_class), NULL);
value_desc = gimp_flags_get_value_descriptions (G_TYPE_FROM_CLASS (flags_class));
if (value_desc)
{
while (value_desc->value_desc)
{
if ((value_desc->value & value) == value_desc->value)
return (GimpFlagsDesc *) value_desc;
value_desc++;
}
}
return NULL;
}
/**
* gimp_enum_get_value:
* @enum_type: the #GType of a registered enum
......@@ -419,7 +406,96 @@ gimp_enum_get_value (GType enum_type,
}
/**
* gimp_flags_get_value:
* gimp_enum_value_get_desc:
* @enum_class: a #GEnumClass
* @enum_value: a #GEnumValue from @enum_class
*
* Retrieves the translated desc for a given @enum_value.
*
* Return value: the translated desc of the enum value
*
* Since: GIMP 2.2
**/
const gchar *
gimp_enum_value_get_desc (GEnumClass *enum_class,
GEnumValue *enum_value)
{
GType type = G_TYPE_FROM_CLASS (enum_class);
GimpEnumDesc *enum_desc;
enum_desc = gimp_enum_get_desc (enum_class, enum_value->value);
if (enum_desc->value_desc)
return dgettext (gimp_type_get_translation_domain (type),
enum_desc->value_desc);
return enum_value->value_name;
}
/**
* gimp_enum_value_get_help:
* @enum_class: a #GEnumClass
* @enum_value: a #GEnumValue from @enum_class
*
* Retrieves the translated help for a given @enum_value.
*
* Return value: the translated help of the enum value
*
* Since: GIMP 2.2
**/
const gchar *
gimp_enum_value_get_help (GEnumClass *enum_class,
GEnumValue *enum_value)
{
GType type = G_TYPE_FROM_CLASS (enum_class);
GimpEnumDesc *enum_desc;
enum_desc = gimp_enum_get_desc (enum_class, enum_value->value);
if (enum_desc->value_help)
return dgettext (gimp_type_get_translation_domain (type),
enum_desc->value_help);
return NULL;
}
/**
* gimp_flags_get_first_desc:
* @flags_class: a #GFlagsClass
* @value: a value from @flags_class
*
* Retrieves the first #GimpFlagsDesc that matches the given value, or %NULL.
*
* Return value: the value's #GimpFlagsDesc.
*
* Since: GIMP 2.2
**/
GimpFlagsDesc *
gimp_flags_get_first_desc (GFlagsClass *flags_class,
guint value)
{
const GimpFlagsDesc *value_desc;
g_return_val_if_fail (G_IS_FLAGS_CLASS (flags_class), NULL);
value_desc = gimp_flags_get_value_descriptions (G_TYPE_FROM_CLASS (flags_class));
if (value_desc)
{
while (value_desc->value_desc)
{
if ((value_desc->value & value) == value_desc->value)
return (GimpFlagsDesc *) value_desc;
value_desc++;
}
}
return NULL;
}
/**
* gimp_flags_get_first_value:
* @flags_type: the #GType of registered flags
* @value: an integer value
* @value_name: return location for the value's name (or %NULL)
......@@ -438,12 +514,12 @@ gimp_enum_get_value (GType enum_type,
* Since: GIMP 2.2
**/
gboolean
gimp_flags_get_value (GType flags_type,
guint value,
const gchar **value_name,
const gchar **value_nick,
const gchar **value_desc,
const gchar **value_help)
gimp_flags_get_first_value (GType flags_type,
guint value,
const gchar **value_name,
const gchar **value_nick,
const gchar **value_desc,
const gchar **value_help)
{
GFlagsClass *flags_class;
GFlagsValue *flags_value;
......@@ -486,60 +562,6 @@ gimp_flags_get_value (GType flags_type,
return FALSE;
}
/**
* gimp_enum_value_get_desc:
* @enum_class: a #GEnumClass
* @enum_value: a #GEnumValue from @enum_class
*
* Retrieves the translated desc for a given @enum_value.
*
* Return value: the translated desc of the enum value
*
* Since: GIMP 2.2
**/
const gchar *
gimp_enum_value_get_desc (GEnumClass *enum_class,
GEnumValue *enum_value)
{
GType type = G_TYPE_FROM_CLASS (enum_class);
GimpEnumDesc *enum_desc;
enum_desc = gimp_enum_get_desc (enum_class, enum_value->value);
if (enum_desc->value_desc)
return dgettext (gimp_type_get_translation_domain (type),
enum_desc->value_desc);
return enum_value->value_name;
}
/**
* gimp_enum_value_get_help:
* @enum_class: a #GEnumClass
* @enum_value: a #GEnumValue from @enum_class
*
* Retrieves the translated help for a given @enum_value.
*
* Return value: the translated help of the enum value
*
* Since: GIMP 2.2
**/
const gchar *
gimp_enum_value_get_help (GEnumClass *enum_class,
GEnumValue *enum_value)
{
GType type = G_TYPE_FROM_CLASS (enum_class);
GimpEnumDesc *enum_desc;
enum_desc = gimp_enum_get_desc (enum_class, enum_value->value);
if (enum_desc->value_help)
return dgettext (gimp_type_get_translation_domain (type),
enum_desc->value_help);
return NULL;
}
/**
* gimp_flags_value_get_desc:
* @flags_class: a #GFlagsClass
......
......@@ -23,44 +23,42 @@
G_BEGIN_DECLS
gchar * gimp_utf8_strtrim (const gchar *str,
gint max_chars);
gchar * gimp_any_to_utf8 (const gchar *str,
gssize len,
const gchar *warning_format,
...) G_GNUC_PRINTF (3, 4);
const gchar * gimp_filename_to_utf8 (const gchar *filename);
gchar * gimp_utf8_strtrim (const gchar *str,
gint max_chars);
gchar * gimp_any_to_utf8 (const gchar *str,
gssize len,
const gchar *warning_format,
...) G_GNUC_PRINTF (3, 4);
const gchar * gimp_filename_to_utf8 (const gchar *filename);
gchar * gimp_strip_uline (const gchar *str);
gchar * gimp_escape_uline (const gchar *str);
gchar * gimp_strip_uline (const gchar *str);
gchar * gimp_escape_uline (const gchar *str);
GimpEnumDesc * gimp_enum_get_desc (GEnumClass *enum_class,
gint value);
GimpFlagsDesc * gimp_flags_get_first_desc (GFlagsClass *flags_class,
guint value);
GimpEnumDesc * gimp_enum_get_desc (GEnumClass *enum_class,
gint value);
gboolean gimp_enum_get_value (GType enum_type,
gint value,
const gchar **value_name,
const gchar **value_nick,
const gchar **value_desc,
const gchar **value_help);
const gchar * gimp_enum_value_get_desc (GEnumClass *enum_class,
GEnumValue *enum_value);
const gchar * gimp_enum_value_get_help (GEnumClass *enum_class,
GEnumValue *enum_value);
gboolean gimp_enum_get_value (GType enum_type,
gint value,
const gchar **value_name,
const gchar **value_nick,
const gchar **value_desc,
const gchar **value_help);
gboolean gimp_flags_get_value (GType flags_type,
guint value,
const gchar **value_name,
const gchar **value_nick,
const gchar **value_desc,
const gchar **value_help);
const gchar * gimp_enum_value_get_desc (GEnumClass *enum_class,
GEnumValue *enum_value);
const gchar * gimp_enum_value_get_help (GEnumClass *enum_class,
GEnumValue *enum_value);
const gchar * gimp_flags_value_get_desc (GFlagsClass *flags_class,
GFlagsValue *flags_value);
const gchar * gimp_flags_value_get_help (GFlagsClass *flags_class,
GFlagsValue *flags_value);
GimpFlagsDesc * gimp_flags_get_first_desc (GFlagsClass *flags_class,
guint value);
gboolean gimp_flags_get_first_value (GType flags_type,
guint value,
const gchar **value_name,
const gchar **value_nick,
const gchar **value_desc,
const gchar **value_help);
const gchar * gimp_flags_value_get_desc (GFlagsClass *flags_class,
GFlagsValue *flags_value);
const gchar * gimp_flags_value_get_help (GFlagsClass *flags_class,
GFlagsValue *flags_value);
G_END_DECLS
......
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