[gimp/metadata-browser: 7/45] New function: xmp_model_find_xmptype_by
- From: Roman Joost <romanofski src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/metadata-browser: 7/45] New function: xmp_model_find_xmptype_by
- Date: Tue, 19 Feb 2013 23:40:19 +0000 (UTC)
commit 0d9b025eb0fff35116db33c12fb64e68813dc4f3
Author: Roman Joost <roman bromeco de>
Date: Sun Sep 4 17:28:38 2011 +1000
New function: xmp_model_find_xmptype_by
New function to return an XMPType. This is needed for widgets to
determine which raw value has to be set.
plug-ins/metadata/xmp-model.c | 39 +++++++++++++++++++++++++++++++++++++++
plug-ins/metadata/xmp-model.h | 4 ++++
2 files changed, 43 insertions(+), 0 deletions(-)
---
diff --git a/plug-ins/metadata/xmp-model.c b/plug-ins/metadata/xmp-model.c
index a5d0d3e..27bef92 100644
--- a/plug-ins/metadata/xmp-model.c
+++ b/plug-ins/metadata/xmp-model.c
@@ -1069,6 +1069,45 @@ xmp_model_set_property (XMPModel *xmp_model,
}
/**
+ * xmp_model_find_xmptype_by:
+ * @xmp_model: An #XMPModel
+ * @schema_name: An #XMPSchema the property belongs to. Can be a schema
+ * URI or prefix.
+ * @property_name: The name of the property to find the type for
+ *
+ * Finds the corresponding XMPType for the given schema and property
+ * name.
+ *
+ * Return value: XMPType or -1 if the property type can not be found.
+ **/
+XMPType
+xmp_model_find_xmptype_by (XMPModel *xmp_model,
+ const gchar *schema_name,
+ const gchar *property_name)
+{
+ XMPSchema *schema;
+ XMPProperty *property = NULL;
+ int i;
+
+ schema = find_xmp_schema_by_uri (xmp_model, schema_name);
+ if (! schema)
+ schema = find_xmp_schema_prefix (xmp_model, schema_name);
+
+ if (schema)
+ {
+ if (schema->properties != NULL)
+ for (i = 0; schema->properties[i].name != NULL; ++i)
+ if (! strcmp (schema->properties[i].name, property_name))
+ {
+ property = &(schema->properties[i]);
+ return property->type;
+ }
+ }
+
+ return -1;
+}
+
+/**
* xmp_model_property_changed:
* @xmp_model: An #XMPModel
* @schema: An #XMPSchema the property belongs to
diff --git a/plug-ins/metadata/xmp-model.h b/plug-ins/metadata/xmp-model.h
index fd85c28..bb13e3e 100644
--- a/plug-ins/metadata/xmp-model.h
+++ b/plug-ins/metadata/xmp-model.h
@@ -109,6 +109,10 @@ const gchar *xmp_model_get_scalar_property (XMPModel *xmp_model,
const gchar *schema_name,
const gchar *property_name);
+XMPType xmp_model_find_xmptype_by (XMPModel *xmp_model,
+ const gchar *schema_name,
+ const gchar *property_name);
+
gboolean xmp_model_set_property (XMPModel *xmp_model,
XMPType type,
const gchar *schema_name,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]