[gimp/gimp-2-10] plug-ins: use g_log instead of g_printerr when setting tag fails.
- From: Jacob Boerema <jboerema src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] plug-ins: use g_log instead of g_printerr when setting tag fails.
- Date: Wed, 2 Dec 2020 00:10:48 +0000 (UTC)
commit f131ede108f46deefa26223ccbc4320a775411b3
Author: Jacob Boerema <jgboerema gmail com>
Date: Mon Nov 30 18:18:32 2020 -0500
plug-ins: use g_log instead of g_printerr when setting tag fails.
By using g_log with G_LOG_LEVEL_MESSAGE and empty domain
name we make sure the failure to write a tag will be seen by
the user in GIMP's user interface (error console or error
dialog).
(cherry picked from commit c4fa4fcda0d86fd06f52d5ba1c47075aa017c3b0)
plug-ins/metadata/metadata-editor.c | 54 ++++++++++++++++---------------------
1 file changed, 23 insertions(+), 31 deletions(-)
---
diff --git a/plug-ins/metadata/metadata-editor.c b/plug-ins/metadata/metadata-editor.c
index ea9ab8dbd9..e7931116d4 100644
--- a/plug-ins/metadata/metadata-editor.c
+++ b/plug-ins/metadata/metadata-editor.c
@@ -4323,6 +4323,13 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata,
* ============================================================================
*/
+static void
+set_tag_failed (const gchar *tag)
+{
+ g_log ("", G_LOG_LEVEL_MESSAGE,
+ _("Failed to set metadata tag %s"), tag);
+}
+
static void
set_tag_string (GimpMetadata *metadata,
const gchar *name,
@@ -4337,7 +4344,7 @@ set_tag_string (GimpMetadata *metadata,
if (! gexiv2_metadata_set_tag_string (GEXIV2_METADATA (metadata),
name, value))
{
- g_printerr ("metadata-editor: failed to set tag [%s]\n", name);
+ set_tag_failed (name);
}
}
@@ -5136,8 +5143,7 @@ metadata_editor_write_callback (GtkWidget *dialog,
creatorContactInfoHeader.header,
"type=\"Struct\""))
{
- g_printerr ("failed to set tag [%s]\n",
- creatorContactInfoTags[i].tag);
+ set_tag_failed (creatorContactInfoTags[i].tag);
}
for (i = 0; i < creatorContactInfoHeader.size; i++)
@@ -5153,8 +5159,7 @@ metadata_editor_write_callback (GtkWidget *dialog,
creatorContactInfoTags[i].tag,
gtk_entry_get_text (entry)))
{
- g_printerr ("failed to set tag [%s]\n",
- creatorContactInfoTags[i].tag);
+ set_tag_failed (creatorContactInfoTags[i].tag);
}
}
else if (! strcmp ("multi", creatorContactInfoTags[i].mode))
@@ -5175,8 +5180,7 @@ metadata_editor_write_callback (GtkWidget *dialog,
creatorContactInfoTags[i].tag,
text))
{
- g_printerr ("failed to set tag [%s]\n",
- creatorContactInfoTags[i].tag);
+ set_tag_failed (creatorContactInfoTags[i].tag);
}
g_free (text);
@@ -5244,8 +5248,7 @@ metadata_editor_write_callback (GtkWidget *dialog,
default_metadata_tags[i].tag,
alt_str))
{
- g_printerr ("failed to set tag [%s]\n",
- default_metadata_tags[i].tag);
+ set_tag_failed (default_metadata_tags[i].tag);
}
}
else
@@ -5265,8 +5268,7 @@ metadata_editor_write_callback (GtkWidget *dialog,
default_metadata_tags[i].tag,
text_value))
{
- g_printerr ("failed to set tag [%s]\n",
- default_metadata_tags[i].tag);
+ set_tag_failed (default_metadata_tags[i].tag);
}
}
else if (default_metadata_tags[i].xmp_type == GIMP_XMP_BAG)
@@ -5280,8 +5282,7 @@ metadata_editor_write_callback (GtkWidget *dialog,
default_metadata_tags[i].tag,
text_value))
{
- g_printerr ("failed to set tag [%s]\n",
- default_metadata_tags[i].tag);
+ set_tag_failed (default_metadata_tags[i].tag);
}
}
else if (default_metadata_tags[i].xmp_type == GIMP_XMP_SEQ)
@@ -5295,8 +5296,7 @@ metadata_editor_write_callback (GtkWidget *dialog,
default_metadata_tags[i].tag,
text_value))
{
- g_printerr ("failed to set tag [%s]\n",
- default_metadata_tags[i].tag);
+ set_tag_failed (default_metadata_tags[i].tag);
}
}
@@ -5309,8 +5309,7 @@ metadata_editor_write_callback (GtkWidget *dialog,
equivalent_metadata_tags[index].tag,
text_value))
{
- g_printerr ("failed to set tag [%s]\n",
- equivalent_metadata_tags[index].tag);
+ set_tag_failed (equivalent_metadata_tags[index].tag);
}
}
}
@@ -5345,8 +5344,7 @@ metadata_editor_write_callback (GtkWidget *dialog,
default_metadata_tags[i].tag,
text))
{
- g_printerr ("failed to set tag [%s]\n",
- default_metadata_tags[i].tag);
+ set_tag_failed (default_metadata_tags[i].tag);
}
}
else if (default_metadata_tags[i].xmp_type == GIMP_XMP_BAG)
@@ -5360,8 +5358,7 @@ metadata_editor_write_callback (GtkWidget *dialog,
default_metadata_tags[i].tag,
text))
{
- g_printerr ("failed to set tag [%s]\n",
- default_metadata_tags[i].tag);
+ set_tag_failed (default_metadata_tags[i].tag);
}
}
else if (default_metadata_tags[i].xmp_type == GIMP_XMP_SEQ)
@@ -5375,8 +5372,7 @@ metadata_editor_write_callback (GtkWidget *dialog,
default_metadata_tags[i].tag,
text))
{
- g_printerr ("failed to set tag [%s]\n",
- default_metadata_tags[i].tag);
+ set_tag_failed (default_metadata_tags[i].tag);
}
}
@@ -5392,8 +5388,7 @@ metadata_editor_write_callback (GtkWidget *dialog,
equivalent_metadata_tags[index].tag,
(const gchar **) multi))
{
- g_printerr ("failed to set tag [%s]\n",
- equivalent_metadata_tags[index].tag);
+ set_tag_failed (equivalent_metadata_tags[index].tag);
}
g_strfreev (multi);
@@ -5500,8 +5495,7 @@ metadata_editor_write_callback (GtkWidget *dialog,
default_metadata_tags[i].tag,
"male"))
{
- g_printerr ("failed to set tag [%s]\n",
- default_metadata_tags[i].tag);
+ set_tag_failed (default_metadata_tags[i].tag);
}
break;
@@ -5510,8 +5504,7 @@ metadata_editor_write_callback (GtkWidget *dialog,
default_metadata_tags[i].tag,
"female"))
{
- g_printerr ("failed to set tag [%s]\n",
- default_metadata_tags[i].tag);
+ set_tag_failed (default_metadata_tags[i].tag);
}
break;
@@ -5520,8 +5513,7 @@ metadata_editor_write_callback (GtkWidget *dialog,
default_metadata_tags[i].tag,
"other"))
{
- g_printerr ("failed to set tag [%s]\n",
- default_metadata_tags[i].tag);
+ set_tag_failed (default_metadata_tags[i].tag);
}
break;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]