[gimp/metadata-browser: 1/13] Update the xmp-model widgets in case values have been already set.



commit 8c3d08ee90bd6b4ffea7593ba620ee9e9a6090b1
Author: Roman Joost <roman bromeco de>
Date:   Thu Jul 22 22:17:46 2010 +1000

    Update the xmp-model widgets in case values have been already set.
    
    This commit makes use of the persistent XMP metadata parasite. The
    editor rereads the parasite and updates the widgets with the current
    attached XMP data.

 plug-ins/metadata/gimpxmpmodelwidget.c |    8 ++++++++
 plug-ins/metadata/metadata.c           |    7 +++----
 plug-ins/metadata/xmp-model.c          |    2 +-
 3 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/plug-ins/metadata/gimpxmpmodelwidget.c b/plug-ins/metadata/gimpxmpmodelwidget.c
index 726bac9..02a4dab 100644
--- a/plug-ins/metadata/gimpxmpmodelwidget.c
+++ b/plug-ins/metadata/gimpxmpmodelwidget.c
@@ -143,6 +143,7 @@ gimp_xmp_model_widget_constructor (GObject *object)
   GimpXmpModelWidget        *widget = GIMP_XMP_MODEL_WIDGET (object);
   GimpXmpModelWidgetPrivate *priv;
   gchar                     *signal;
+  const gchar               *value;
 
   priv = GIMP_XMP_MODEL_WIDGET_GET_PRIVATE (object);
 
@@ -154,6 +155,13 @@ gimp_xmp_model_widget_constructor (GObject *object)
                     G_CALLBACK (gimp_xmp_model_widget_xmpmodel_changed),
                     widget);
 
+  // update the widget in case the xmp-model has already a value set
+  value = xmp_model_get_scalar_property (priv->xmp_model,
+                                         priv->schema_uri,
+                                         priv->property_name);
+  if (value != NULL)
+    gimp_xmp_model_widget_set_text (widget, value);
+
   g_free (signal);
 }
 
diff --git a/plug-ins/metadata/metadata.c b/plug-ins/metadata/metadata.c
index cf37a83..cb033a9 100644
--- a/plug-ins/metadata/metadata.c
+++ b/plug-ins/metadata/metadata.c
@@ -526,12 +526,11 @@ run (const gchar      *name,
       run_mode = param[0].data.d_int32;
       if (run_mode == GIMP_RUN_INTERACTIVE)
         {
-          if (! metadata_dialog (image_ID, xmp_model))
-            status = GIMP_PDB_CANCEL;
+          status = GIMP_PDB_CANCEL;
+          if (metadata_dialog (image_ID, xmp_model))
+            status = GIMP_PDB_SUCCESS;
         }
 
-      g_printerr ("Not implemented yet (EDITOR_PROC)\n");
-      status = GIMP_PDB_EXECUTION_ERROR;
     }
   else
     {
diff --git a/plug-ins/metadata/xmp-model.c b/plug-ins/metadata/xmp-model.c
index f8de017..086b4da 100644
--- a/plug-ins/metadata/xmp-model.c
+++ b/plug-ins/metadata/xmp-model.c
@@ -716,7 +716,7 @@ parse_set_property (XMPParseContext     *context,
           tmp_name = g_strconcat (name, " [", value[i], "]", NULL);
           gtk_tree_store_append (GTK_TREE_STORE (xmp_model), &child_iter, &iter);
           gtk_tree_store_set (GTK_TREE_STORE (xmp_model), &child_iter,
-                              COL_XMP_NAME, tmp_name,
+                              COL_XMP_NAME, name,
                               COL_XMP_VALUE, value[i + 1],
                               COL_XMP_VALUE_RAW, value,
                               COL_XMP_TYPE_XREF, property,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]