diff --git a/plug-ins/metadata/gimpxmpmodelentry.c b/plug-ins/metadata/gimpxmpmodelentry.c index 950200ed23..ddc74d2393 100644 --- a/plug-ins/metadata/gimpxmpmodelentry.c +++ b/plug-ins/metadata/gimpxmpmodelentry.c @@ -19,7 +19,8 @@ #include -#include +#include +#include #include "xmp-schemas.h" #include "xmp-model.h" @@ -37,6 +38,8 @@ static void entry_changed (GimpXMPModelEntry *widget); const gchar* find_schema_prefix (const gchar *schema_uri); +static void set_property_edit_icon (GimpXMPModelEntry *entry, + GtkTreeIter *iter); G_DEFINE_TYPE (GimpXMPModelEntry, gimp_xmp_model_entry, GTK_TYPE_ENTRY) @@ -109,14 +112,19 @@ gimp_entry_xmp_model_changed (XMPModel *xmp_model, GimpXMPModelEntry *entry = GIMP_XMP_MODEL_ENTRY (user_data); const gchar *tree_value; const gchar *property_name; + GdkPixbuf *icon; gtk_tree_model_get (GTK_TREE_MODEL (xmp_model), iter, COL_XMP_NAME, &property_name, COL_XMP_VALUE, &tree_value, + COL_XMP_EDIT_ICON, &icon, -1); if (! strcmp (entry->property_name, property_name)) gtk_entry_set_text (GTK_ENTRY (entry), tree_value); + if (icon == NULL) + set_property_edit_icon (entry, iter); + return; } @@ -128,7 +136,6 @@ entry_changed (GimpXMPModelEntry *entry) entry->schema_uri, entry->property_name, gtk_entry_get_text (GTK_ENTRY (entry))); - } /* find the schema prefix for the given URI */ @@ -144,3 +151,35 @@ find_schema_prefix (const gchar *schema_uri) } return NULL; } + +static void +set_property_edit_icon (GimpXMPModelEntry *entry, + GtkTreeIter *iter) +{ + GdkPixbuf *icon; + gboolean editable; + + gtk_tree_model_get (GTK_TREE_MODEL (entry->xmp_model), iter, + COL_XMP_EDITABLE, &editable, + COL_XMP_EDIT_ICON, &icon, + -1); + + if (editable == XMP_AUTO_UPDATE) + { + icon = gtk_widget_render_icon (GTK_WIDGET (entry), GIMP_STOCK_WILBER, + GTK_ICON_SIZE_MENU, NULL); + gtk_tree_store_set (GTK_TREE_STORE (entry->xmp_model), iter, + COL_XMP_EDIT_ICON, icon, + -1); + } + else if (editable == TRUE) + { + icon = gtk_widget_render_icon (GTK_WIDGET (entry), GTK_STOCK_EDIT, + GTK_ICON_SIZE_MENU, NULL); + gtk_tree_store_set (GTK_TREE_STORE (entry->xmp_model), iter, + COL_XMP_EDIT_ICON, icon, + -1); + } + + return; +} diff --git a/plug-ins/metadata/interface.c b/plug-ins/metadata/interface.c index a2569db9be..31c8d31af9 100644 --- a/plug-ins/metadata/interface.c +++ b/plug-ins/metadata/interface.c @@ -285,7 +285,6 @@ add_description_tab (GtkWidget *notebook, entry, 1, FALSE); entry = gimp_xmp_model_entry_new (XMP_SCHEMA_DUBLIN_CORE, "creator", mgui->xmp_model); - //register_entry_xref (entry, XMP_SCHEMA_DUBLIN_CORE, "creator", mgui); gimp_table_attach_aligned (GTK_TABLE (table), 0, 1, _("_Author:"), 0.0, 0.5, entry, 1, FALSE); @@ -309,8 +308,7 @@ add_description_tab (GtkWidget *notebook, _("_Description:"), 0.0, 0.5, scrolled_window, 1, FALSE); - entry = gtk_entry_new (); - register_entry_xref (entry, XMP_SCHEMA_PHOTOSHOP, "CaptionWriter", mgui); + entry = gimp_xmp_model_entry_new (XMP_SCHEMA_PHOTOSHOP, "CaptionWriter", mgui->xmp_model); gimp_table_attach_aligned (GTK_TABLE (table), 0, 3, _("Description _writer:"), 0.0, 0.5, entry, 1, FALSE);