[gimp/gimp-2-10] app: add "new-func" and "get-standard-func" properties to GimpDataFactory
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] app: add "new-func" and "get-standard-func" properties to GimpDataFactory
- Date: Mon, 4 Jun 2018 12:52:10 +0000 (UTC)
commit aae538a4e5141505cdaf6a77794a1d5d28421f3d
Author: Michael Natterer <mitch gimp org>
Date: Mon Jun 4 12:18:13 2018 +0200
app: add "new-func" and "get-standard-func" properties to GimpDataFactory
to make it behave better, and as preparation for further subclassing.
(cherry picked from commit 2ca408d1463b5aa46a47927f592c3f7f70941784)
app/core/gimpdatafactory.c | 47 +++++++++++++++++++++++++++++++++++++---------
app/text/gimpfontfactory.c | 1 +
2 files changed, 39 insertions(+), 9 deletions(-)
---
diff --git a/app/core/gimpdatafactory.c b/app/core/gimpdatafactory.c
index 551152637d..3f6900188e 100644
--- a/app/core/gimpdatafactory.c
+++ b/app/core/gimpdatafactory.c
@@ -58,7 +58,9 @@ enum
PROP_GIMP,
PROP_DATA_TYPE,
PROP_PATH_PROPERTY_NAME,
- PROP_WRITABLE_PROPERTY_NAME
+ PROP_WRITABLE_PROPERTY_NAME,
+ PROP_NEW_FUNC,
+ PROP_GET_STANDARD_FUNC
};
@@ -78,13 +80,13 @@ struct _GimpDataFactoryPrivate
gchar *path_property_name;
gchar *writable_property_name;
+ GimpDataNewFunc data_new_func;
+ GimpDataGetStandardFunc data_get_standard_func;
+
GimpAsyncSet *async_set;
const GimpDataFactoryLoaderEntry *loader_entries;
gint n_loader_entries;
-
- GimpDataNewFunc data_new_func;
- GimpDataGetStandardFunc data_get_standard_func;
};
#define GET_PRIVATE(obj) (((GimpDataFactory *) (obj))->priv)
@@ -202,6 +204,18 @@ gimp_data_factory_class_init (GimpDataFactoryClass *klass)
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property (object_class, PROP_NEW_FUNC,
+ g_param_spec_pointer ("new-func",
+ NULL, NULL,
+ GIMP_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
+ g_object_class_install_property (object_class, PROP_GET_STANDARD_FUNC,
+ g_param_spec_pointer ("get-standard-func",
+ NULL, NULL,
+ GIMP_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
g_type_class_add_private (klass, sizeof (GimpDataFactoryPrivate));
}
@@ -260,6 +274,14 @@ gimp_data_factory_set_property (GObject *object,
priv->writable_property_name = g_value_dup_string (value);
break;
+ case PROP_NEW_FUNC:
+ priv->data_new_func = g_value_get_pointer (value);
+ break;
+
+ case PROP_GET_STANDARD_FUNC:
+ priv->data_get_standard_func = g_value_get_pointer (value);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -292,6 +314,14 @@ gimp_data_factory_get_property (GObject *object,
g_value_set_string (value, priv->writable_property_name);
break;
+ case PROP_NEW_FUNC:
+ g_value_set_pointer (value, priv->data_new_func);
+ break;
+
+ case PROP_GET_STANDARD_FUNC:
+ g_value_set_pointer (value, priv->data_get_standard_func);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -621,13 +651,12 @@ gimp_data_factory_new (Gimp *gimp,
"data-type", data_type,
"path-property-name", path_property_name,
"writable-property-name", writable_property_name,
+ "new-func", new_func,
+ "get-standard-func", get_standard_func,
NULL);
- factory->priv->loader_entries = loader_entries;
- factory->priv->n_loader_entries = n_loader_entries;
-
- factory->priv->data_new_func = new_func;
- factory->priv->data_get_standard_func = get_standard_func;
+ factory->priv->loader_entries = loader_entries;
+ factory->priv->n_loader_entries = n_loader_entries;
return factory;
}
diff --git a/app/text/gimpfontfactory.c b/app/text/gimpfontfactory.c
index 51795c6127..390067dbe9 100644
--- a/app/text/gimpfontfactory.c
+++ b/app/text/gimpfontfactory.c
@@ -214,6 +214,7 @@ gimp_font_factory_new (Gimp *gimp,
"gimp", gimp,
"data-type", GIMP_TYPE_FONT,
"path-property-name", path_property_name,
+ "get-standard-func", gimp_font_get_standard,
NULL);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]