mirror of https://github.com/GNOME/gimp.git
app: add parent_type parameter to gimp_gegl_get_config_proxy()
and derive from that type. Use GimpImageMapConfig as base class for GimpOperationTool's config.
This commit is contained in:
parent
e8cc9d1bf5
commit
8bc6f1ee09
|
@ -144,11 +144,15 @@ gimp_gegl_config_class_init (GObjectClass *klass,
|
|||
}
|
||||
|
||||
GimpObject *
|
||||
gimp_gegl_get_config_proxy (const gchar *operation)
|
||||
gimp_gegl_get_config_proxy (const gchar *operation,
|
||||
GType parent_type)
|
||||
{
|
||||
static GHashTable *config_types = NULL;
|
||||
GType config_type;
|
||||
|
||||
g_return_val_if_fail (operation != NULL, NULL);
|
||||
g_return_val_if_fail (g_type_is_a (parent_type, GIMP_TYPE_OBJECT), NULL);
|
||||
|
||||
if (! config_types)
|
||||
config_types = g_hash_table_new_full (g_str_hash,
|
||||
g_str_equal,
|
||||
|
@ -158,16 +162,21 @@ gimp_gegl_get_config_proxy (const gchar *operation)
|
|||
config_type = (GType) g_hash_table_lookup (config_types, operation);
|
||||
|
||||
if (! config_type)
|
||||
{
|
||||
GTypeQuery query;
|
||||
|
||||
g_type_query (parent_type, &query);
|
||||
|
||||
{
|
||||
GTypeInfo info =
|
||||
{
|
||||
sizeof (GimpObjectClass),
|
||||
query.class_size,
|
||||
(GBaseInitFunc) NULL,
|
||||
(GBaseFinalizeFunc) NULL,
|
||||
(GClassInitFunc) gimp_gegl_config_class_init,
|
||||
NULL, /* class_finalize */
|
||||
operation,
|
||||
sizeof (GimpObject),
|
||||
query.instance_size,
|
||||
0, /* n_preallocs */
|
||||
(GInstanceInitFunc) NULL,
|
||||
};
|
||||
|
@ -182,7 +191,8 @@ gimp_gegl_get_config_proxy (const gchar *operation)
|
|||
gchar *type_name = g_strdup_printf ("GimpGegl-%s-config",
|
||||
operation);
|
||||
|
||||
g_strcanon (type_name, G_CSET_DIGITS "-" G_CSET_a_2_z G_CSET_A_2_Z, '-');
|
||||
g_strcanon (type_name,
|
||||
G_CSET_DIGITS "-" G_CSET_a_2_z G_CSET_A_2_Z, '-');
|
||||
|
||||
config_type = g_type_register_static (GIMP_TYPE_OBJECT, type_name,
|
||||
&info, 0);
|
||||
|
@ -196,6 +206,7 @@ gimp_gegl_get_config_proxy (const gchar *operation)
|
|||
g_strdup (operation),
|
||||
(gpointer) config_type);
|
||||
}
|
||||
}
|
||||
|
||||
return g_object_new (config_type, NULL);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,8 @@
|
|||
#define __GIMP_GEGL_CONFIG_PROXY_H__
|
||||
|
||||
|
||||
GimpObject * gimp_gegl_get_config_proxy (const gchar *operation);
|
||||
GimpObject * gimp_gegl_get_config_proxy (const gchar *operation,
|
||||
GType parent_type);
|
||||
|
||||
void gimp_gegl_config_proxy_sync (GimpObject *proxy,
|
||||
GeglNode *node);
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "core/gimperror.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimagemap.h"
|
||||
#include "core/gimpimagemapconfig.h"
|
||||
#include "core/gimpparamspecs-duplicate.h"
|
||||
|
||||
#include "widgets/gimphelp-ids.h"
|
||||
|
@ -246,7 +247,8 @@ gimp_operation_tool_set_operation (GimpOperationTool *tool,
|
|||
|
||||
gimp_image_map_tool_create_map (GIMP_IMAGE_MAP_TOOL (tool));
|
||||
|
||||
tool->config = gimp_gegl_get_config_proxy (tool->operation);
|
||||
tool->config = gimp_gegl_get_config_proxy (tool->operation,
|
||||
GIMP_TYPE_IMAGE_MAP_CONFIG);
|
||||
|
||||
if (tool->options_table)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue