From aefa670a5f7359cce0b5ac06e59a7b15be5f1345 Mon Sep 17 00:00:00 2001 From: Vivek Sekar Date: Mon, 4 Aug 2008 13:38:37 +0000 Subject: [PATCH] Merged fix for bugs 86176,86408 from trunk pmo-diablo-r5253 --- src/maemo/modest-platform.c | 22 ++++++++++++++++++++-- src/modest-text-utils.c | 15 +++++++++++---- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/maemo/modest-platform.c b/src/maemo/modest-platform.c index 4519e0f..27990e9 100644 --- a/src/maemo/modest-platform.c +++ b/src/maemo/modest-platform.c @@ -1659,11 +1659,29 @@ modest_platform_information_banner (GtkWidget *parent, const gchar *icon_name, const gchar *text) { - GtkWidget *banner; + GtkWidget *banner, *banner_parent = NULL; ModestWindowMgr *mgr; mgr = modest_runtime_get_window_mgr (); - banner = hildon_banner_show_information (parent, icon_name, text); + if (parent && GTK_IS_WINDOW (parent)) { + /* If the window is the active one then show the + banner on top of this window */ + if (gtk_window_is_active (GTK_WINDOW (parent))) + banner_parent = parent; + /* If the window is not the topmost but it's visible + (it's minimized for example) then show the banner + with no parent */ + else if (GTK_WIDGET_VISIBLE (parent)) + banner_parent = NULL; + /* If the window is hidden (like the main window when + running in the background) then do not show + anything */ + else + return; + } + + + banner = hildon_banner_show_information (banner_parent, icon_name, text); modest_window_mgr_register_banner (mgr); g_object_ref (mgr); diff --git a/src/modest-text-utils.c b/src/modest-text-utils.c index 8deb5cc..ba1ac54 100644 --- a/src/modest-text-utils.c +++ b/src/modest-text-utils.c @@ -360,17 +360,24 @@ modest_text_utils_remove_duplicate_addresses (const gchar *address_list) g_return_val_if_fail (address_list, NULL); - table = g_hash_table_new (g_str_hash, g_str_equal); + table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); addresses = modest_text_utils_split_addresses_list (address_list); cursor = addresses; while (cursor) { const gchar* address = (const gchar*)cursor->data; + /* We need only the email to just compare it and not + the full address which would make "a " + different from "a@a.com" */ + const gchar *email = get_email_from_address (address); + /* ignore the address if already seen */ - if (g_hash_table_lookup (table, address) == 0) { + if (g_hash_table_lookup (table, email) == 0) { gchar *tmp; + /* Include the full address and not only the + email in the returned list */ if (!new_list) { tmp = g_strdup (address); } else { @@ -379,12 +386,12 @@ modest_text_utils_remove_duplicate_addresses (const gchar *address_list) } new_list = tmp; - g_hash_table_insert (table, (gchar*)address, GINT_TO_POINTER(1)); + g_hash_table_insert (table, (gchar*)email, GINT_TO_POINTER(1)); } cursor = g_slist_next (cursor); } - g_hash_table_destroy (table); + g_hash_table_unref (table); g_slist_foreach (addresses, (GFunc)g_free, NULL); g_slist_free (addresses); -- 1.7.9.5