On editor "check names", if a name (without address) is not resolved,
authorJose Dapena Paz <jdapena@igalia.com>
Thu, 26 Feb 2009 09:34:32 +0000 (09:34 +0000)
committerJose Dapena Paz <jdapena@igalia.com>
Thu, 26 Feb 2009 09:34:32 +0000 (09:34 +0000)
we wipe the name from recipient field (fixes NB#102423).

pmo-trunk-r7690

src/hildon2/modest-address-book.c
src/widgets/modest-recpt-editor.c

index 71d758d..267b713 100644 (file)
@@ -818,6 +818,12 @@ modest_address_book_check_names (ModestRecptEditor *recpt_editor, gboolean updat
                                        new_length = g_utf8_strlen (recipients, -1);
                                        offset_delta = offset_delta + new_length - last_length;
                                        last_length = new_length;                                       
+                               } else {
+                                       /* We have to remove the recipient if not resolved */
+                                       modest_recpt_editor_replace_with_resolved_recipient (recpt_editor,
+                                                                                            &start_iter, &end_iter,
+                                                                                            NULL,
+                                                                                            NULL);
                                }
                        } else {
                                /* this address is not valid, select it and return control to user showing banner */
index 45b7ec2..b4caefc 100644 (file)
@@ -280,27 +280,30 @@ modest_recpt_editor_replace_with_resolved_recipient (ModestRecptEditor *recpt_ed
 
        gtk_text_buffer_delete (buffer, start, end);
 
-       tag = gtk_text_buffer_create_tag (buffer, NULL, 
-                                         "underline", PANGO_UNDERLINE_SINGLE,
-                                         "wrap-mode", GTK_WRAP_NONE,
-                                         "editable", TRUE, NULL);
-
-       g_object_set_data (G_OBJECT (tag), "recipient-tag-id", GINT_TO_POINTER (RECIPIENT_TAG_ID));
-       g_object_set_data_full (G_OBJECT (tag), "recipient-id", g_strdup (recipient_id), (GDestroyNotify) g_free);
-
-       for (node = email_list; node != NULL; node = g_slist_next (node)) {
-               gchar *recipient = (gchar *) node->data;
-
-               if ((recipient) && (strlen (recipient) != 0)) {
-
-                       if (!is_first_recipient)
-                       gtk_text_buffer_insert (buffer, start, "\n", -1);
-
-                       gtk_text_buffer_insert_with_tags (buffer, start, recipient, -1, tag, NULL);
-
-                       if (node->next != NULL)
-                               gtk_text_buffer_insert (buffer, start, ";", -1);
-                       is_first_recipient = FALSE;
+       if (email_list) {
+         
+               tag = gtk_text_buffer_create_tag (buffer, NULL, 
+                                                 "underline", PANGO_UNDERLINE_SINGLE,
+                                                 "wrap-mode", GTK_WRAP_NONE,
+                                                 "editable", TRUE, NULL);
+
+               g_object_set_data (G_OBJECT (tag), "recipient-tag-id", GINT_TO_POINTER (RECIPIENT_TAG_ID));
+               g_object_set_data_full (G_OBJECT (tag), "recipient-id", g_strdup (recipient_id), (GDestroyNotify) g_free);
+               
+               for (node = email_list; node != NULL; node = g_slist_next (node)) {
+                       gchar *recipient = (gchar *) node->data;
+
+                       if ((recipient) && (strlen (recipient) != 0)) {
+                               
+                               if (!is_first_recipient)
+                                       gtk_text_buffer_insert (buffer, start, "\n", -1);
+
+                               gtk_text_buffer_insert_with_tags (buffer, start, recipient, -1, tag, NULL);
+                               
+                               if (node->next != NULL)
+                                       gtk_text_buffer_insert (buffer, start, ";", -1);
+                               is_first_recipient = FALSE;
+                       }
                }
        }
        g_signal_handlers_unblock_by_func (buffer, modest_recpt_editor_on_insert_text, recpt_editor);