app: use the GParamSpec's name in gimp_pdb_dump()

and remove gimp_pdb_compat_arg_type_from_gtype(). The core is now free
of PDB legacy code.
This commit is contained in:
Michael Natterer 2019-08-30 11:42:14 +02:00
parent f8b8d99aca
commit 967cbb4fad
6 changed files with 15 additions and 116 deletions

View File

@ -148,6 +148,7 @@ AM_LDFLAGS = \
-Wl,-u,$(SYMPREFIX)gimp_operations_init \
-Wl,-u,$(SYMPREFIX)xcf_init \
-Wl,-u,$(SYMPREFIX)internal_procs_init \
-Wl,-u,$(SYMPREFIX)gimp_pdb_compat_procs_register \
-Wl,-u,$(SYMPREFIX)gimp_plug_in_manager_restore \
-Wl,-u,$(SYMPREFIX)gimp_layer_mode_is_legacy \
-Wl,-u,$(SYMPREFIX)gimp_parallel_init \

View File

@ -90,6 +90,7 @@ test_config_LDFLAGS = \
-Wl,-u,$(SYMPREFIX)gimp_param_spec_duplicate \
-Wl,-u,$(SYMPREFIX)xcf_init \
-Wl,-u,$(SYMPREFIX)internal_procs_init \
-Wl,-u,$(SYMPREFIX)gimp_pdb_compat_procs_register \
-Wl,-u,$(SYMPREFIX)gimp_plug_in_manager_restore \
-Wl,-u,$(SYMPREFIX)gimp_layer_mode_is_legacy \
-Wl,-u,$(SYMPREFIX)gimp_async_set_new \

View File

@ -21,94 +21,14 @@
#include <gegl.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpcolor/gimpcolor.h"
#include "pdb-types.h"
#include "core/gimp.h"
#include "core/gimpimage.h"
#include "core/gimplayer.h"
#include "core/gimplayermask.h"
#include "core/gimpselection.h"
#include "core/gimpparamspecs.h"
#include "vectors/gimpvectors.h"
#include "gimppdb.h"
#include "gimp-pdb-compat.h"
/* public functions */
GimpPDBArgType
gimp_pdb_compat_arg_type_from_gtype (GType type)
{
static GQuark pdb_type_quark = 0;
GimpPDBArgType pdb_type;
if (! pdb_type_quark)
{
struct
{
GType g_type;
GimpPDBArgType pdb_type;
}
type_mapping[] =
{
{ G_TYPE_INT, GIMP_PDB_INT32 },
{ G_TYPE_UINT, GIMP_PDB_INT32 },
{ G_TYPE_ENUM, GIMP_PDB_INT32 },
{ G_TYPE_BOOLEAN, GIMP_PDB_INT32 },
{ G_TYPE_UCHAR, GIMP_PDB_INT8 },
{ G_TYPE_DOUBLE, GIMP_PDB_FLOAT },
{ G_TYPE_STRING, GIMP_PDB_STRING },
{ GIMP_TYPE_RGB, GIMP_PDB_COLOR },
{ GIMP_TYPE_INT32_ARRAY, GIMP_PDB_INT32ARRAY },
{ GIMP_TYPE_INT16_ARRAY, GIMP_PDB_INT16ARRAY },
{ GIMP_TYPE_UINT8_ARRAY, GIMP_PDB_INT8ARRAY },
{ GIMP_TYPE_FLOAT_ARRAY, GIMP_PDB_FLOATARRAY },
{ GIMP_TYPE_STRING_ARRAY, GIMP_PDB_STRINGARRAY },
{ GIMP_TYPE_RGB_ARRAY, GIMP_PDB_COLORARRAY },
{ GIMP_TYPE_ITEM, GIMP_PDB_ITEM },
{ GIMP_TYPE_IMAGE, GIMP_PDB_IMAGE },
{ GIMP_TYPE_LAYER, GIMP_PDB_LAYER },
{ GIMP_TYPE_CHANNEL, GIMP_PDB_CHANNEL },
{ GIMP_TYPE_DRAWABLE, GIMP_PDB_DRAWABLE },
{ GIMP_TYPE_SELECTION, GIMP_PDB_SELECTION },
{ GIMP_TYPE_LAYER_MASK, GIMP_PDB_CHANNEL },
{ GIMP_TYPE_VECTORS, GIMP_PDB_VECTORS },
{ GIMP_TYPE_PARASITE, GIMP_PDB_PARASITE },
{ GIMP_TYPE_PDB_STATUS_TYPE, GIMP_PDB_STATUS }
};
GType type;
gint i;
pdb_type_quark = g_quark_from_static_string ("gimp-pdb-type");
for (i = 0; i < G_N_ELEMENTS (type_mapping); i++)
g_type_set_qdata (type_mapping[i].g_type, pdb_type_quark,
GINT_TO_POINTER (type_mapping[i].pdb_type));
type = g_type_from_name ("GimpDisplay");
if (type)
g_type_set_qdata (type, pdb_type_quark,
GINT_TO_POINTER (GIMP_PDB_DISPLAY));
}
pdb_type = GPOINTER_TO_INT (g_type_get_qdata (type, pdb_type_quark));
return pdb_type;
}
void
gimp_pdb_compat_procs_register (GimpPDB *pdb,
GimpPDBCompatMode compat_mode)

