X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=src%2Fmaemo%2Fmodest-address-book.c;h=c6a3d7671a4106fd9354260b4882e02fc3485041;hb=b969746bd8d9e021f79a19350e85a6fdbd3226a5;hp=163046ee1bd4f1b6c7f3e25e5cd7d8974ed3585b;hpb=9dfcf2eabe661d6d9837e7ceb3ee4cacf6690a03;p=modest diff --git a/src/maemo/modest-address-book.c b/src/maemo/modest-address-book.c index 163046e..c6a3d76 100644 --- a/src/maemo/modest-address-book.c +++ b/src/maemo/modest-address-book.c @@ -62,14 +62,12 @@ static GSList *select_email_addrs_for_contact(GList * email_addr_list); static gboolean resolve_address (const gchar *address, GSList **resolved_addresses, gchar **contact_id); static gchar *unquote_string (const gchar *str); - static void unref_gobject (GObject *obj) { if (obj) g_object_unref (obj); } - static void get_book_view_cb (EBook *book, EBookStatus status, EBookView *bookview, gpointer data) @@ -133,7 +131,8 @@ open_addressbook_sync () } void -modest_address_book_add_address (const gchar *address) +modest_address_book_add_address (const gchar *address, + GtkWindow *parent) { OssoABookAccount *account = NULL; GtkWidget *dialog = NULL; @@ -149,13 +148,18 @@ modest_address_book_add_address (const gchar *address) } email_address = modest_text_utils_get_email_address (address); - + account = osso_abook_account_get (EVC_EMAIL, NULL, email_address); g_free (email_address); if (account) { dialog = osso_abook_add_to_contacts_dialog_new (contact_model, account); g_object_unref (account); + + modest_window_mgr_set_modal (modest_runtime_get_window_mgr(), + (GtkWindow *) parent, + (GtkWindow *) dialog); + gtk_dialog_run (GTK_DIALOG (dialog)); if (contact_model) { @@ -169,7 +173,8 @@ modest_address_book_add_address (const gchar *address) } void -modest_address_book_select_addresses (ModestRecptEditor *recpt_editor) +modest_address_book_select_addresses (ModestRecptEditor *recpt_editor, + GtkWindow *parent_window) { #if MODEST_ABOOK_API < 4 GtkWidget *contact_view = NULL; @@ -508,7 +513,7 @@ run_add_email_addr_to_contact_dlg(const gchar * contact_name) if ((invalid_char_offset != NULL)&&(*invalid_char_offset != '\0')) { gchar *char_in_string = g_strdup_printf ("%c", *invalid_char_offset); gchar *message = g_strdup_printf( - dgettext("hildon-common-strings", "ckdg_ib_illegal_characters_entered"), + _CS("ckdg_ib_illegal_characters_entered"), char_in_string); hildon_banner_show_information ( add_email_addr_to_contact_dlg, NULL, message ); @@ -701,7 +706,8 @@ hide_check_names_banner (GtkWidget **banner, guint banner_timeout) } gboolean -modest_address_book_check_names (ModestRecptEditor *recpt_editor, gboolean update_addressbook) +modest_address_book_check_names (ModestRecptEditor *recpt_editor, + GSList **address_list) { const gchar *recipients = NULL; GSList *start_indexes = NULL, *end_indexes = NULL; @@ -753,11 +759,11 @@ modest_address_book_check_names (ModestRecptEditor *recpt_editor, gboolean updat if ((invalid_char_position != NULL) && (*invalid_char_position != '\0')) { gchar *char_in_string = g_strdup_printf("%c", *invalid_char_position); gchar *message = g_strdup_printf( - dgettext("hildon-common-strings", "ckdg_ib_illegal_characters_entered"), + _CS("ckdg_ib_illegal_characters_entered"), char_in_string); g_free (char_in_string); hildon_banner_show_information (NULL, NULL, message ); - g_free (message); + g_free (message); result = FALSE; } else if (strstr (address, "@") == NULL) { /* here goes searching in addressbook */ @@ -802,14 +808,14 @@ modest_address_book_check_names (ModestRecptEditor *recpt_editor, gboolean updat } g_slist_free (tags); if (!has_recipient) { - GSList * address_list = NULL; + GSList * addr_list = NULL; - address_list = g_slist_prepend (address_list, address); + addr_list = g_slist_prepend (addr_list, address); modest_recpt_editor_replace_with_resolved_recipient (recpt_editor, &start_iter, &end_iter, - address_list, + addr_list, ""); - g_slist_free (address_list); + g_slist_free (addr_list); store_address = TRUE; } } @@ -817,10 +823,11 @@ modest_address_book_check_names (ModestRecptEditor *recpt_editor, gboolean updat /* so, it seems a valid address */ /* note: adding it the to the addressbook if it did not exist yet, * and adding it to the recent_list */ - if (result && update_addressbook && store_address) - add_to_address_book (address); + if (result && address_list && store_address) + *address_list = g_slist_prepend (*address_list, address); + else + g_free (address); - g_free (address); if (result == FALSE) break; @@ -828,6 +835,10 @@ modest_address_book_check_names (ModestRecptEditor *recpt_editor, gboolean updat current_end = g_slist_next (current_end); } + /* Remove dup's */ + if (address_list && *address_list) + *address_list = modest_text_utils_remove_duplicate_addresses_list (*address_list); + if (current_start == NULL) { gtk_text_buffer_get_end_iter (buffer, &end_iter); gtk_text_buffer_place_cursor (buffer, &end_iter); @@ -1038,3 +1049,23 @@ modest_address_book_has_address (const gchar *address) return result; } + +const gchar * +modest_address_book_get_my_name () +{ + /* There is no support to get my own contact in this version */ + return NULL; +} + + +void +modest_address_book_init (void) +{ + open_addressbook (); +} + +void +modest_address_book_add_address_list (GSList *address_list) +{ + +}