[nautilus/wip/corey/batch-rename: 1/2] batch-rename-dialog: Fix insert and delete text signals




commit 79a30d392786406b1d3ed49c819ddf3753dec2bf
Author: Corey Berla <corey berla me>
Date:   Sun Aug 21 16:19:29 2022 -0700

    batch-rename-dialog: Fix insert and delete text signals
    
    Similar to 60b0a8ae87075374d56b5e3a766a63e5bcdd39ee in gtk4
    the delete-text and insert-text should be connected to the
    editable delegate of the entry as the entry does not emit those
    signals.
    
    Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2442

 src/nautilus-batch-rename-dialog.c               | 6 ++++--
 src/resources/ui/nautilus-batch-rename-dialog.ui | 2 --
 2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/nautilus-batch-rename-dialog.c b/src/nautilus-batch-rename-dialog.c
index 128db5e8e..c116ff35a 100644
--- a/src/nautilus-batch-rename-dialog.c
+++ b/src/nautilus-batch-rename-dialog.c
@@ -1896,8 +1896,6 @@ nautilus_batch_rename_dialog_class_init (NautilusBatchRenameDialogClass *klass)
     gtk_widget_class_bind_template_callback (widget_class, select_next_conflict_up);
     gtk_widget_class_bind_template_callback (widget_class, select_next_conflict_down);
     gtk_widget_class_bind_template_callback (widget_class, batch_rename_dialog_on_response);
-    gtk_widget_class_bind_template_callback (widget_class, on_insert_text);
-    gtk_widget_class_bind_template_callback (widget_class, on_delete_text);
 }
 
 GtkWidget *
@@ -2073,6 +2071,10 @@ nautilus_batch_rename_dialog_init (NautilusBatchRenameDialog *self)
     g_signal_connect (self->original_name_listbox, "row-selected", G_CALLBACK (row_selected), self);
     g_signal_connect (self->arrow_listbox, "row-selected", G_CALLBACK (row_selected), self);
     g_signal_connect (self->result_listbox, "row-selected", G_CALLBACK (row_selected), self);
+    g_signal_connect_object (gtk_editable_get_delegate (GTK_EDITABLE (self->name_entry)),
+                             "delete-text", G_CALLBACK (on_delete_text), self, 0);
+    g_signal_connect_object (gtk_editable_get_delegate (GTK_EDITABLE (self->name_entry)),
+                             "insert-text", G_CALLBACK (on_insert_text), self, 0);
 
     self->size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
 
diff --git a/src/resources/ui/nautilus-batch-rename-dialog.ui 
b/src/resources/ui/nautilus-batch-rename-dialog.ui
index 9da1770d6..0b4793400 100644
--- a/src/resources/ui/nautilus-batch-rename-dialog.ui
+++ b/src/resources/ui/nautilus-batch-rename-dialog.ui
@@ -179,8 +179,6 @@
                                 <property name="hexpand">True</property>
                                 <property name="activates-default">True</property>
                                 <signal name="activate" handler="file_names_widget_on_activate" 
swapped="yes"/>
-                                <signal name="insert-text" handler="on_insert_text" swapped="no"/>
-                                <signal name="delete-text" handler="on_delete_text" swapped="no"/>
                               </object>
                             </child>
                             <child>


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