From b212efe91981c2fa7468a22f37798960c037304c Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Sat, 14 May 2005 15:10:47 +0000 Subject: [PATCH] register descriptions for the GimpPDBProcType enum. 2005-05-14 Michael Natterer * libgimpbase/gimpbaseenums.[ch]: register descriptions for the GimpPDBProcType enum. * plug-ins/dbbrowser/gimpprocview.c * tools/pdbgen/pdb/procedural_db.pdb: get rid of all selfmade enum->string mapping. Get the strings from the GType system instead. * app/pdb/procedural_db_cmds.c * libgimp/gimpproceduraldb_pdb.c: regenerated. --- ChangeLog | 12 ++++ app/pdb/procedural_db_cmds.c | 90 +++++++++++++----------------- libgimp/gimpproceduraldb_pdb.c | 2 +- libgimp/gimpprocview.c | 85 +++++++++------------------- libgimpbase/gimpbaseenums.c | 8 +-- libgimpbase/gimpbaseenums.h | 8 +-- plug-ins/dbbrowser/gimpprocview.c | 85 +++++++++------------------- tools/pdbgen/pdb/procedural_db.pdb | 72 ++++++++++++++---------- 8 files changed, 154 insertions(+), 208 deletions(-) diff --git a/ChangeLog b/ChangeLog index ca5c9a128a..0a72bfcb8e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2005-05-14 Michael Natterer + + * libgimpbase/gimpbaseenums.[ch]: register descriptions for the + GimpPDBProcType enum. + + * plug-ins/dbbrowser/gimpprocview.c + * tools/pdbgen/pdb/procedural_db.pdb: get rid of all selfmade + enum->string mapping. Get the strings from the GType system instead. + + * app/pdb/procedural_db_cmds.c + * libgimp/gimpproceduraldb_pdb.c: regenerated. + 2005-05-13 Helvetix Victorinox * app/composite/gimp-composite-sse2.c: diff --git a/app/pdb/procedural_db_cmds.c b/app/pdb/procedural_db_cmds.c index ed06e8bacb..89f1b8ca0b 100644 --- a/app/pdb/procedural_db_cmds.c +++ b/app/pdb/procedural_db_cmds.c @@ -22,15 +22,15 @@ #include #include -#include #include +#include "libgimpbase/gimpbase.h" + #include "pdb-types.h" #include "procedural_db.h" #include "core/gimp.h" -#include "gimp-intl.h" #ifdef HAVE_GLIBC_REGEX #include @@ -41,7 +41,6 @@ #define COMPAT_BLURB "This procedure is deprecated! Use '%s' instead." -/* Query structure */ typedef struct _PDBQuery PDBQuery; struct _PDBQuery @@ -75,40 +74,6 @@ struct _PDBStrings gchar *date; }; -static gchar *proc_type_str[] = -{ - N_("Internal GIMP procedure"), - N_("GIMP Plug-In"), - N_("GIMP Extension"), - N_("Temporary Procedure") -}; - -static const gchar * const type_str[] = -{ - "GIMP_PDB_INT32", - "GIMP_PDB_INT16", - "GIMP_PDB_INT8", - "GIMP_PDB_FLOAT", - "GIMP_PDB_STRING", - "GIMP_PDB_INT32ARRAY", - "GIMP_PDB_INT16ARRAY", - "GIMP_PDB_INT8ARRAY", - "GIMP_PDB_FLOATARRAY", - "GIMP_PDB_STRINGARRAY", - "GIMP_PDB_COLOR", - "GIMP_PDB_REGION", - "GIMP_PDB_DISPLAY", - "GIMP_PDB_IMAGE", - "GIMP_PDB_LAYER", - "GIMP_PDB_CHANNEL", - "GIMP_PDB_DRAWABLE", - "GIMP_PDB_SELECTION", - "GIMP_PDB_BOUNDARY", - "GIMP_PDB_PATH", - "GIMP_PDB_PARASITE", - "GIMP_PDB_STATUS", - "GIMP_PDB_END" -}; static ProcRecord procedural_db_temp_name_proc; static ProcRecord procedural_db_dump_proc; @@ -174,11 +139,13 @@ procedural_db_query_entry (gpointer key, gpointer value, gpointer user_data) { - PDBQuery *pdb_query = user_data; - GList *list; - ProcRecord *proc; - const gchar *proc_name; - PDBStrings strings; + PDBQuery *pdb_query = user_data; + GList *list; + ProcRecord *proc; + const gchar *proc_name; + PDBStrings strings; + GEnumClass *enum_class; + GimpEnumDesc *type_desc; proc_name = key; @@ -194,14 +161,17 @@ procedural_db_query_entry (gpointer key, get_pdb_strings (&strings, proc, pdb_query->querying_compat); + enum_class = g_type_class_ref (GIMP_TYPE_PDB_PROC_TYPE); + type_desc = gimp_enum_get_desc (enum_class, proc->proc_type); + g_type_class_unref (enum_class); + if (! match_strings (&pdb_query->name_regex, proc_name) && ! match_strings (&pdb_query->blurb_regex, strings.blurb) && ! match_strings (&pdb_query->help_regex, strings.help) && ! match_strings (&pdb_query->author_regex, strings.author) && ! match_strings (&pdb_query->copyright_regex, strings.copyright) && ! match_strings (&pdb_query->date_regex, strings.date) && - ! match_strings (&pdb_query->proc_type_regex, - proc_type_str[(gint) proc->proc_type])) + ! match_strings (&pdb_query->proc_type_regex, type_desc->value_desc)) { pdb_query->num_procs++; pdb_query->list_of_procs = g_renew (gchar *, pdb_query->list_of_procs, @@ -253,6 +223,8 @@ procedural_db_print_entry (gpointer key, gpointer user_data) { ProcRecord *procedure; + GEnumClass *arg_class; + GEnumClass *proc_class; GString *buf; GList *list; FILE *file; @@ -262,10 +234,16 @@ procedural_db_print_entry (gpointer key, list = (GList *) value; file = (FILE *) user_data; + arg_class = g_type_class_ref (GIMP_TYPE_PDB_ARG_TYPE); + proc_class = g_type_class_ref (GIMP_TYPE_PDB_PROC_TYPE); + buf = g_string_new (""); while (list) { + GEnumValue *arg_value; + GimpEnumDesc *type_desc; + num++; procedure = (ProcRecord*) list->data; list = list->next; @@ -280,20 +258,25 @@ procedural_db_print_entry (gpointer key, else output_string (file, procedure->name); + type_desc = gimp_enum_get_desc (proc_class, procedure->proc_type); + output_string (file, procedure->blurb); output_string (file, procedure->help); output_string (file, procedure->author); output_string (file, procedure->copyright); output_string (file, procedure->date); - output_string (file, proc_type_str[(int) procedure->proc_type]); + output_string (file, type_desc->value_desc); fprintf (file, "( "); for (i = 0; i < procedure->num_args; i++) { fprintf (file, "( "); - output_string (file, procedure->args[i].name ); - output_string (file, type_str[procedure->args[i].arg_type]); + arg_value = g_enum_get_value (arg_class, + procedure->args[i].arg_type); + + output_string (file, procedure->args[i].name); + output_string (file, arg_value->value_name); output_string (file, procedure->args[i].description); fprintf (file, " ) "); @@ -304,8 +287,12 @@ procedural_db_print_entry (gpointer key, for (i = 0; i < procedure->num_values; i++) { fprintf (file, "( "); - output_string (file, procedure->values[i].name ); - output_string (file, type_str[procedure->values[i].arg_type]); + + arg_value = g_enum_get_value (arg_class, + procedure->values[i].arg_type); + + output_string (file, procedure->values[i].name); + output_string (file, arg_value->value_name); output_string (file, procedure->values[i].description); fprintf (file, " ) "); @@ -315,6 +302,9 @@ procedural_db_print_entry (gpointer key, } g_string_free (buf, TRUE); + + g_type_class_unref (arg_class); + g_type_class_unref (proc_class); } static Argument * @@ -557,7 +547,7 @@ static ProcArg procedural_db_query_inargs[] = { GIMP_PDB_STRING, "proc_type", - "The regex for procedure type: { 'Internal GIMP procedure', 'GIMP Plug-in', 'GIMP Extension' }" + "The regex for procedure type: { 'Internal GIMP procedure', 'GIMP Plug-In', 'GIMP Extension', 'Temporary Procedure' }" } }; diff --git a/libgimp/gimpproceduraldb_pdb.c b/libgimp/gimpproceduraldb_pdb.c index 7f749d56fa..4d0593d9c6 100644 --- a/libgimp/gimpproceduraldb_pdb.c +++ b/libgimp/gimpproceduraldb_pdb.c @@ -98,7 +98,7 @@ gimp_procedural_db_dump (const gchar *filename) * @author: The regex for procedure author. * @copyright: The regex for procedure copyright. * @date: The regex for procedure date. - * @proc_type: The regex for procedure type: { 'Internal GIMP procedure', 'GIMP Plug-in', 'GIMP Extension' }. + * @proc_type: The regex for procedure type: { 'Internal GIMP procedure', 'GIMP Plug-In', 'GIMP Extension', 'Temporary Procedure' }. * @num_matches: The number of matching procedures. * @procedure_names: The list of procedure names. * diff --git a/libgimp/gimpprocview.c b/libgimp/gimpprocview.c index 76bce93e92..8cfded031e 100644 --- a/libgimp/gimpprocview.c +++ b/libgimp/gimpprocview.c @@ -39,13 +39,11 @@ /* local function prototypes */ -static GtkWidget * gimp_proc_view_create_params (GimpParamDef *params, - gint n_params, - GtkSizeGroup *name_group, - GtkSizeGroup *type_group, - GtkSizeGroup *desc_group); -static const gchar * GimpPDBArgType_to_string (GimpPDBArgType type); -static const gchar * GimpPDBProcType_to_string (GimpPDBProcType type); +static GtkWidget * gimp_proc_view_create_params (GimpParamDef *params, + gint n_params, + GtkSizeGroup *name_group, + GtkSizeGroup *type_group, + GtkSizeGroup *desc_group); /* public functions */ @@ -72,6 +70,7 @@ gimp_proc_view_new (const gchar *name, GtkSizeGroup *name_group; GtkSizeGroup *type_group; GtkSizeGroup *desc_group; + const gchar *type_str; gint row; if (blurb && strlen (blurb) < 2) blurb = NULL; @@ -97,7 +96,11 @@ gimp_proc_view_new (const gchar *name, gtk_container_add (GTK_CONTAINER (frame), vbox); gtk_widget_show (vbox); - label = gtk_label_new (GimpPDBProcType_to_string (type)); + if (! gimp_enum_get_value (GIMP_TYPE_PDB_PROC_TYPE, type, + NULL, NULL, &type_str, NULL)) + type_str = "UNKNOWN"; + + label = gtk_label_new (type_str); gimp_label_set_attributes (GTK_LABEL (label), PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC, -1); @@ -240,10 +243,8 @@ gimp_proc_view_create_params (GimpParamDef *params, GtkSizeGroup *type_group, GtkSizeGroup *desc_group) { - GtkWidget *table; - GtkWidget *label; - const gchar *type; - gint i; + GtkWidget *table; + gint i; table = gtk_table_new (n_params, 3, FALSE); gtk_table_set_col_spacings (GTK_TABLE (table), 6); @@ -251,6 +252,10 @@ gimp_proc_view_create_params (GimpParamDef *params, for (i = 0; i < n_params; i++) { + GtkWidget *label; + const gchar *type; + gchar *upper; + /* name */ label = gtk_label_new (params[i].name); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0); @@ -260,8 +265,15 @@ gimp_proc_view_create_params (GimpParamDef *params, gtk_widget_show (label); /* type */ - type = GimpPDBArgType_to_string (params[i].type); - label = gtk_label_new (type); + if (! gimp_enum_get_value (GIMP_TYPE_PDB_ARG_TYPE, params[i].type, + NULL, &type, NULL, NULL)) + upper = g_strdup ("UNKNOWN"); + else + upper = g_ascii_strup (type, -1); + + label = gtk_label_new (upper); + g_free (upper); + gimp_label_set_attributes (GTK_LABEL (label), PANGO_ATTR_FAMILY, "monospace", PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC, @@ -285,48 +297,3 @@ gimp_proc_view_create_params (GimpParamDef *params, return table; } - -static const gchar * -GimpPDBArgType_to_string (GimpPDBArgType type) -{ - switch (type) - { - case GIMP_PDB_INT32: return "INT32"; - case GIMP_PDB_INT16: return "INT16"; - case GIMP_PDB_INT8: return "INT8"; - case GIMP_PDB_FLOAT: return "FLOAT"; - case GIMP_PDB_STRING: return "STRING"; - case GIMP_PDB_INT32ARRAY: return "INT32ARRAY"; - case GIMP_PDB_INT16ARRAY: return "INT16ARRAY"; - case GIMP_PDB_INT8ARRAY: return "INT8ARRAY"; - case GIMP_PDB_FLOATARRAY: return "FLOATARRAY"; - case GIMP_PDB_STRINGARRAY: return "STRINGARRAY"; - case GIMP_PDB_COLOR: return "COLOR"; - case GIMP_PDB_REGION: return "REGION"; - case GIMP_PDB_DISPLAY: return "DISPLAY"; - case GIMP_PDB_IMAGE: return "IMAGE"; - case GIMP_PDB_LAYER: return "LAYER"; - case GIMP_PDB_CHANNEL: return "CHANNEL"; - case GIMP_PDB_DRAWABLE: return "DRAWABLE"; - case GIMP_PDB_SELECTION: return "SELECTION"; - case GIMP_PDB_BOUNDARY: return "BOUNDARY"; - case GIMP_PDB_PATH: return "PATH"; - case GIMP_PDB_PARASITE: return "PARASITE"; - case GIMP_PDB_STATUS: return "STATUS"; - case GIMP_PDB_END: return "END"; - default: return "UNKNOWN?"; - } -} - -static const gchar * -GimpPDBProcType_to_string (GimpPDBProcType type) -{ - switch (type) - { - case GIMP_INTERNAL: return _("Internal GIMP procedure"); - case GIMP_PLUGIN: return _("GIMP Plug-In"); - case GIMP_EXTENSION: return _("GIMP Extension"); - case GIMP_TEMPORARY: return _("Temporary Procedure"); - default: return "UNKNOWN"; - } -} diff --git a/libgimpbase/gimpbaseenums.c b/libgimpbase/gimpbaseenums.c index d35773206a..d944d34cfc 100644 --- a/libgimpbase/gimpbaseenums.c +++ b/libgimpbase/gimpbaseenums.c @@ -748,10 +748,10 @@ gimp_pdb_proc_type_get_type (void) static const GimpEnumDesc descs[] = { - { GIMP_INTERNAL, "GIMP_INTERNAL", NULL }, - { GIMP_PLUGIN, "GIMP_PLUGIN", NULL }, - { GIMP_EXTENSION, "GIMP_EXTENSION", NULL }, - { GIMP_TEMPORARY, "GIMP_TEMPORARY", NULL }, + { GIMP_INTERNAL, N_("Internal GIMP procedure"), NULL }, + { GIMP_PLUGIN, N_("GIMP Plug-In"), NULL }, + { GIMP_EXTENSION, N_("GIMP Extension"), NULL }, + { GIMP_TEMPORARY, N_("Temporary Procedure"), NULL }, { 0, NULL, NULL } }; diff --git a/libgimpbase/gimpbaseenums.h b/libgimpbase/gimpbaseenums.h index 7fd5d839f7..a32fec7998 100644 --- a/libgimpbase/gimpbaseenums.h +++ b/libgimpbase/gimpbaseenums.h @@ -337,10 +337,10 @@ GType gimp_pdb_proc_type_get_type (void) G_GNUC_CONST; typedef enum { - GIMP_INTERNAL, - GIMP_PLUGIN, - GIMP_EXTENSION, - GIMP_TEMPORARY + GIMP_INTERNAL, /*< desc="Internal GIMP procedure" >*/ + GIMP_PLUGIN, /*< desc="GIMP Plug-In" >*/ + GIMP_EXTENSION, /*< desc="GIMP Extension" >*/ + GIMP_TEMPORARY /*< desc="Temporary Procedure" >*/ } GimpPDBProcType; diff --git a/plug-ins/dbbrowser/gimpprocview.c b/plug-ins/dbbrowser/gimpprocview.c index 76bce93e92..8cfded031e 100644 --- a/plug-ins/dbbrowser/gimpprocview.c +++ b/plug-ins/dbbrowser/gimpprocview.c @@ -39,13 +39,11 @@ /* local function prototypes */ -static GtkWidget * gimp_proc_view_create_params (GimpParamDef *params, - gint n_params, - GtkSizeGroup *name_group, - GtkSizeGroup *type_group, - GtkSizeGroup *desc_group); -static const gchar * GimpPDBArgType_to_string (GimpPDBArgType type); -static const gchar * GimpPDBProcType_to_string (GimpPDBProcType type); +static GtkWidget * gimp_proc_view_create_params (GimpParamDef *params, + gint n_params, + GtkSizeGroup *name_group, + GtkSizeGroup *type_group, + GtkSizeGroup *desc_group); /* public functions */ @@ -72,6 +70,7 @@ gimp_proc_view_new (const gchar *name, GtkSizeGroup *name_group; GtkSizeGroup *type_group; GtkSizeGroup *desc_group; + const gchar *type_str; gint row; if (blurb && strlen (blurb) < 2) blurb = NULL; @@ -97,7 +96,11 @@ gimp_proc_view_new (const gchar *name, gtk_container_add (GTK_CONTAINER (frame), vbox); gtk_widget_show (vbox); - label = gtk_label_new (GimpPDBProcType_to_string (type)); + if (! gimp_enum_get_value (GIMP_TYPE_PDB_PROC_TYPE, type, + NULL, NULL, &type_str, NULL)) + type_str = "UNKNOWN"; + + label = gtk_label_new (type_str); gimp_label_set_attributes (GTK_LABEL (label), PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC, -1); @@ -240,10 +243,8 @@ gimp_proc_view_create_params (GimpParamDef *params, GtkSizeGroup *type_group, GtkSizeGroup *desc_group) { - GtkWidget *table; - GtkWidget *label; - const gchar *type; - gint i; + GtkWidget *table; + gint i; table = gtk_table_new (n_params, 3, FALSE); gtk_table_set_col_spacings (GTK_TABLE (table), 6); @@ -251,6 +252,10 @@ gimp_proc_view_create_params (GimpParamDef *params, for (i = 0; i < n_params; i++) { + GtkWidget *label; + const gchar *type; + gchar *upper; + /* name */ label = gtk_label_new (params[i].name); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0); @@ -260,8 +265,15 @@ gimp_proc_view_create_params (GimpParamDef *params, gtk_widget_show (label); /* type */ - type = GimpPDBArgType_to_string (params[i].type); - label = gtk_label_new (type); + if (! gimp_enum_get_value (GIMP_TYPE_PDB_ARG_TYPE, params[i].type, + NULL, &type, NULL, NULL)) + upper = g_strdup ("UNKNOWN"); + else + upper = g_ascii_strup (type, -1); + + label = gtk_label_new (upper); + g_free (upper); + gimp_label_set_attributes (GTK_LABEL (label), PANGO_ATTR_FAMILY, "monospace", PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC, @@ -285,48 +297,3 @@ gimp_proc_view_create_params (GimpParamDef *params, return table; } - -static const gchar * -GimpPDBArgType_to_string (GimpPDBArgType type) -{ - switch (type) - { - case GIMP_PDB_INT32: return "INT32"; - case GIMP_PDB_INT16: return "INT16"; - case GIMP_PDB_INT8: return "INT8"; - case GIMP_PDB_FLOAT: return "FLOAT"; - case GIMP_PDB_STRING: return "STRING"; - case GIMP_PDB_INT32ARRAY: return "INT32ARRAY"; - case GIMP_PDB_INT16ARRAY: return "INT16ARRAY"; - case GIMP_PDB_INT8ARRAY: return "INT8ARRAY"; - case GIMP_PDB_FLOATARRAY: return "FLOATARRAY"; - case GIMP_PDB_STRINGARRAY: return "STRINGARRAY"; - case GIMP_PDB_COLOR: return "COLOR"; - case GIMP_PDB_REGION: return "REGION"; - case GIMP_PDB_DISPLAY: return "DISPLAY"; - case GIMP_PDB_IMAGE: return "IMAGE"; - case GIMP_PDB_LAYER: return "LAYER"; - case GIMP_PDB_CHANNEL: return "CHANNEL"; - case GIMP_PDB_DRAWABLE: return "DRAWABLE"; - case GIMP_PDB_SELECTION: return "SELECTION"; - case GIMP_PDB_BOUNDARY: return "BOUNDARY"; - case GIMP_PDB_PATH: return "PATH"; - case GIMP_PDB_PARASITE: return "PARASITE"; - case GIMP_PDB_STATUS: return "STATUS"; - case GIMP_PDB_END: return "END"; - default: return "UNKNOWN?"; - } -} - -static const gchar * -GimpPDBProcType_to_string (GimpPDBProcType type) -{ - switch (type) - { - case GIMP_INTERNAL: return _("Internal GIMP procedure"); - case GIMP_PLUGIN: return _("GIMP Plug-In"); - case GIMP_EXTENSION: return _("GIMP Extension"); - case GIMP_TEMPORARY: return _("Temporary Procedure"); - default: return "UNKNOWN"; - } -} diff --git a/tools/pdbgen/pdb/procedural_db.pdb b/tools/pdbgen/pdb/procedural_db.pdb index 285ece6d3c..8c2ebc1c74 100644 --- a/tools/pdbgen/pdb/procedural_db.pdb +++ b/tools/pdbgen/pdb/procedural_db.pdb @@ -207,8 +207,8 @@ HELP $inargs[$#inargs]->{desc} =~ s - ; + ; @outargs = ( { name => 'procedure_names', type => 'stringarray', void_ret => 1, @@ -428,7 +428,6 @@ $extra{app}->{decls} = <<'CODE'; #define COMPAT_BLURB "This procedure is deprecated! Use '%s' instead." -/* Query structure */ typedef struct _PDBQuery PDBQuery; struct _PDBQuery @@ -462,24 +461,8 @@ struct _PDBStrings gchar *date; }; -static gchar *proc_type_str[] = -{ - N_("Internal GIMP procedure"), - N_("GIMP Plug-In"), - N_("GIMP Extension"), - N_("Temporary Procedure") -}; - -static const gchar * const type_str[] = -{ CODE -foreach (@{$Gimp::CodeGen::enums::enums{GimpPDBArgType}->{symbols}}) { - $extra{app}->{decls} .= qq/ "$_",\n/; -} - -$extra{app}->{decls} =~ s/,\n$/\n};\n/; - $extra{app}->{code} = <<'CODE'; static int match_strings (regex_t *preg, @@ -521,11 +504,13 @@ procedural_db_query_entry (gpointer key, gpointer value, gpointer user_data) { - PDBQuery *pdb_query = user_data; - GList *list; - ProcRecord *proc; - const gchar *proc_name; - PDBStrings strings; + PDBQuery *pdb_query = user_data; + GList *list; + ProcRecord *proc; + const gchar *proc_name; + PDBStrings strings; + GEnumClass *enum_class; + GimpEnumDesc *type_desc; proc_name = key; @@ -541,14 +526,17 @@ procedural_db_query_entry (gpointer key, get_pdb_strings (&strings, proc, pdb_query->querying_compat); + enum_class = g_type_class_ref (GIMP_TYPE_PDB_PROC_TYPE); + type_desc = gimp_enum_get_desc (enum_class, proc->proc_type); + g_type_class_unref (enum_class); + if (! match_strings (&pdb_query->name_regex, proc_name) && ! match_strings (&pdb_query->blurb_regex, strings.blurb) && ! match_strings (&pdb_query->help_regex, strings.help) && ! match_strings (&pdb_query->author_regex, strings.author) && ! match_strings (&pdb_query->copyright_regex, strings.copyright) && ! match_strings (&pdb_query->date_regex, strings.date) && - ! match_strings (&pdb_query->proc_type_regex, - proc_type_str[(gint) proc->proc_type])) + ! match_strings (&pdb_query->proc_type_regex, type_desc->value_desc)) { pdb_query->num_procs++; pdb_query->list_of_procs = g_renew (gchar *, pdb_query->list_of_procs, @@ -600,6 +588,8 @@ procedural_db_print_entry (gpointer key, gpointer user_data) { ProcRecord *procedure; + GEnumClass *arg_class; + GEnumClass *proc_class; GString *buf; GList *list; FILE *file; @@ -609,10 +599,16 @@ procedural_db_print_entry (gpointer key, list = (GList *) value; file = (FILE *) user_data; + arg_class = g_type_class_ref (GIMP_TYPE_PDB_ARG_TYPE); + proc_class = g_type_class_ref (GIMP_TYPE_PDB_PROC_TYPE); + buf = g_string_new (""); while (list) { + GEnumValue *arg_value; + GimpEnumDesc *type_desc; + num++; procedure = (ProcRecord*) list->data; list = list->next; @@ -627,20 +623,25 @@ procedural_db_print_entry (gpointer key, else output_string (file, procedure->name); + type_desc = gimp_enum_get_desc (proc_class, procedure->proc_type); + output_string (file, procedure->blurb); output_string (file, procedure->help); output_string (file, procedure->author); output_string (file, procedure->copyright); output_string (file, procedure->date); - output_string (file, proc_type_str[(int) procedure->proc_type]); + output_string (file, type_desc->value_desc); fprintf (file, "( "); for (i = 0; i < procedure->num_args; i++) { fprintf (file, "( "); - output_string (file, procedure->args[i].name ); - output_string (file, type_str[procedure->args[i].arg_type]); + arg_value = g_enum_get_value (arg_class, + procedure->args[i].arg_type); + + output_string (file, procedure->args[i].name); + output_string (file, arg_value->value_name); output_string (file, procedure->args[i].description); fprintf (file, " ) "); @@ -651,8 +652,12 @@ procedural_db_print_entry (gpointer key, for (i = 0; i < procedure->num_values; i++) { fprintf (file, "( "); - output_string (file, procedure->values[i].name ); - output_string (file, type_str[procedure->values[i].arg_type]); + + arg_value = g_enum_get_value (arg_class, + procedure->values[i].arg_type); + + output_string (file, procedure->values[i].name); + output_string (file, arg_value->value_name); output_string (file, procedure->values[i].description); fprintf (file, " ) "); @@ -662,9 +667,14 @@ procedural_db_print_entry (gpointer key, } g_string_free (buf, TRUE); + + g_type_class_unref (arg_class); + g_type_class_unref (proc_class); } CODE +@headers = qw("libgimpbase/gimpbase.h"); + @procs = qw(procedural_db_temp_name procedural_db_dump procedural_db_query procedural_db_proc_info procedural_db_proc_arg procedural_db_proc_val