From 5948c36901a66021c7d3ded3acaf9bde18be17d2 Mon Sep 17 00:00:00 2001 From: Bharath Acharya Date: Sun, 20 Jul 2008 18:26:42 +0000 Subject: ** Fixes Bug #200147 2008-07-18 Bharath Acharya ** Fixes Bug #200147 Basic functionality implemented by Diego Escalante Urrelo Everyone owes him a big mug of Beer for that. ** Added Templates plugin * Makefile.am: * apps-evolution-template-placeholders.schemas.in: * org-gnome-templates.eplug.xml: * templates.c: * templates.glade: svn path=/trunk/; revision=35780 --- mail/em-utils.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'mail/em-utils.c') diff --git a/mail/em-utils.c b/mail/em-utils.c index ff686f3d8c..4fd8a98958 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -1364,7 +1364,53 @@ em_utils_temp_save_part(GtkWidget *parent, CamelMimePart *part, gboolean mode) return path; } +/** em_utils_folder_is_templates: + * @folder: folder + * @uri: uri for this folder, if known + * + * Decides if @folder is a Templates folder. + * + * Returns %TRUE if this is a Drafts folder or %FALSE otherwise. + **/ + +gboolean +em_utils_folder_is_templates (CamelFolder *folder, const char *uri) +{ + EAccountList *accounts; + EAccount *account; + EIterator *iter; + int is = FALSE; + char *templates_uri; + if (folder == mail_component_get_folder (NULL, MAIL_COMPONENT_FOLDER_TEMPLATES)) + return TRUE; + + if (uri == NULL) + return FALSE; + + accounts = mail_config_get_accounts(); + iter = e_list_get_iterator ((EList *)accounts); + while (e_iterator_is_valid (iter)) { + account = (EAccount *)e_iterator_get (iter); + + if (account->templates_folder_uri) { + templates_uri = em_uri_to_camel (account->templates_folder_uri); + if (camel_store_folder_uri_equal (folder->parent_store, templates_uri, uri)) { + g_free (templates_uri); + is = TRUE; + break; + } + g_free (templates_uri); + } + + e_iterator_next (iter); + } + + g_object_unref (iter); + + return is; +} + /** * em_utils_folder_is_drafts: * @folder: folder -- cgit v1.2.3 From bfc8b8784d22d4eb4e7286cc6ef35dd5be5419a4 Mon Sep 17 00:00:00 2001 From: Sankarasivasubramanian Pasupathilingam Date: Mon, 29 Sep 2008 08:36:04 +0000 Subject: License changes from GPL to LGPL svn path=/trunk/; revision=36465 --- mail/em-utils.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'mail/em-utils.c') diff --git a/mail/em-utils.c b/mail/em-utils.c index 4fd8a98958..f7555afbef 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -1,22 +1,22 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * Authors: Jeffrey Stedfast + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * Authors: + * Jeffrey Stedfast + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * */ -- cgit v1.2.3 From 77ff19dd8394167cdc9765af20a62bdaed18e308 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 1 Oct 2008 12:29:46 +0000 Subject: ** Fix for bug #554418 2008-10-01 Milan Crha ** Fix for bug #554418 * e-util/e-util.h: (e_util_guess_mime_type): * e-util/e-util.c: (e_util_guess_mime_type): Guess mime_type based on the file content only when permitted by the caller, otherwise check based on the filename only, where it fallbacks if file content guess fails. * mail/em-utils.c: (em_utils_snoop_type): * mail/em-popup.c: (emp_standard_menu_factory): Guess mime_type based on the filename only. * composer/e-msg-composer.c: (handle_uri), (e_msg_composer_add_inline_image_from_file): Guess mime_type based on the file content, if failed, then on the filename. * widgets/misc/e-attachment.c: (attachment_guess_mime_type): Allow guessing mime_type based on the file content. * calendar/gui/dialogs/comp-editor.c: (set_attachment_list): * calendar/gui/e-cal-popup.c: (ecalp_standard_menu_factory): Allow/disallow guessing of the mime_type based on the file content. svn path=/trunk/; revision=36529 --- mail/em-utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mail/em-utils.c') diff --git a/mail/em-utils.c b/mail/em-utils.c index f7555afbef..01b18eb461 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -2260,7 +2260,7 @@ em_utils_snoop_type(CamelMimePart *part) filename = camel_mime_part_get_filename (part); if (filename != NULL) - name_type = e_util_guess_mime_type (filename); + name_type = e_util_guess_mime_type (filename, FALSE); dw = camel_medium_get_content_object((CamelMedium *)part); if (!camel_data_wrapper_is_offline(dw)) { -- cgit v1.2.3 From 7d9f28248b4472b9a9d1953b5be9e0179de0ec45 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 17 Oct 2008 08:31:43 +0000 Subject: ** Fix for bug #364542 2008-10-17 Milan Crha ** Fix for bug #364542 * em-utils.c: (struct TryOpenEBookStruct), (try_open_e_book_cb), (try_open_e_book), (em_utils_in_addressbook), (em_utils_contact_photo): Stop when camel operation has been canceled. Also check for cancellation when opening EBook, thus the UI (preview) will not freeze with slow address books. svn path=/trunk/; revision=36635 --- mail/em-utils.c | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 76 insertions(+), 4 deletions(-) (limited to 'mail/em-utils.c') diff --git a/mail/em-utils.c b/mail/em-utils.c index 01b18eb461..9b091c68cf 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -64,6 +64,7 @@ #include "message-tag-followup.h" #include +#include #include "e-util/e-util.h" #include "e-util/e-util-private.h" #include "e-util/e-mktemp.h" @@ -2025,6 +2026,72 @@ emu_addr_cancel_book(void *data) g_clear_error(&err); } +struct TryOpenEBookStruct { + GError **error; + EFlag *flag; + gboolean result; +}; + +static void +try_open_e_book_cb (EBook *book, EBookStatus status, gpointer closure) +{ + struct TryOpenEBookStruct *data = (struct TryOpenEBookStruct *)closure; + + if (!data) + return; + + data->result = status == E_BOOK_ERROR_OK; + + if (!data->result) + g_set_error (data->error, E_BOOK_ERROR, status, "EBookStatus returned %d", status); + + e_flag_set (data->flag); +} + +/** + * try_open_e_book: + * Tries to open address book asynchronously, but acts as synchronous. + * The advantage is it checks periodically whether the camel_operation + * has been canceled or not, and if so, then stops immediately, with + * result FALSE. Otherwise returns same as e_book_open + **/ +static gboolean +try_open_e_book (EBook *book, gboolean only_if_exists, GError **error) +{ + struct TryOpenEBookStruct data; + gboolean canceled = FALSE; + EFlag *flag = e_flag_new (); + + data.error = error; + data.flag = flag; + data.result = FALSE; + + if (e_book_async_open (book, only_if_exists, try_open_e_book_cb, &data) != FALSE) { + e_flag_free (flag); + g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_OTHER_ERROR, "Failed to call e_book_async_open."); + return FALSE; + } + + while (canceled = camel_operation_cancel_check (NULL), !canceled && !e_flag_is_set (flag)) { + GTimeVal wait; + + g_get_current_time (&wait); + g_time_val_add (&wait, 250000); /* waits 250ms */ + + e_flag_timed_wait (flag, &wait); + } + + e_flag_free (flag); + + if (canceled) { + g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_CANCELLED, "Operation has been canceled."); + e_book_cancel_async_op (book, NULL); + return FALSE; + } + + return data.result; +} + gboolean em_utils_in_addressbook (CamelInternetAddress *iaddr, gboolean local_only) { @@ -2111,9 +2178,9 @@ em_utils_in_addressbook (CamelInternetAddress *iaddr, gboolean local_only) hook = mail_cancel_hook_add(emu_addr_cancel_book, book); /* ignore errors, but cancellation errors we don't try to go further either */ - if (!e_book_open(book, TRUE, &err) + if (!try_open_e_book (book, TRUE, &err) || !e_book_get_contacts(book, query, &contacts, &err)) { - stop = err->domain == E_BOOK_ERROR && err->code == E_BOOK_ERROR_CANCELLED; + stop = err && err->domain == E_BOOK_ERROR && err->code == E_BOOK_ERROR_CANCELLED; mail_cancel_hook_remove(hook); g_object_unref(book); d(g_warning("Can't get contacts: %s", err->message)); @@ -2129,6 +2196,8 @@ em_utils_in_addressbook (CamelInternetAddress *iaddr, gboolean local_only) g_list_free(contacts); } + stop = stop || camel_operation_cancel_check (NULL); + d(printf(" %s\n", stop?"found":"not found")); g_object_unref(book); @@ -2194,9 +2263,9 @@ em_utils_contact_photo (struct _CamelInternetAddress *cia, gboolean local) source = s->data; book = e_book_new(source, &err); - if (!e_book_open(book, TRUE, &err) + if (!try_open_e_book (book, TRUE, &err) || !e_book_get_contacts(book, query, &contacts, &err)) { - stop = err->domain == E_BOOK_ERROR && err->code == E_BOOK_ERROR_CANCELLED; + stop = err && err->domain == E_BOOK_ERROR && err->code == E_BOOK_ERROR_CANCELLED; g_object_unref(book); d(g_warning("Can't get contacts: %s", err->message)); g_clear_error(&err); @@ -2214,6 +2283,9 @@ em_utils_contact_photo (struct _CamelInternetAddress *cia, gboolean local) g_list_foreach (contacts, (GFunc)g_object_unref, NULL); g_list_free (contacts); } + + stop = stop || camel_operation_cancel_check (NULL); + g_object_unref (source); /* Is it? */ g_object_unref(book); } -- cgit v1.2.3 From 4052f5078c02b223b32b18dba6524e5b6201f3cf Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 2 Nov 2008 18:21:05 +0000 Subject: ** Fixes bug #557613 2008-11-02 Matthew Barnes ** Fixes bug #557613 * mail/em-utils.c (try_open_e_book): Wait for try_open_e_book_cb() to run before freeing the EFlag. It will run regardless of whether the EBook operation completes. svn path=/trunk/; revision=36715 --- mail/em-utils.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'mail/em-utils.c') diff --git a/mail/em-utils.c b/mail/em-utils.c index 9b091c68cf..bb92d7ad03 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -2081,14 +2081,14 @@ try_open_e_book (EBook *book, gboolean only_if_exists, GError **error) e_flag_timed_wait (flag, &wait); } - e_flag_free (flag); - if (canceled) { g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_CANCELLED, "Operation has been canceled."); e_book_cancel_async_op (book, NULL); - return FALSE; } + e_flag_wait (flag); + e_flag_free (flag); + return data.result; } @@ -2183,7 +2183,7 @@ em_utils_in_addressbook (CamelInternetAddress *iaddr, gboolean local_only) stop = err && err->domain == E_BOOK_ERROR && err->code == E_BOOK_ERROR_CANCELLED; mail_cancel_hook_remove(hook); g_object_unref(book); - d(g_warning("Can't get contacts: %s", err->message)); + g_warning("Can't get contacts: %s", err->message); g_clear_error(&err); continue; } @@ -2267,7 +2267,7 @@ em_utils_contact_photo (struct _CamelInternetAddress *cia, gboolean local) || !e_book_get_contacts(book, query, &contacts, &err)) { stop = err && err->domain == E_BOOK_ERROR && err->code == E_BOOK_ERROR_CANCELLED; g_object_unref(book); - d(g_warning("Can't get contacts: %s", err->message)); + g_warning("Can't get contacts: %s", err->message); g_clear_error(&err); continue; } -- cgit v1.2.3 From 84aa765a197eacbb8e09fc0af2e1e00937ae6178 Mon Sep 17 00:00:00 2001 From: Suman Manjunath Date: Tue, 13 Jan 2009 03:41:19 +0000 Subject: Patch from Felix Riemann ** Fix for bug #563867 (Unescape "&" when passing the link to browsers). svn path=/trunk/; revision=37063 --- mail/em-utils.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'mail/em-utils.c') diff --git a/mail/em-utils.c b/mail/em-utils.c index bb92d7ad03..f65edb0e40 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -2442,3 +2442,34 @@ em_utils_show_info_silent (GtkWidget *widget) g_signal_connect(widget, "response", G_CALLBACK(error_response), NULL); e_activity_handler_make_error (handler, "mail", E_LOG_WARNINGS, widget); } + +gchar * +em_utils_url_unescape_amp (const gchar *url) +{ + gchar *buff; + int i, j, amps; + + if (!url) + return NULL; + + amps = 0; + for (i = 0; url [i]; i++) { + if (url [i] == '&' && strncmp (url + i, "&", 5) == 0) + amps++; + } + + buff = g_strdup (url); + + if (!amps) + return buff; + + for (i = 0, j = 0; url [i]; i++, j++) { + buff [j] = url [i]; + + if (url [i] == '&' && strncmp (url + i, "&", 5) == 0) + i += 4; + } + buff [j] = 0; + + return buff; +} -- cgit v1.2.3 From f44568a253d5c798c71469b6e7d6fca905c0c356 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 9 Feb 2009 10:59:29 +0000 Subject: ** Part of fix for bug #555888 2009-02-09 Milan Crha ** Part of fix for bug #555888 * mail-config.glade: * em-network-prefs.h: (struct _EMNetworkPrefs): * em-network-prefs.c: (emnp_parse_ignore_hosts), (emnp_load_sys_settings), (notify_proxy_type_changed), (em_network_prefs_construct): Do not overwrite user settings with system proxy settings. Register signals at the end, when all widgets are read. Hide socks settings, it is not used at the moment. * em-utils.h: (em_utils_get_proxy_uri): * em-utils.c: (em_utils_get_proxy_uri), (emu_proxy_setup): * em-format-html.c: (emfh_gethttp): Use proxy configurable within Evolution. svn path=/trunk/; revision=37236 --- mail/em-utils.c | 80 +++++++++++++-------------------------------------------- 1 file changed, 18 insertions(+), 62 deletions(-) (limited to 'mail/em-utils.c') diff --git a/mail/em-utils.c b/mail/em-utils.c index f65edb0e40..2bda6d4315 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -65,6 +65,7 @@ #include #include +#include #include "e-util/e-util.h" #include "e-util/e-util-private.h" #include "e-util/e-mktemp.h" @@ -1552,62 +1553,17 @@ em_utils_adjustment_page(GtkAdjustment *adj, gboolean down) } /* ********************************************************************** */ -static char *emu_proxy_uri; -static int emu_proxy_init = 0; -static pthread_mutex_t emu_proxy_lock = PTHREAD_MUTEX_INITIALIZER; - -static void -emu_set_proxy(GConfClient *client, int needlock) -{ - char *server, *uri = NULL; - int port; - - if (gconf_client_get_bool(client, "/system/http_proxy/use_http_proxy", NULL)) { - server = gconf_client_get_string(client, "/system/http_proxy/host", NULL); - port = gconf_client_get_int(client, "/system/http_proxy/port", NULL); - - if (server && server[0]) { - if (gconf_client_get_bool(client, "/system/http_proxy/use_authentication", NULL)) { - char *user = gconf_client_get_string(client, "/system/http_proxy/authentication_user", NULL); - char *pass = gconf_client_get_string(client, "/system/http_proxy/authentication_password", NULL); - - uri = g_strdup_printf("http://%s:%s@%s:%d", user, pass, server, port); - g_free(user); - g_free(pass); - } else { - uri = g_strdup_printf("http://%s:%d", server, port); - } - } - - g_free(server); - } - - if (needlock) - pthread_mutex_lock(&emu_proxy_lock); - - g_free(emu_proxy_uri); - emu_proxy_uri = uri; - - if (needlock) - pthread_mutex_unlock(&emu_proxy_lock); - -} - -static void -emu_proxy_changed(GConfClient *client, guint32 cnxn_id, GConfEntry *entry, gpointer user_data) -{ - emu_set_proxy(client, TRUE); -} +static EProxy *emu_proxy = NULL; +static GStaticMutex emu_proxy_lock = G_STATIC_MUTEX_INIT; static void * -emu_proxy_setup(void *data) +emu_proxy_setup (void *data) { - GConfClient *client = gconf_client_get_default(); - - gconf_client_add_dir(client, "/system/http_proxy", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); - gconf_client_notify_add(client, "/system/http_proxy", emu_proxy_changed, NULL, NULL, NULL); - emu_set_proxy(client, FALSE); - g_object_unref(client); + if (!emu_proxy) { + emu_proxy = e_proxy_new (); + e_proxy_setup_proxy (emu_proxy); + /* not necessary to listen for changes here */ + } return NULL; } @@ -1615,25 +1571,25 @@ emu_proxy_setup(void *data) /** * em_utils_get_proxy_uri: * - * Get the system proxy uri. + * Get the system proxy uri for 'pUri'. * * Return value: Must be freed when finished with. **/ char * -em_utils_get_proxy_uri(void) +em_utils_get_proxy_uri (const char *pUri) { - char *uri; + char *uri = NULL; - pthread_mutex_lock(&emu_proxy_lock); + g_static_mutex_lock (&emu_proxy_lock); - if (!emu_proxy_init) { - mail_call_main(MAIL_CALL_p_p, (MailMainFunc)emu_proxy_setup, NULL); - emu_proxy_init = TRUE; + if (!emu_proxy) { + mail_call_main (MAIL_CALL_p_p, (MailMainFunc)emu_proxy_setup, NULL); } - uri = g_strdup(emu_proxy_uri); + if (e_proxy_require_proxy_for_uri (emu_proxy, pUri)) + uri = soup_uri_to_string (e_proxy_peek_uri_for (emu_proxy, pUri), FALSE); - pthread_mutex_unlock(&emu_proxy_lock); + g_static_mutex_unlock (&emu_proxy_lock); return uri; } -- cgit v1.2.3 From 7a05751402b2f93604782568678fc91e8d47617a Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 25 Feb 2009 11:04:45 +0000 Subject: ** Part of fix for bug #563212 2009-02-25 Milan Crha ** Part of fix for bug #563212 * em-utils.c: (try_open_e_book_cb), (try_open_e_book), (is_local), (em_utils_in_addressbook), (em_utils_contact_photo): Ensure empty GError before filling it. Check if group is local based on its base_uri. Adapt to new e_book_cancel behaviour. svn path=/trunk/; revision=37329 --- mail/em-utils.c | 47 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 9 deletions(-) (limited to 'mail/em-utils.c') diff --git a/mail/em-utils.c b/mail/em-utils.c index 2bda6d4315..4a1a6eada9 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -1998,8 +1998,10 @@ try_open_e_book_cb (EBook *book, EBookStatus status, gpointer closure) data->result = status == E_BOOK_ERROR_OK; - if (!data->result) + if (!data->result) { + g_clear_error (data->error); g_set_error (data->error, E_BOOK_ERROR, status, "EBookStatus returned %d", status); + } e_flag_set (data->flag); } @@ -2024,6 +2026,7 @@ try_open_e_book (EBook *book, gboolean only_if_exists, GError **error) if (e_book_async_open (book, only_if_exists, try_open_e_book_cb, &data) != FALSE) { e_flag_free (flag); + g_clear_error (error); g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_OTHER_ERROR, "Failed to call e_book_async_open."); return FALSE; } @@ -2038,14 +2041,25 @@ try_open_e_book (EBook *book, gboolean only_if_exists, GError **error) } if (canceled) { + g_clear_error (error); g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_CANCELLED, "Operation has been canceled."); e_book_cancel_async_op (book, NULL); + /* it had been canceled, the above callback may not be called, thus setting flag here */ + e_flag_set (flag); } e_flag_wait (flag); e_flag_free (flag); - return data.result; + return data.result && (!error || !*error); +} + +static gboolean +is_local (ESourceGroup *group) +{ + return group && + e_source_group_peek_base_uri (group) && + g_str_has_prefix (e_source_group_peek_base_uri (group), "file://"); } gboolean @@ -2100,7 +2114,7 @@ em_utils_in_addressbook (CamelInternetAddress *iaddr, gboolean local_only) /* FIXME: this aint threadsafe by any measure, but what can you do eh??? */ for (g = e_source_list_peek_groups(emu_addr_list);g;g=g_slist_next(g)) { - if (local_only && e_source_group_peek_base_uri ((ESourceGroup *)g->data) && !g_str_has_prefix (e_source_group_peek_base_uri ((ESourceGroup *)g->data), "file://")) + if (local_only && !is_local (g->data)) continue; for (s = e_source_group_peek_sources((ESourceGroup *)g->data);s;s=g_slist_next(s)) { @@ -2126,20 +2140,24 @@ em_utils_in_addressbook (CamelInternetAddress *iaddr, gboolean local_only) book = e_book_new(source, &err); if (book == NULL) { - g_warning("Unable to create addressbook: %s", err->message); + if (err && !g_error_matches (err, E_BOOK_ERROR, E_BOOK_ERROR_CANCELLED)) + g_warning ("%s: Unable to create addressbook: %s", G_STRFUNC, err->message); g_clear_error(&err); continue; } + g_clear_error(&err); + hook = mail_cancel_hook_add(emu_addr_cancel_book, book); /* ignore errors, but cancellation errors we don't try to go further either */ if (!try_open_e_book (book, TRUE, &err) || !e_book_get_contacts(book, query, &contacts, &err)) { - stop = err && err->domain == E_BOOK_ERROR && err->code == E_BOOK_ERROR_CANCELLED; + stop = err && g_error_matches (err, E_BOOK_ERROR, E_BOOK_ERROR_CANCELLED); mail_cancel_hook_remove(hook); g_object_unref(book); - g_warning("Can't get contacts: %s", err->message); + if (err && !stop) + g_warning ("%s: Can't get contacts: %s", G_STRFUNC, err->message); g_clear_error(&err); continue; } @@ -2201,7 +2219,7 @@ em_utils_contact_photo (struct _CamelInternetAddress *cia, gboolean local) query = e_book_query_field_test(E_CONTACT_EMAIL, E_BOOK_QUERY_IS, addr); for (g = e_source_list_peek_groups(emu_addr_list); g; g = g_slist_next(g)) { - if (local && strcmp (e_source_group_peek_name ((ESourceGroup *)g->data), "On This Computer")) + if (local && !is_local (g->data)) continue; for (s = e_source_group_peek_sources((ESourceGroup *)g->data); s; s=g_slist_next(s)) { @@ -2219,14 +2237,25 @@ em_utils_contact_photo (struct _CamelInternetAddress *cia, gboolean local) source = s->data; book = e_book_new(source, &err); + if (!book) { + if (err && !g_error_matches (err, E_BOOK_ERROR, E_BOOK_ERROR_CANCELLED)) + g_warning ("%s: Unable to create addressbook: %s", G_STRFUNC, err->message); + g_clear_error (&err); + continue; + } + + g_clear_error (&err); + if (!try_open_e_book (book, TRUE, &err) || !e_book_get_contacts(book, query, &contacts, &err)) { - stop = err && err->domain == E_BOOK_ERROR && err->code == E_BOOK_ERROR_CANCELLED; + stop = err && g_error_matches (err, E_BOOK_ERROR, E_BOOK_ERROR_CANCELLED); g_object_unref(book); - g_warning("Can't get contacts: %s", err->message); + if (err && !stop) + g_warning ("%s: Can't get contacts: %s", G_STRFUNC, err->message); g_clear_error(&err); continue; } + g_clear_error (&err); if (contacts != NULL) { found = TRUE; -- cgit v1.2.3 From 8625eda8bc1871e9f36253a01b9378eb1e5aaf90 Mon Sep 17 00:00:00 2001 From: Matt McCutchen Date: Mon, 2 Mar 2009 01:34:54 +0000 Subject: Revert evolution revision 37063 (workaround for bug 563867). 2009-03-02 Matt McCutchen * evolution/mail/em-folder-view.c: * evolution/mail/em-utils.c: * evolution/mail/em-utils.h: * evolution/mail/em-popup.c: Revert evolution revision 37063 (workaround for bug 563867). ** Part of the fix for bug #549838 svn path=/trunk/; revision=37350 --- mail/em-utils.c | 31 ------------------------------- 1 file changed, 31 deletions(-) (limited to 'mail/em-utils.c') diff --git a/mail/em-utils.c b/mail/em-utils.c index 4a1a6eada9..7685e76845 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -2427,34 +2427,3 @@ em_utils_show_info_silent (GtkWidget *widget) g_signal_connect(widget, "response", G_CALLBACK(error_response), NULL); e_activity_handler_make_error (handler, "mail", E_LOG_WARNINGS, widget); } - -gchar * -em_utils_url_unescape_amp (const gchar *url) -{ - gchar *buff; - int i, j, amps; - - if (!url) - return NULL; - - amps = 0; - for (i = 0; url [i]; i++) { - if (url [i] == '&' && strncmp (url + i, "&", 5) == 0) - amps++; - } - - buff = g_strdup (url); - - if (!amps) - return buff; - - for (i = 0, j = 0; url [i]; i++, j++) { - buff [j] = url [i]; - - if (url [i] == '&' && strncmp (url + i, "&", 5) == 0) - i += 4; - } - buff [j] = 0; - - return buff; -} -- cgit v1.2.3