Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions src/gui/metadata_tags.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
This file is part of darktable,
Copyright (C) 2025 darktable developers.
Copyright (C) 2026 darktable developers.

darktable is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -85,7 +85,10 @@ static void _tree_selection_change(GtkTreeSelection *selection, gpointer user_da
gtk_widget_set_sensitive(add_button, nb > 0);
}

GtkWidget *dt_metadata_tags_dialog(GtkWidget *parent, gpointer metadata_activated_callback, gpointer user_data)
GtkWidget *dt_metadata_tags_dialog(GtkWidget *parent,
const gboolean user_editable_only,
gpointer metadata_activated_callback,
gpointer user_data)
{
GtkWidget *dialog = gtk_dialog_new_with_buttons(_("select tag"), GTK_WINDOW(parent),
GTK_DIALOG_DESTROY_WITH_PARENT,
Expand Down Expand Up @@ -124,9 +127,33 @@ GtkWidget *dt_metadata_tags_dialog(GtkWidget *parent, gpointer metadata_activate
if(!taglist)
taglist = (GList *) dt_exif_get_exiv2_taglist();

// list of user-editable tagnames for the metadata editor
const char *allowed_tag_names[] =
{
"Xmp.dc.",
"Xmp.acdsee.",
"Xmp.iptc.",
"Iptc."
};

for(GList *tag = taglist; tag; tag = g_list_next(tag))
{
const char *tagname = tag->data;

if(user_editable_only)
{
// for the metadata editor we only want to expose user-editable fields
gboolean allowed = FALSE;
for(int i = 0; (i < sizeof(allowed_tag_names) / sizeof(allowed_tag_names[0])) && !allowed; i++)
{
if(g_strstr_len(tagname, -1, allowed_tag_names[i]) == tagname)
allowed = TRUE;
}

if(!allowed)
continue;
}

char *type = g_strstr_len(tagname, -1, ",");
if(type)
{
Expand Down
4 changes: 2 additions & 2 deletions src/gui/metadata_tags.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
This file is part of darktable,
Copyright (C) 2025 darktable developers.
Copyright (C) 2026 darktable developers.

darktable is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -17,7 +17,7 @@
*/

gchar *dt_metadata_tags_get_selected();
GtkWidget *dt_metadata_tags_dialog(GtkWidget *parent, gpointer metadata_activated_callback, gpointer user_data);
GtkWidget *dt_metadata_tags_dialog(GtkWidget *parent, const gboolean user_editable_only, gpointer metadata_activated_callback, gpointer user_data);

// clang-format off
// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
Expand Down
4 changes: 2 additions & 2 deletions src/libs/export_metadata.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
This file is part of darktable,
Copyright (C) 2019-2025 darktable developers.
Copyright (C) 2019-2026 darktable developers.
darktable is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -98,7 +98,7 @@ static void _metadata_activated(GtkTreeView *tree_view,
// dialog to add metadata tag into the formula list
static void _add_tag_button_clicked(GtkButton *button, dt_lib_export_metadata_t *d)
{
GtkWidget *dialog = dt_metadata_tags_dialog(d->dialog, _metadata_activated, d);
GtkWidget *dialog = dt_metadata_tags_dialog(d->dialog, FALSE, _metadata_activated, d);

#ifdef GDK_WINDOWING_QUARTZ
dt_osx_disallow_fullscreen(dialog);
Expand Down
4 changes: 2 additions & 2 deletions src/libs/metadata.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
This file is part of darktable,
Copyright (C) 2010-2025 darktable developers.
Copyright (C) 2010-2026 darktable developers.

darktable is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -743,7 +743,7 @@ static void _metadata_activated(GtkTreeView *tree_view,
// dialog to add metadata tag into the formula list
static void _add_tag_button_clicked(GtkButton *button, dt_lib_metadata_t *d)
{
GtkWidget *dialog = dt_metadata_tags_dialog(d->dialog, _metadata_activated, d);
GtkWidget *dialog = dt_metadata_tags_dialog(d->dialog, TRUE, _metadata_activated, d);

#ifdef GDK_WINDOWING_QUARTZ
dt_osx_disallow_fullscreen(dialog);
Expand Down
Loading