[nautilus] batch-rename-dialog: disable rename button on empty name



commit f11e467c45abed0c5a043d7dc9a9f83680506a77
Author: Alexandru Pandelea <alexandru pandelea gmail com>
Date:   Mon Sep 19 21:33:10 2016 +0300

    batch-rename-dialog: disable rename button on empty name
    
    If the new name has no characters, then the Rename button will be
    disabled.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=771652

 src/nautilus-batch-rename-dialog.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/src/nautilus-batch-rename-dialog.c b/src/nautilus-batch-rename-dialog.c
index ad71bd3..82c1e04 100644
--- a/src/nautilus-batch-rename-dialog.c
+++ b/src/nautilus-batch-rename-dialog.c
@@ -971,6 +971,7 @@ update_listbox (NautilusBatchRenameDialog *dialog)
     gchar *old_name;
     GtkLabel *label;
     GString *new_name;
+    gboolean empty_name = FALSE;
 
     for (l1 = dialog->new_names, l2 = dialog->listbox_labels_new; l1 != NULL && l2 != NULL; l1 = l1->next, 
l2 = l2->next)
     {
@@ -978,6 +979,11 @@ update_listbox (NautilusBatchRenameDialog *dialog)
         new_name = l1->data;
 
         gtk_label_set_label (label, new_name->str);
+
+        if (g_strcmp0 (new_name->str, "") == 0)
+        {
+            empty_name = TRUE;
+        }
     }
 
     for (l1 = dialog->selection, l2 = dialog->listbox_labels_old; l1 != NULL && l2 != NULL; l1 = l1->next, 
l2 = l2->next)
@@ -1005,6 +1011,13 @@ update_listbox (NautilusBatchRenameDialog *dialog)
 
     update_rows_height (dialog);
 
+    if (empty_name)
+    {
+        gtk_widget_set_sensitive (dialog->rename_button, FALSE);
+
+        return;
+    }
+
     /* check if there are name conflicts and display them if they exist */
     if (dialog->duplicates != NULL)
     {


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