Skip to content

Commit bc1371a

Browse files
committed
Fix iop label editing.
Ensure that when editing we are displaying the localized name and not the internal "_builtin_scene-referred default" for example. So we compare the current translated multi_name to the actual entry text to check if the value has changed.
1 parent 133159f commit bc1371a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/develop/imageop.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -829,14 +829,17 @@ static gboolean _rename_module_key_press(GtkWidget *entry,
829829
{
830830
if(gtk_entry_get_text_length(GTK_ENTRY(entry)) > 0)
831831
{
832-
// name is not empty, set new multi_name
832+
// name is not empty, set new multi_name only if changed
833+
// ensure we keep the built-in as-is
833834

834835
const gchar *name = gtk_entry_get_text(GTK_ENTRY(entry));
836+
gchar *current_name = dt_util_localize_segmented_name(module->multi_name, FALSE);
835837

836-
if(g_strcmp0(module->multi_name, name) != 0)
838+
if(g_strcmp0(current_name, name) != 0)
837839
{
838840
dt_iop_update_multi_name(module, name, TRUE, TRUE, TRUE);
839841
}
842+
g_free(current_name);
840843
}
841844
else
842845
{
@@ -898,12 +901,15 @@ void dt_iop_gui_rename_module(dt_iop_module_t *module)
898901
gtk_widget_set_name(entry, "iop-panel-label");
899902
gtk_entry_set_width_chars(GTK_ENTRY(entry), 0);
900903
gtk_entry_set_max_length(GTK_ENTRY(entry), sizeof(module->multi_name) - 1);
904+
905+
gchar *name = dt_util_localize_segmented_name(module->multi_name, FALSE);
901906
gtk_entry_set_text(GTK_ENTRY(entry),
902907
strcmp(module->multi_name, "0")
903908
|| module->multi_priority > 0
904909
|| module->multi_name_hand_edited
905-
? module->multi_name
910+
? name
906911
: "");
912+
g_free(name);
907913

908914
// hide module instance name as we need the space for the entry
909915
gtk_widget_hide(module->instance_name);

0 commit comments

Comments
 (0)