diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2001-10-27 02:21:57 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2001-10-27 02:21:57 +0800 |
commit | 12333f4dff98802f83a9d0c5f1881345cc3be058 (patch) | |
tree | 05083e03eb79b5ae1ed5f37e7a74c170024b8e68 /shell/e-shell-folder-creation-dialog.c | |
parent | 86a201c22b648be7ce815f64e2cd80b54c6edc8a (diff) | |
download | gsoc2013-evolution-12333f4dff98802f83a9d0c5f1881345cc3be058.tar.gz 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-folder-creation-dialog.c')
-rw-r--r-- | shell/e-shell-folder-creation-dialog.c | 42 |
1 files changed, 5 insertions, 37 deletions
diff --git a/shell/e-shell-folder-creation-dialog.c b/shell/e-shell-folder-creation-dialog.c index d46002a410..04487d5560 100644 --- a/shell/e-shell-folder-creation-dialog.c +++ b/shell/e-shell-folder-creation-dialog.c @@ -39,6 +39,7 @@ #include "e-storage-set.h" #include "e-storage-set-view.h" +#include "e-shell-utils.h" #include "e-shell-folder-creation-dialog.h" @@ -112,40 +113,6 @@ async_create_cb (EStorageSet *storage_set, e_storage_result_to_string (result)); } - -/* Sanity check for the user-specified folder name. */ -/* FIXME in the future we would like not to have the `G_DIR_SEPARATOR' limitation. */ -static gboolean -entry_name_is_valid (GtkEntry *entry, char **reason) -{ - const char *name; - - name = gtk_entry_get_text (entry); - - if (name == NULL || *name == '\0') { - *reason = _("No folder name specified."); - return FALSE; - } - - /* GtkEntry is broken - if you hit KP_ENTER you get a \r inserted... */ - if (strchr (name, '\r')) { - *reason = _("Folder name cannot contain the Return character."); - return FALSE; - } - - if (strchr (name, G_DIR_SEPARATOR) != NULL) { - *reason = _("Folder cannot contain the directory separator."); - return FALSE; - } - - if (strcmp (name, ".") == 0 || strcmp (name, "..") == 0) { - *reason = _("'.' and '..' are reserved folder names."); - return FALSE; - } - - return TRUE; -} - /* Dialog signal callbacks. */ @@ -159,8 +126,8 @@ dialog_clicked_cb (GnomeDialog *dialog, GtkWidget *folder_type_menu_item; const char *folder_type; const char *parent_path; + const char *reason; char *folder_name; - char *reason; char *path; dialog_data = (DialogData *) data; @@ -175,7 +142,9 @@ dialog_clicked_cb (GnomeDialog *dialog, return; } - if (!entry_name_is_valid (GTK_ENTRY (dialog_data->folder_name_entry), &reason)) { + folder_name = e_utf8_gtk_entry_get_text (GTK_ENTRY (dialog_data->folder_name_entry)); + + if (! e_shell_folder_name_is_valid (folder_name, &reason)) { e_notice (GTK_WINDOW (dialog), GNOME_MESSAGE_BOX_ERROR, _("The specified folder name is not valid: %s"), reason); return; @@ -193,7 +162,6 @@ dialog_clicked_cb (GnomeDialog *dialog, return; } - folder_name = e_utf8_gtk_entry_get_text (GTK_ENTRY (dialog_data->folder_name_entry)); path = g_concat_dir_and_file (parent_path, folder_name); g_free (folder_name); |