[gimp/goat-invasion: 372/608] app: add gimp_gegl_get_config_container()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/goat-invasion: 372/608] app: add gimp_gegl_get_config_container()
- Date: Fri, 27 Apr 2012 20:56:39 +0000 (UTC)
commit a285552131caa828bd1e2b3ce83d4b3e01233d19
Author: Michael Natterer <mitch gimp org>
Date: Sun Apr 1 00:26:11 2012 +0200
app: add gimp_gegl_get_config_container()
which creates and keeps around containers of arbitrary config objects.
app/gegl/gimp-gegl-config-proxy.c | 37 +++++++++++++++++++++++++++++++++----
app/gegl/gimp-gegl-config-proxy.h | 9 +++++----
2 files changed, 38 insertions(+), 8 deletions(-)
---
diff --git a/app/gegl/gimp-gegl-config-proxy.c b/app/gegl/gimp-gegl-config-proxy.c
index 86040d4..b9321d6 100644
--- a/app/gegl/gimp-gegl-config-proxy.c
+++ b/app/gegl/gimp-gegl-config-proxy.c
@@ -27,12 +27,16 @@
#include "gimp-gegl-types.h"
-#include "core/gimpobject.h"
+#include "core/gimplist.h"
#include "core/gimpparamspecs-duplicate.h"
#include "gimp-gegl-config-proxy.h"
+static GHashTable *config_types = NULL;
+static GHashTable *config_containers = NULL;
+
+
static GValue *
gimp_gegl_config_value_new (GParamSpec *pspec)
{
@@ -147,8 +151,7 @@ GimpObject *
gimp_gegl_get_config_proxy (const gchar *operation,
GType parent_type)
{
- static GHashTable *config_types = NULL;
- GType config_type;
+ 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);
@@ -194,7 +197,7 @@ gimp_gegl_get_config_proxy (const gchar *operation,
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,
+ config_type = g_type_register_static (parent_type, type_name,
&info, 0);
g_free (type_name);
@@ -211,6 +214,32 @@ gimp_gegl_get_config_proxy (const gchar *operation,
return g_object_new (config_type, NULL);
}
+GimpContainer *
+gimp_gegl_get_config_container (GType config_type)
+{
+ GimpContainer *container;
+
+ g_return_val_if_fail (g_type_is_a (config_type, GIMP_TYPE_OBJECT), NULL);
+
+ if (! config_containers)
+ config_containers = g_hash_table_new_full (g_direct_hash,
+ g_direct_equal,
+ (GDestroyNotify) g_free,
+ NULL);
+
+ container = g_hash_table_lookup (config_containers, (gpointer) config_type);
+
+ if (! container)
+ {
+ container = gimp_list_new (config_type, TRUE);
+
+ g_hash_table_insert (config_containers,
+ (gpointer) config_type, container);
+ }
+
+ return container;
+}
+
void
gimp_gegl_config_proxy_sync (GimpObject *proxy,
GeglNode *node)
diff --git a/app/gegl/gimp-gegl-config-proxy.h b/app/gegl/gimp-gegl-config-proxy.h
index f6a6794..b5e9312 100644
--- a/app/gegl/gimp-gegl-config-proxy.h
+++ b/app/gegl/gimp-gegl-config-proxy.h
@@ -19,11 +19,12 @@
#define __GIMP_GEGL_CONFIG_PROXY_H__
-GimpObject * gimp_gegl_get_config_proxy (const gchar *operation,
- GType parent_type);
+GimpObject * gimp_gegl_get_config_proxy (const gchar *operation,
+ GType parent_type);
+GimpContainer * gimp_gegl_get_config_container (GType config_type);
-void gimp_gegl_config_proxy_sync (GimpObject *proxy,
- GeglNode *node);
+void gimp_gegl_config_proxy_sync (GimpObject *proxy,
+ GeglNode *node);
#endif /* __GIMP_GEGL_CONFIG_PROXY_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]