From: Dirk-Jan C. Binnema Date: Fri, 27 Jul 2007 16:07:03 +0000 (+0000) Subject: * don't accept folder names starting with ' ', take copy-paste into account X-Git-Tag: git_migration_finished~2714 X-Git-Url: http://git.maemo.org/git/?p=modest;a=commitdiff_plain;h=01caca884dfff113cacec47e7758f01b9bbe07d0 * don't accept folder names starting with ' ', take copy-paste into account this should fix NB#58923 pmo-trunk-r2831 --- diff --git a/src/maemo/modest-platform.c b/src/maemo/modest-platform.c index 1089275..3fec988 100644 --- a/src/maemo/modest-platform.c +++ b/src/maemo/modest-platform.c @@ -566,18 +566,26 @@ entry_insert_text (GtkEditable *editable, hildon_banner_show_information (gtk_widget_get_parent (GTK_WIDGET (data)), NULL, _CS("ckdg_ib_maximum_characters_reached")); } else { - if (chars_length == 0) { - /* A blank space is not valid as first character */ - if (strcmp (text, " ")) { - GtkWidget *ok_button; - GList *buttons; - - /* Show OK button */ - buttons = gtk_container_get_children (GTK_CONTAINER (GTK_DIALOG (data)->action_area)); - ok_button = GTK_WIDGET (buttons->next->data); + gboolean is_valid = FALSE; + + if (!text) + is_valid = FALSE; + else if (strlen(text) == 0 && g_str_has_prefix (chars, " ")) + is_valid = FALSE; + else + is_valid = !g_str_has_prefix(text, " "); + + /* A blank space is not valid as first character */ + if (is_valid) { + GtkWidget *ok_button; + GList *buttons; + + /* Show OK button */ + buttons = gtk_container_get_children (GTK_CONTAINER (GTK_DIALOG (data)->action_area)); + ok_button = GTK_WIDGET (buttons->next->data); gtk_widget_set_sensitive (ok_button, TRUE); g_list_free (buttons); - } + } /* Write the text in the entry */