summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiana Grecu <dianagrecu07@gmail.com>2017-04-22 14:07:04 +0300
committerErnestas Kulik <ernestask@gnome.org>2017-05-13 19:18:25 +0300
commit0e21d1877e267edf7fa9d8e5dee734b223fc0eda (patch)
tree9b7eced5a7731cf4eff7e7d40841c72c26ff2f7c
parentf5206a6daf0991d91e885a28bb66795a8ae12a41 (diff)
downloadnautilus-0e21d1877e267edf7fa9d8e5dee734b223fc0eda.tar.gz
batch-rename: show error on empty name
When the destination name is empty, the "Rename" button goes insensitive without explaining the user why it happened. To explain what happened show a descriptive message to inform the user. https://bugzilla.gnome.org/show_bug.cgi?id=772435
-rw-r--r--src/nautilus-batch-rename-dialog.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/nautilus-batch-rename-dialog.c b/src/nautilus-batch-rename-dialog.c
index c3a4be26f..ddc1942a6 100644
--- a/src/nautilus-batch-rename-dialog.c
+++ b/src/nautilus-batch-rename-dialog.c
@@ -1354,10 +1354,12 @@ have_unallowed_character (NautilusBatchRenameDialog *dialog)
GList *names;
GString *new_name;
const gchar *entry_text;
+ gboolean have_empty_name;
gboolean have_unallowed_character_slash;
gboolean have_unallowed_character_dot;
gboolean have_unallowed_character_dotdot;
+ have_empty_name = FALSE;
have_unallowed_character_slash = FALSE;
have_unallowed_character_dot = FALSE;
have_unallowed_character_dotdot = FALSE;
@@ -1404,6 +1406,12 @@ have_unallowed_character (NautilusBatchRenameDialog *dialog)
{
new_name = names->data;
+ if (g_strcmp0 (new_name->str, "") == 0)
+ {
+ have_empty_name = TRUE;
+ break;
+ }
+
if (g_strcmp0 (new_name->str, "..") == 0)
{
have_unallowed_character_dotdot = TRUE;
@@ -1412,6 +1420,12 @@ have_unallowed_character (NautilusBatchRenameDialog *dialog)
}
}
+ if (have_empty_name)
+ {
+ gtk_label_set_label (GTK_LABEL (dialog->conflict_label),
+ _("A file must have a name"));
+ }
+
if (have_unallowed_character_slash)
{
gtk_label_set_label (GTK_LABEL (dialog->conflict_label),
@@ -1430,7 +1444,8 @@ have_unallowed_character (NautilusBatchRenameDialog *dialog)
"“..” is an unallowed file name");
}
- if (have_unallowed_character_slash || have_unallowed_character_dot || have_unallowed_character_dotdot)
+ if (have_unallowed_character_slash || have_unallowed_character_dot || have_unallowed_character_dotdot
+ || have_empty_name)
{
gtk_widget_set_sensitive (dialog->rename_button, FALSE);
gtk_widget_set_sensitive (dialog->conflict_down, FALSE);