Handle properly zoom in hildon 2.2
[modest] / src / hildon2 / modest-address-book.c
index 6964ed3..2302ed4 100644 (file)
@@ -445,10 +445,18 @@ commit_contact(EContact * contact, gboolean is_new)
        if (OSSO_ABOOK_IS_CONTACT (contact)) {
                osso_abook_contact_commit(OSSO_ABOOK_CONTACT(contact), is_new, book, NULL);
        } else {
-               if (is_new)
-                       e_book_add_contact (book, contact, NULL);
-               else
-                       e_book_commit_contact (book, contact, NULL);
+               GError *err = NULL;
+               if (is_new) {
+                       if (!e_book_add_contact (book, contact, &err)) {
+                               g_warning ("Failed to add contact: %s", err->message);
+                               g_error_free (err);
+                       }
+               } else {
+                       if (!e_book_commit_contact (book, contact, &err)) {
+                               g_warning ("Failed to commit contact: %s", err->message);
+                               g_error_free (err);
+                       }
+               }
        }
 #endif /* MODEST_ABOOK_API < 2 */
 }
@@ -901,12 +909,20 @@ 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 if (canceled) {
-                                       /* 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 {
+                                       if (canceled) {
+                                               /* 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 {
+                                               /* There is no contact with that name so it's not
+                                                  valid. Don't show any error because it'll be done
+                                                  later */
+                                               result = FALSE;
+                                       }
                                }
                        } else {
                                /* this address is not valid, select it and return control to user showing banner */
@@ -1101,9 +1117,9 @@ resolve_address (const gchar *address,
                clean_check_names_banner (info);
                return FALSE;
        }
-       hide_check_names_banner (info);
 
        resolved_contacts = get_contacts_for_name (address);
+       hide_check_names_banner (info);
 
        if (resolved_contacts == NULL) {
                /* no matching contacts for the search string */