Reverted again the gdk_threads_enter/leave sentences:
[modest] / src / maemo / modest-address-book.c
index 5848840..ddb1a7e 100644 (file)
@@ -132,16 +132,19 @@ modest_address_book_add_address (const gchar *address)
        }
        
        account = osso_abook_account_get (EVC_EMAIL, NULL, address);
-       dialog = osso_abook_add_to_contacts_dialog_new (contact_model, account);
-       g_object_unref (account);
-       gtk_dialog_run (GTK_DIALOG (dialog));
+       if (account)
+       {
+               dialog = osso_abook_add_to_contacts_dialog_new (contact_model, account);
+               g_object_unref (account);
+               gtk_dialog_run (GTK_DIALOG (dialog));
 
-       if (contact_model) {
-               g_object_unref (contact_model);
-               contact_model = NULL;
-       }
+               if (contact_model) {
+                       g_object_unref (contact_model);
+                       contact_model = NULL;
+               }
 
-       gtk_widget_destroy (dialog);
+               gtk_widget_destroy (dialog);
+       }
 
 }
 
@@ -160,7 +163,6 @@ modest_address_book_select_addresses (ModestRecptEditor *recpt_editor)
 
        toplevel = gtk_widget_get_toplevel (GTK_WIDGET (recpt_editor));
 
-       contact_model = osso_abook_contact_model_new ();
        if (!open_addressbook ()) {
                if (contact_model) {
                        g_object_unref (contact_model);
@@ -168,12 +170,12 @@ modest_address_book_select_addresses (ModestRecptEditor *recpt_editor)
                }
                return;
        }
+       contact_model = osso_abook_contact_model_new ();
 
        contact_view = osso_abook_contact_selector_new_basic (contact_model);
        osso_abook_contact_selector_set_minimum_selection (OSSO_ABOOK_CONTACT_SELECTOR (contact_view), 1);
 
        contact_dialog = osso_abook_select_dialog_new (OSSO_ABOOK_TREE_VIEW (contact_view));
-       osso_abook_select_dialog_set_new_contact (OSSO_ABOOK_SELECT_DIALOG (contact_dialog), TRUE);
        gtk_window_set_title (GTK_WINDOW (contact_dialog), _("mcen_ti_select_recipients"));
 
        gtk_widget_show (contact_dialog);
@@ -204,11 +206,6 @@ modest_address_book_select_addresses (ModestRecptEditor *recpt_editor)
                g_list_free (contacts_list);
        }
 
-       if (contact_view) {
-               g_object_unref (contact_view);
-               contact_view = NULL;
-       }
-
        if (contact_model) {
                g_object_unref (contact_model);
                contact_model = NULL;
@@ -328,7 +325,7 @@ commit_contact(EContact * contact)
        if (!contact || !book)
                return;
 
-#ifdef MODEST_HILDON_VERSION_0 
+#ifdef MODEST_HAVE_OLD_ABOOK   
        osso_abook_contact_commit(contact, FALSE, book);
 #else
        osso_abook_contact_commit(contact, FALSE, book, NULL);
@@ -574,7 +571,6 @@ modest_address_book_check_names (ModestRecptEditor *recpt_editor)
 
        recipients = modest_recpt_editor_get_recipients (recpt_editor);
        last_length = g_utf8_strlen (recipients, -1);
-       /* g_message ("LENGTH %d", last_length); */
        modest_text_utils_get_addresses_indexes (recipients, &start_indexes, &end_indexes);
 
        if (start_indexes == NULL) {
@@ -603,15 +599,10 @@ modest_address_book_check_names (ModestRecptEditor *recpt_editor)
                gtk_text_buffer_get_iter_at_offset (buffer, &end_iter, end_pos);
                gtk_text_buffer_select_range (buffer, &start_iter, &end_iter);
 
-/*
-               g_message ("RANGE %d - %d", start_pos, end_pos);
-
-               g_message ("ADDRESS %s", address);
-*/
                if (!modest_text_utils_validate_recipient (address)) {
                        if (strstr (address, "@") == NULL) {
                                /* here goes searching in addressbook */
-                               gchar *contact_id = NULL;;
+                               gchar *contact_id = NULL;
                                GSList *resolved_addresses = NULL;
                                result = resolve_address (address, &resolved_addresses, &contact_id);
 
@@ -631,12 +622,11 @@ modest_address_book_check_names (ModestRecptEditor *recpt_editor)
                                        new_length = g_utf8_strlen (recipients, -1);
                                        offset_delta = offset_delta + new_length - last_length;
                                        last_length = new_length;
-                                       /* g_message ("LENGTH %d", last_length); */
                                }
                        } else {
                                /* this address is not valid, select it and return control to user showing banner */
 
-                               hildon_banner_show_information (NULL, NULL, _("mcen_ib_invalid_mail"));
+                               hildon_banner_show_information (NULL, NULL, _("mcen_ib_invalid_email"));
                                result = FALSE;
                        }
                }