From 01caca884dfff113cacec47e7758f01b9bbe07d0 Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Fri, 27 Jul 2007 16:07:03 +0000 Subject: [PATCH] * don't accept folder names starting with ' ', take copy-paste into account this should fix NB#58923 pmo-trunk-r2831 --- src/maemo/modest-platform.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) 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 */ -- 1.7.9.5