[nautilus] file-name-widget : Warn if the name will hide the file
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] file-name-widget : Warn if the name will hide the file
- Date: Wed, 25 Jul 2018 13:59:17 +0000 (UTC)
commit bc93e1cc53517c698f3cd44ca0810503237fbae4
Author: Yash Jain <ydjainopensource gmail com>
Date: Mon Jul 23 01:22:04 2018 +0530
file-name-widget : Warn if the name will hide the file
The user should be informed that using a file/folder name starting with
"." will mark it a hidden.
Fixes https://gitlab.gnome.org/GNOME/nautilus/issues/529
Signed-off-by: Yash Jain <ydjainopensource gmail com>
src/nautilus-compress-dialog-controller.c | 6 +++++-
src/nautilus-file-name-widget-controller.c | 5 +++++
src/nautilus-new-folder-dialog-controller.c | 5 +++++
src/nautilus-rename-file-popover-controller.c | 12 ++++++++++++
4 files changed, 27 insertions(+), 1 deletion(-)
---
diff --git a/src/nautilus-compress-dialog-controller.c b/src/nautilus-compress-dialog-controller.c
index 3937181a8..fc8264d26 100644
--- a/src/nautilus-compress-dialog-controller.c
+++ b/src/nautilus-compress-dialog-controller.c
@@ -66,7 +66,11 @@ nautilus_compress_dialog_controller_name_is_valid (NautilusFileNameWidgetControl
{
*error_message = _("An archive cannot be called “..”.");
}
-
+ else if (g_str_has_prefix (name, "."))
+ {
+ *error_message = _("Archives with “.” at the beginning of their name are hidden.");
+ return TRUE;
+ }
return *error_message == NULL;
}
diff --git a/src/nautilus-file-name-widget-controller.c b/src/nautilus-file-name-widget-controller.c
index 9b49b0f4c..6d04ce1ed 100644
--- a/src/nautilus-file-name-widget-controller.c
+++ b/src/nautilus-file-name-widget-controller.c
@@ -122,6 +122,11 @@ real_name_is_valid (NautilusFileNameWidgetController *self,
{
*error_message = _("A file cannot be called “..”.");
}
+ else if (g_str_has_prefix (name, "."))
+ {
+ *error_message = _("Files with “.” at the beginning of their name are hidden.");
+ return TRUE;
+ }
return *error_message == NULL;
}
diff --git a/src/nautilus-new-folder-dialog-controller.c b/src/nautilus-new-folder-dialog-controller.c
index f24d7e3ef..cb51db663 100644
--- a/src/nautilus-new-folder-dialog-controller.c
+++ b/src/nautilus-new-folder-dialog-controller.c
@@ -59,6 +59,11 @@ nautilus_new_folder_dialog_controller_name_is_valid (NautilusFileNameWidgetContr
{
*error_message = _("A folder cannot be called “..”.");
}
+ else if (g_str_has_prefix (name, _(".")))
+ {
+ *error_message = _("Folders with “.” at the beginning of their name are hidden.");
+ return TRUE;
+ }
return *error_message == NULL;
}
diff --git a/src/nautilus-rename-file-popover-controller.c b/src/nautilus-rename-file-popover-controller.c
index 19808b2b7..f93421c51 100644
--- a/src/nautilus-rename-file-popover-controller.c
+++ b/src/nautilus-rename-file-popover-controller.c
@@ -161,6 +161,18 @@ nautilus_rename_file_popover_controller_name_is_valid (NautilusFileNameWidgetCon
*error_message = _("File name is too long.");
}
}
+ else if (g_str_has_prefix (name, "."))
+ {
+ if (self->target_is_folder)
+ {
+ *error_message = _("Folders with “.” at the beginning of their name are hidden.");
+ }
+ else
+ {
+ *error_message = _("Files with “.” at the beginning of their name are hidden.");
+ }
+ return TRUE;
+ }
return *error_message == NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]