Don't store human readable and translatable enum/flag strings in
2004-10-25 Michael Natterer <mitch@gimp.org> Don't store human readable and translatable enum/flag strings in GEnumValue's and GTypeValue's fields but attach them to their GType using separate structs and utility functions: * tools/gimp-mkenums: added params and perl voodoo to support generating a second array of values, which is used by the Makefiles below to create and register arrays of value descriptions. * libgimpbase/gimpbasetypes.[ch]: added API to attach/retreive arrays of translatable strings to/from enum and flags types. Added structs GimpEnumDesc and GimpFlagsDesc for that purpose. * libgimpbase/gimputils.[ch]: changed existing enum utility functions, added new ones and added a symmetric API for flags. * app/base/Makefile.am * app/core/Makefile.am * app/display/Makefile.am * app/paint/Makefile.am * app/text/Makefile.am * app/tools/Makefile.am * app/widgets/Makefile.am * libgimp/Makefile.am * libgimpbase/Makefile.am: changed *-enums.c generation rules accordingly. * app/base/base-enums.c * app/core/core-enums.c * app/display/display-enums.c * app/paint/paint-enums.c * app/text/text-enums.c * app/tools/tools-enums.c * app/widgets/widgets-enums.c * libgimpbase/gimpbaseenums.c: regenerated. * app/widgets/gimpenumstore.c * app/widgets/gimpenumwidgets.c * app/widgets/gimptemplateeditor.c * libgimpwidgets/gimppreviewarea.c: follow the enum utility function API changes.
This commit is contained in:

committed by
Michael Natterer

parent
14b1e0c258
commit
6711646648
@ -3,6 +3,7 @@
|
||||
|
||||
#include "config.h"
|
||||
#include <glib-object.h>
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
#include "display-enums.h"
|
||||
#include"gimp-intl.h"
|
||||
|
||||
@ -12,16 +13,27 @@ gimp_cursor_mode_get_type (void)
|
||||
{
|
||||
static const GEnumValue values[] =
|
||||
{
|
||||
{ GIMP_CURSOR_MODE_TOOL_ICON, N_("Tool icon"), "tool-icon" },
|
||||
{ GIMP_CURSOR_MODE_TOOL_CROSSHAIR, N_("Tool icon with crosshair"), "tool-crosshair" },
|
||||
{ GIMP_CURSOR_MODE_CROSSHAIR, N_("Crosshair only"), "crosshair" },
|
||||
{ GIMP_CURSOR_MODE_TOOL_ICON, "GIMP_CURSOR_MODE_TOOL_ICON", "tool-icon" },
|
||||
{ GIMP_CURSOR_MODE_TOOL_CROSSHAIR, "GIMP_CURSOR_MODE_TOOL_CROSSHAIR", "tool-crosshair" },
|
||||
{ GIMP_CURSOR_MODE_CROSSHAIR, "GIMP_CURSOR_MODE_CROSSHAIR", "crosshair" },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
|
||||
static const GimpEnumDesc descs[] =
|
||||
{
|
||||
{ GIMP_CURSOR_MODE_TOOL_ICON, N_("Tool icon"), NULL },
|
||||
{ GIMP_CURSOR_MODE_TOOL_CROSSHAIR, N_("Tool icon with crosshair"), NULL },
|
||||
{ GIMP_CURSOR_MODE_CROSSHAIR, N_("Crosshair only"), NULL },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
|
||||
static GType type = 0;
|
||||
|
||||
if (! type)
|
||||
type = g_enum_register_static ("GimpCursorMode", values);
|
||||
{
|
||||
type = g_enum_register_static ("GimpCursorMode", values);
|
||||
gimp_enum_set_value_descriptions (type, descs);
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
@ -31,17 +43,29 @@ gimp_canvas_padding_mode_get_type (void)
|
||||
{
|
||||
static const GEnumValue values[] =
|
||||
{
|
||||
{ GIMP_CANVAS_PADDING_MODE_DEFAULT, N_("From theme"), "default" },
|
||||
{ GIMP_CANVAS_PADDING_MODE_LIGHT_CHECK, N_("Light check color"), "light-check" },
|
||||
{ GIMP_CANVAS_PADDING_MODE_DARK_CHECK, N_("Dark check color"), "dark-check" },
|
||||
{ GIMP_CANVAS_PADDING_MODE_CUSTOM, N_("Custom color"), "custom" },
|
||||
{ GIMP_CANVAS_PADDING_MODE_DEFAULT, "GIMP_CANVAS_PADDING_MODE_DEFAULT", "default" },
|
||||
{ GIMP_CANVAS_PADDING_MODE_LIGHT_CHECK, "GIMP_CANVAS_PADDING_MODE_LIGHT_CHECK", "light-check" },
|
||||
{ GIMP_CANVAS_PADDING_MODE_DARK_CHECK, "GIMP_CANVAS_PADDING_MODE_DARK_CHECK", "dark-check" },
|
||||
{ GIMP_CANVAS_PADDING_MODE_CUSTOM, "GIMP_CANVAS_PADDING_MODE_CUSTOM", "custom" },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
|
||||
static const GimpEnumDesc descs[] =
|
||||
{
|
||||
{ GIMP_CANVAS_PADDING_MODE_DEFAULT, N_("From theme"), NULL },
|
||||
{ GIMP_CANVAS_PADDING_MODE_LIGHT_CHECK, N_("Light check color"), NULL },
|
||||
{ GIMP_CANVAS_PADDING_MODE_DARK_CHECK, N_("Dark check color"), NULL },
|
||||
{ GIMP_CANVAS_PADDING_MODE_CUSTOM, N_("Custom color"), NULL },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
|
||||
static GType type = 0;
|
||||
|
||||
if (! type)
|
||||
type = g_enum_register_static ("GimpCanvasPaddingMode", values);
|
||||
{
|
||||
type = g_enum_register_static ("GimpCanvasPaddingMode", values);
|
||||
gimp_enum_set_value_descriptions (type, descs);
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
Reference in New Issue
Block a user