View File

@ -19,10 +19,8 @@
#define __GIMP_PDB_COMPAT_H__
GimpPDBArgType gimp_pdb_compat_arg_type_from_gtype (GType type);
void gimp_pdb_compat_procs_register (GimpPDB *pdb,
GimpPDBCompatMode compat_mode);
void gimp_pdb_compat_procs_register (GimpPDB *pdb,
GimpPDBCompatMode compat_mode);
#endif /* __GIMP_PDB_COMPAT_H__ */

View File

@ -32,7 +32,6 @@
#include "gimppdb.h"
#include "gimppdb-query.h"
#include "gimppdberror.h"
#include "gimp-pdb-compat.h"
#include "gimpprocedure.h"
#include "gimp-intl.h"
@ -452,7 +451,6 @@ gimp_pdb_print_entry (gpointer key,
{
GimpProcedure *procedure = list->data;
PDBStrings strings;
GEnumValue *arg_value;
const GimpEnumDesc *type_desc;
gint i;
@ -484,34 +482,24 @@ gimp_pdb_print_entry (gpointer key,
for (i = 0; i < procedure->num_args; i++)
{
GParamSpec *pspec = procedure->args[i];
GimpPDBArgType arg_type;
arg_type = gimp_pdb_compat_arg_type_from_gtype (pspec->value_type);
arg_value = g_enum_get_value (arg_class, arg_type);
GParamSpec *pspec = procedure->args[i];
if (i > 0)
g_string_append_printf (string, " ");
output_string (string, arg_value->value_name);
output_string (string, G_PARAM_SPEC_TYPE_NAME (pspec));
}
g_string_append_printf (string, ") (");
for (i = 0; i < procedure->num_values; i++)
{
GParamSpec *pspec = procedure->values[i];
GimpPDBArgType arg_type;
arg_type = gimp_pdb_compat_arg_type_from_gtype (pspec->value_type);
arg_value = g_enum_get_value (arg_class, arg_type);
GParamSpec *pspec = procedure->values[i];
if (i > 0)
g_string_append_printf (string, " ");
output_string (string, arg_value->value_name);
output_string (string, G_PARAM_SPEC_TYPE_NAME (pspec))
}
g_string_append_printf (string, "))\n");
@ -540,21 +528,16 @@ gimp_pdb_print_entry (gpointer key,
for (i = 0; i < procedure->num_args; i++)
{
GParamSpec *pspec = procedure->args[i];
GimpPDBArgType arg_type;
gchar *desc = gimp_param_spec_get_desc (pspec);
GParamSpec *pspec = procedure->args[i];
gchar *desc = gimp_param_spec_get_desc (pspec);
g_string_append_printf (string, "\n (\n");
arg_type = gimp_pdb_compat_arg_type_from_gtype (pspec->value_type);
arg_value = g_enum_get_value (arg_class, arg_type);
g_string_append_printf (string, " ");
output_string (string, g_param_spec_get_name (pspec));
g_string_append_printf (string, " ");
output_string (string, arg_value->value_name);
output_string (string, G_PARAM_SPEC_TYPE_NAME (pspec));
g_string_append_printf (string, " ");
output_string (string, desc);
@ -570,21 +553,16 @@ gimp_pdb_print_entry (gpointer key,
for (i = 0; i < procedure->num_values; i++)
{
GParamSpec *pspec = procedure->values[i];
GimpPDBArgType arg_type;
gchar *desc = gimp_param_spec_get_desc (pspec);
GParamSpec *pspec = procedure->values[i];
gchar *desc = gimp_param_spec_get_desc (pspec);
g_string_append_printf (string, "\n (\n");
arg_type = gimp_pdb_compat_arg_type_from_gtype (pspec->value_type);
arg_value = g_enum_get_value (arg_class, arg_type);
g_string_append_printf (string, " ");
output_string (string, g_param_spec_get_name (pspec));
g_string_append_printf (string, " ");
output_string (string, arg_value->value_name);
output_string (string, G_PARAM_SPEC_TYPE_NAME (pspec));
g_string_append_printf (string, " ");
output_string (string, desc);

View File

@ -86,6 +86,7 @@ AM_LDFLAGS = \
-Wl,-u,$(SYMPREFIX)gimp_operations_init \
-Wl,-u,$(SYMPREFIX)xcf_init \
-Wl,-u,$(SYMPREFIX)internal_procs_init \
-Wl,-u,$(SYMPREFIX)gimp_pdb_compat_procs_register \
-Wl,-u,$(SYMPREFIX)gimp_plug_in_manager_restore \
-Wl,-u,$(SYMPREFIX)gimp_layer_mode_is_legacy \
-Wl,-u,$(SYMPREFIX)gui_init \