diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2001-08-31 05:04:45 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-08-31 05:04:45 +0800 |
commit | 8ece4a00866094801a036d49d361c21ee420c333 (patch) | |
tree | b3d0f7f07eb2ced5b024634226eb69d0cff625e8 | |
parent | 35ecbe2de53cac6071b705c171b3e222f973c851 (diff) | |
download | gsoc2013-evolution-8ece4a00866094801a036d49d361c21ee420c333.tar gsoc2013-evolution-8ece4a00866094801a036d49d361c21ee420c333.tar.gz gsoc2013-evolution-8ece4a00866094801a036d49d361c21ee420c333.tar.bz2 gsoc2013-evolution-8ece4a00866094801a036d49d361c21ee420c333.tar.lz gsoc2013-evolution-8ece4a00866094801a036d49d361c21ee420c333.tar.xz gsoc2013-evolution-8ece4a00866094801a036d49d361c21ee420c333.tar.zst gsoc2013-evolution-8ece4a00866094801a036d49d361c21ee420c333.zip |
Check for \r in the folder name, this is an invalid char. Also take a
2001-08-30 Jeffrey Stedfast <fejj@ximian.com>
* e-shell-folder-creation-dialog.c (entry_name_is_valid): Check
for \r in the folder name, this is an invalid char. Also take a
"reason" argument so we can inform the user why his folder name is
invalid.
(dialog_clicked_cb): Tell the user why the folder name is invalid.
svn path=/trunk/; revision=12533
-rw-r--r-- | shell/ChangeLog | 8 | ||||
-rw-r--r-- | shell/e-shell-folder-creation-dialog.c | 38 |
2 files changed, 33 insertions, 13 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index ba60165303..a736d59c11 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,11 @@ +2001-08-30 Jeffrey Stedfast <fejj@ximian.com> + + * e-shell-folder-creation-dialog.c (entry_name_is_valid): Check + for \r in the folder name, this is an invalid char. Also take a + "reason" argument so we can inform the user why his folder name is + invalid. + (dialog_clicked_cb): Tell the user why the folder name is invalid. + 2001-08-28 Ettore Perazzoli <ettore@ximian.com> [Fix #8125, Evolution crashes while starting.] diff --git a/shell/e-shell-folder-creation-dialog.c b/shell/e-shell-folder-creation-dialog.c index 52b66d742e..cead2d2745 100644 --- a/shell/e-shell-folder-creation-dialog.c +++ b/shell/e-shell-folder-creation-dialog.c @@ -112,25 +112,37 @@ 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) +entry_name_is_valid (GtkEntry *entry, char **reason) { const char *name; - + name = gtk_entry_get_text (entry); - - if (name == NULL || *name == '\0') + + if (name == NULL || *name == '\0') { + *reason = _("No folder name specified."); return FALSE; - - if (strchr (name, G_DIR_SEPARATOR) != NULL) + } + + /* 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 (strcmp (name, ".") == 0 || strcmp (name, "..") == 0) + } + + 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; } @@ -148,6 +160,7 @@ dialog_clicked_cb (GnomeDialog *dialog, const char *folder_type; const char *parent_path; char *folder_name; + char *reason; char *path; dialog_data = (DialogData *) data; @@ -162,10 +175,9 @@ dialog_clicked_cb (GnomeDialog *dialog, return; } - if (! entry_name_is_valid (GTK_ENTRY (dialog_data->folder_name_entry))) { - /* FIXME: Explain better. */ + if (!entry_name_is_valid (GTK_ENTRY (dialog_data->folder_name_entry), &reason)) { e_notice (GTK_WINDOW (dialog), GNOME_MESSAGE_BOX_ERROR, - _("The specified folder name is not valid.")); + _("The specified folder name is not valid: %s"), reason); return; } |