From 324b0b5e7372e83bc4b50fa9804825e296785d76 Mon Sep 17 00:00:00 2001 From: Jose Dapena Paz Date: Thu, 24 Apr 2008 16:11:25 +0000 Subject: [PATCH] * src/maemo/modest-address-book.c: * Now we show the checking names banner when we're really accessing the contacts database (Ffixes NB#84348). pmo-trunk-r4464 --- src/maemo/modest-address-book.c | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/src/maemo/modest-address-book.c b/src/maemo/modest-address-book.c index e7c2dc9..4391355 100644 --- a/src/maemo/modest-address-book.c +++ b/src/maemo/modest-address-book.c @@ -653,6 +653,19 @@ show_check_names_banner (gpointer userdata) return FALSE; } +static void +hide_check_names_banner (GtkWidget **banner, guint banner_timeout) +{ + g_source_remove (banner_timeout); + if (*banner != NULL) { + gtk_widget_destroy (*banner); + *banner = NULL; + } else { + g_source_remove (banner_timeout); + } + +} + gboolean modest_address_book_check_names (ModestRecptEditor *recpt_editor, gboolean update_addressbook) { @@ -664,8 +677,6 @@ modest_address_book_check_names (ModestRecptEditor *recpt_editor, gboolean updat gint offset_delta = 0; gint last_length; GtkTextIter start_iter, end_iter; - guint banner_timeout; - GtkWidget *banner = NULL; g_return_val_if_fail (MODEST_IS_RECPT_EDITOR (recpt_editor), FALSE); @@ -682,8 +693,6 @@ modest_address_book_check_names (ModestRecptEditor *recpt_editor, gboolean updat } } - banner_timeout = g_timeout_add (500, show_check_names_banner, &banner); - current_start = start_indexes; current_end = end_indexes; buffer = modest_recpt_editor_get_buffer (recpt_editor); @@ -720,6 +729,7 @@ modest_address_book_check_names (ModestRecptEditor *recpt_editor, gboolean updat /* here goes searching in addressbook */ gchar *contact_id = NULL; GSList *resolved_addresses = NULL; + result = resolve_address (address, &resolved_addresses, &contact_id); if (result) { @@ -794,14 +804,6 @@ modest_address_book_check_names (ModestRecptEditor *recpt_editor, gboolean updat g_slist_free (start_indexes); g_slist_free (end_indexes); - g_source_remove (banner_timeout); - if (banner != NULL) { - gtk_widget_destroy (banner); - banner = NULL; - } else { - g_source_remove (banner_timeout); - } - return result; } @@ -864,6 +866,10 @@ static gboolean resolve_address (const gchar *address, GSList **resolved_addresses, gchar **contact_id) { GList *resolved_contacts; + guint banner_timeout; + GtkWidget *banner = NULL; + + banner_timeout = g_timeout_add (500, show_check_names_banner, &banner); contact_model = osso_abook_contact_model_new (); if (!open_addressbook_sync ()) { @@ -879,6 +885,8 @@ resolve_address (const gchar *address, GSList **resolved_addresses, gchar **cont if (resolved_contacts == NULL) { /* no matching contacts for the search string */ modest_platform_run_information_dialog (NULL, _("mcen_nc_no_matching_contacts"), FALSE); + hide_check_names_banner (&banner, banner_timeout); + return FALSE; } @@ -886,7 +894,10 @@ resolve_address (const gchar *address, GSList **resolved_addresses, gchar **cont /* show a dialog to select the contact from the resolved ones */ g_list_free (resolved_contacts); + hide_check_names_banner (&banner, banner_timeout); resolved_contacts = select_contacts_for_name_dialog (address); + banner_timeout = g_timeout_add (500, show_check_names_banner, &banner); + } /* get the resolved contacts (can be no contact) */ @@ -895,6 +906,7 @@ resolve_address (const gchar *address, GSList **resolved_addresses, gchar **cont EContact *contact = (EContact *) resolved_contacts->data; *resolved_addresses = get_recipients_for_given_contact (contact); + hide_check_names_banner (&banner, banner_timeout); if (*resolved_addresses) { *contact_id = g_strdup (e_contact_get_const (contact, E_CONTACT_UID)); found = TRUE; @@ -909,6 +921,7 @@ resolve_address (const gchar *address, GSList **resolved_addresses, gchar **cont } else { /* cancelled dialog to select more than one contact or * selected no contact */ + hide_check_names_banner (&banner, banner_timeout); return FALSE; } -- 1.7.9.5