[nautilus/wip/csoriano/debug: 1/5] batch-rename-dialog: Check if name changed for listbox labels



commit 45c19b04042f508d7764dd6d3d99285385bb1d03
Author: Alexandru Pandelea <alexandru pandelea gmail com>
Date:   Thu Sep 15 10:48:47 2016 +0300

    batch-rename-dialog: Check if name changed for listbox labels
    
    Update the labels in the listbox only when there is a change.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=771460

 src/nautilus-batch-rename-dialog.c |   26 ++++++++++++++++----------
 1 files changed, 16 insertions(+), 10 deletions(-)
---
diff --git a/src/nautilus-batch-rename-dialog.c b/src/nautilus-batch-rename-dialog.c
index 8e3008f..21c8be1 100644
--- a/src/nautilus-batch-rename-dialog.c
+++ b/src/nautilus-batch-rename-dialog.c
@@ -977,7 +977,10 @@ update_listbox (NautilusBatchRenameDialog *dialog)
         label = GTK_LABEL (l2->data);
         new_name = l1->data;
 
-        gtk_label_set_label (label, new_name->str);
+        if (g_strcmp0 (new_name->str, gtk_label_get_text (GTK_LABEL (label))) != 0)
+        {
+            gtk_label_set_label (label, new_name->str);
+        }
     }
 
     for (l1 = dialog->selection, l2 = dialog->listbox_labels_old; l1 != NULL && l2 != NULL; l1 = l1->next, 
l2 = l2->next)
@@ -987,17 +990,20 @@ update_listbox (NautilusBatchRenameDialog *dialog)
 
         old_name = nautilus_file_get_name (file);
 
-        if (dialog->mode == NAUTILUS_BATCH_RENAME_DIALOG_FORMAT)
-        {
-            gtk_label_set_label (label, old_name);
-        }
-        else
+        if (g_strcmp0 (old_name, gtk_label_get_text (GTK_LABEL (label))) != 0)
         {
-            new_name = batch_rename_replace_label_text (old_name,
-                                                        gtk_entry_get_text (GTK_ENTRY (dialog->find_entry)));
-            gtk_label_set_markup (GTK_LABEL (label), new_name->str);
+            if (dialog->mode == NAUTILUS_BATCH_RENAME_DIALOG_FORMAT)
+            {
+                gtk_label_set_label (label, old_name);
+            }
+            else
+            {
+                new_name = batch_rename_replace_label_text (old_name,
+                                                            gtk_entry_get_text (GTK_ENTRY 
(dialog->find_entry)));
+                gtk_label_set_markup (GTK_LABEL (label), new_name->str);
 
-            g_string_free (new_name, TRUE);
+                g_string_free (new_name, TRUE);
+            }
         }
 
         g_free (old_name);


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