[nautilus] batch-rename-dialog: differentiate "files" and "folders" in the title



commit 7823e5efdfd8a6d8656feb46e44b19f6f81c42ff
Author: Alexandru Pandelea <alexandru pandelea gmail com>
Date:   Wed Sep 7 23:41:22 2016 +0300

    batch-rename-dialog: differentiate "files" and "folders" in the title
    
    If all renamed files are folders, then the title will be:
    "Rename %d Folders"
    
    https://bugzilla.gnome.org/show_bug.cgi?id=770974

 src/nautilus-batch-rename-dialog.c |   27 ++++++++++++++++++++++++---
 1 files changed, 24 insertions(+), 3 deletions(-)
---
diff --git a/src/nautilus-batch-rename-dialog.c b/src/nautilus-batch-rename-dialog.c
index b5eb422..9357d25 100644
--- a/src/nautilus-batch-rename-dialog.c
+++ b/src/nautilus-batch-rename-dialog.c
@@ -3165,6 +3165,8 @@ nautilus_batch_rename_dialog_new (GList             *selection,
 {
     NautilusBatchRenameDialog *dialog;
     GString *dialog_title;
+    GList *l;
+    gboolean all_targets_are_folders;
 
     dialog = g_object_new (NAUTILUS_TYPE_BATCH_RENAME_DIALOG, "use-header-bar", TRUE, NULL);
 
@@ -3175,10 +3177,29 @@ nautilus_batch_rename_dialog_new (GList             *selection,
     gtk_window_set_transient_for (GTK_WINDOW (dialog),
                                   GTK_WINDOW (window));
 
+    all_targets_are_folders = TRUE;
+    for (l = selection; l != NULL; l = l->next)
+    {
+        if (!nautilus_file_is_directory (NAUTILUS_FILE (l->data)))
+        {
+            all_targets_are_folders = FALSE;
+            break;
+        }
+    }
+
     dialog_title = g_string_new ("");
-    g_string_append_printf (dialog_title,
-                            ngettext ("Rename %d File", "Rename %d Files", g_list_length (selection)),
-                            g_list_length (selection));
+    if (all_targets_are_folders)
+    {
+        g_string_append_printf (dialog_title,
+                                ngettext ("Rename %d Folder", "Rename %d Folders", g_list_length 
(selection)),
+                                g_list_length (selection));
+    }
+    else
+    {
+        g_string_append_printf (dialog_title,
+                                ngettext ("Rename %d File", "Rename %d Files", g_list_length (selection)),
+                                g_list_length (selection));
+    }
     gtk_window_set_title (GTK_WINDOW (dialog), dialog_title->str);
 
     nautilus_batch_rename_dialog_initialize_actions (dialog);


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