aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-shell-utils.c
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2001-10-27 02:21:57 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2001-10-27 02:21:57 +0800
commit12333f4dff98802f83a9d0c5f1881345cc3be058 (patch)
tree05083e03eb79b5ae1ed5f37e7a74c170024b8e68 /shell/e-shell-utils.c
parent86a201c22b648be7ce815f64e2cd80b54c6edc8a (diff)
downloadgsoc2013-evolution-12333f4dff98802f83a9d0c5f1881345cc3be058.tar
gsoc2013-evolution-12333f4dff98802f83a9d0c5f1881345cc3be058.tar.gz
gsoc2013-evolution-12333f4dff98802f83a9d0c5f1881345cc3be058.tar.bz2
gsoc2013-evolution-12333f4dff98802f83a9d0c5f1881345cc3be058.tar.lz
gsoc2013-evolution-12333f4dff98802f83a9d0c5f1881345cc3be058.tar.xz
gsoc2013-evolution-12333f4dff98802f83a9d0c5f1881345cc3be058.tar.zst
gsoc2013-evolution-12333f4dff98802f83a9d0c5f1881345cc3be058.zip
Don't allow invalid folder names. [#12027]
* e-shell-folder-commands.c (e_shell_command_rename_folder): Don't allow invalid folder names. [#12027] * e-shell-folder-creation-dialog.c (entry_name_is_valid): Removed. (dialog_clicked_cb): Use `e_shell_folder_name_is_valid()' instead. * e-shell-utils.c (e_shell_folder_name_is_valid): New. Sorry I18N people, it breaks the string freeze slighty. * e-component-registry.c (component_free): Add a cast. (e_component_registry_restart_component): Argh, use the corba_objref properly in calling `wait_for_corba_object_to_die()'. svn path=/trunk/; revision=14152
Diffstat (limited to 'shell/e-shell-utils.c')
-rw-r--r--shell/e-shell-utils.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/shell/e-shell-utils.c b/shell/e-shell-utils.c
index f5f63c5a91..e916cbe1dc 100644
--- a/shell/e-shell-utils.c
+++ b/shell/e-shell-utils.c
@@ -30,6 +30,7 @@
#include <glib.h>
#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-util.h>
+#include <libgnome/gnome-i18n.h>
#include "e-shell-constants.h"
#include "e-shell-utils.h"
@@ -103,3 +104,39 @@ e_shell_get_icon_path (const char *icon_name,
return get_icon_path (icon_name);
}
+
+
+gboolean
+e_shell_folder_name_is_valid (const char *name,
+ const char **reason_return)
+{
+ if (name == NULL || *name == '\0') {
+ if (reason_return != NULL)
+ *reason_return = _("No folder name specified.");
+ return FALSE;
+ }
+
+ /* GtkEntry is broken - if you hit KP_ENTER you get a \r inserted... */
+ if (strchr (name, '\r')) {
+ if (reason_return != NULL)
+ *reason_return = _("Folder name cannot contain the Return character.");
+ return FALSE;
+ }
+
+ if (strchr (name, G_DIR_SEPARATOR) != NULL) {
+ if (reason_return != NULL)
+ *reason_return = _("Folder name cannot contain slashes.");
+ return FALSE;
+ }
+
+ if (strcmp (name, ".") == 0 || strcmp (name, "..") == 0) {
+ if (reason_return != NULL)
+ *reason_return = _("'.' and '..' are reserved folder names.");
+ return FALSE;
+ }
+
+ *reason_return = NULL;
+
+ return TRUE;
+}
+