[evolution] Use e_source_registry_list_enabled() where appropriate.



commit 4d58a800fa36927567f6c0d22617c260e8e7172b
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sat Mar 9 19:11:44 2013 -0500

    Use e_source_registry_list_enabled() where appropriate.

 calendar/gui/itip-utils.c             |   10 ++--------
 e-util/e-mail-identity-combo-box.c    |    5 +----
 e-util/e-name-selector-entry.c        |    6 +-----
 e-util/e-name-selector.c              |    6 +-----
 libemail-engine/e-mail-folder-utils.c |    5 ++---
 libemail-engine/e-mail-utils.c        |    5 ++---
 modules/itip-formatter/itip-view.c    |   15 +++------------
 7 files changed, 12 insertions(+), 40 deletions(-)
---
diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c
index 8ea7fe9..ad5c83c 100644
--- a/calendar/gui/itip-utils.c
+++ b/calendar/gui/itip-utils.c
@@ -430,16 +430,13 @@ itip_get_comp_attendee (ESourceRegistry *registry,
        }
 
        extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY;
-       list = e_source_registry_list_sources (registry, extension_name);
+       list = e_source_registry_list_enabled (registry, extension_name);
 
        for (link = list; link != NULL; link = g_list_next (link)) {
                ESourceExtension *extension;
 
                source = E_SOURCE (link->data);
 
-               if (!e_source_registry_check_enabled (registry, source))
-                       continue;
-
                extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY;
                extension = e_source_get_extension (source, extension_name);
 
@@ -1579,16 +1576,13 @@ find_enabled_identity (ESourceRegistry *registry,
                return NULL;
 
        extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY;
-       list = e_source_registry_list_sources (registry, extension_name);
+       list = e_source_registry_list_enabled (registry, extension_name);
 
        for (link = list; link != NULL; link = g_list_next (link)) {
                ESource *source = E_SOURCE (link->data);
                ESourceMailIdentity *extension;
                const gchar *address;
 
-               if (!e_source_registry_check_enabled (registry, source))
-                       continue;
-
                extension = e_source_get_extension (source, extension_name);
                address = e_source_mail_identity_get_address (extension);
 
diff --git a/e-util/e-mail-identity-combo-box.c b/e-util/e-mail-identity-combo-box.c
index b76e0ee..9561ba7 100644
--- a/e-util/e-mail-identity-combo-box.c
+++ b/e-util/e-mail-identity-combo-box.c
@@ -278,7 +278,7 @@ e_mail_identity_combo_box_refresh (EMailIdentityComboBox *combo_box)
 
        extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY;
        registry = e_mail_identity_combo_box_get_registry (combo_box);
-       list = e_source_registry_list_sources (registry, extension_name);
+       list = e_source_registry_list_enabled (registry, extension_name);
 
        /* Build a hash table of GQueues by email address so we can
         * spot duplicate email addresses.  Then if the GQueue for a
@@ -326,9 +326,6 @@ e_mail_identity_combo_box_refresh (EMailIdentityComboBox *combo_box)
 
                source = E_SOURCE (link->data);
 
-               if (!e_source_registry_check_enabled (registry, source))
-                       continue;
-
                extension = e_source_get_extension (source, extension_name);
                name = e_source_mail_identity_get_name (extension);
                address = e_source_mail_identity_get_address (extension);
diff --git a/e-util/e-name-selector-entry.c b/e-util/e-name-selector-entry.c
index 78b82f2..12dddb8 100644
--- a/e-util/e-name-selector-entry.c
+++ b/e-util/e-name-selector-entry.c
@@ -2281,7 +2281,7 @@ setup_default_contact_store (ENameSelectorEntry *name_selector_entry)
        client_cache = e_name_selector_entry_ref_client_cache (name_selector_entry);
        registry = e_client_cache_ref_registry (client_cache);
 
-       list = e_source_registry_list_sources (registry, extension_name);
+       list = e_source_registry_list_enabled (registry, extension_name);
 
        for (iter = list; iter != NULL; iter = g_list_next (iter)) {
                ESource *source = E_SOURCE (iter->data);
@@ -2292,10 +2292,6 @@ setup_default_contact_store (ENameSelectorEntry *name_selector_entry)
                extension_name = E_SOURCE_EXTENSION_AUTOCOMPLETE;
                extension = e_source_get_extension (source, extension_name);
 
-               /* Skip disabled address books. */
-               if (!e_source_registry_check_enabled (registry, source))
-                       continue;
-
                /* Skip non-completion address books. */
                if (!e_source_autocomplete_get_include_me (extension))
                        continue;
diff --git a/e-util/e-name-selector.c b/e-util/e-name-selector.c
index f6e6658..9f2f48c 100644
--- a/e-util/e-name-selector.c
+++ b/e-util/e-name-selector.c
@@ -172,7 +172,7 @@ e_name_selector_load_books (ENameSelector *name_selector)
        client_cache = e_name_selector_ref_client_cache (name_selector);
        registry = e_client_cache_ref_registry (client_cache);
 
-       list = e_source_registry_list_sources (registry, extension_name);
+       list = e_source_registry_list_enabled (registry, extension_name);
 
        for (iter = list; iter != NULL; iter = g_list_next (iter)) {
                ESource *source = E_SOURCE (iter->data);
@@ -182,10 +182,6 @@ e_name_selector_load_books (ENameSelector *name_selector)
                extension_name = E_SOURCE_EXTENSION_AUTOCOMPLETE;
                extension = e_source_get_extension (source, extension_name);
 
-               /* Skip disabled address books. */
-               if (!e_source_registry_check_enabled (registry, source))
-                       continue;
-
                /* Only load address books with autocomplete enabled,
                 * so as to avoid unnecessary authentication prompts. */
                if (!e_source_autocomplete_get_include_me (extension))
diff --git a/libemail-engine/e-mail-folder-utils.c b/libemail-engine/e-mail-folder-utils.c
index bd45f35..4047e0e 100644
--- a/libemail-engine/e-mail-folder-utils.c
+++ b/libemail-engine/e-mail-folder-utils.c
@@ -286,7 +286,7 @@ mail_folder_expunge_pop3_stores (CamelFolder *folder,
        }
 
        extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
-       list = e_source_registry_list_sources (registry, extension_name);
+       list = e_source_registry_list_enabled (registry, extension_name);
 
        for (link = list; link != NULL; link = g_list_next (link)) {
                ESource *source = E_SOURCE (link->data);
@@ -306,8 +306,7 @@ mail_folder_expunge_pop3_stores (CamelFolder *folder,
                extension = e_source_get_extension (source, extension_name);
                backend_name = e_source_backend_get_backend_name (extension);
 
-               if (!e_source_registry_check_enabled (registry, source) ||
-                   g_strcmp0 (backend_name, "pop") != 0)
+               if (g_strcmp0 (backend_name, "pop") != 0)
                        continue;
 
                service = camel_session_ref_service (
diff --git a/libemail-engine/e-mail-utils.c b/libemail-engine/e-mail-utils.c
index 7b406ec..c6aff21 100644
--- a/libemail-engine/e-mail-utils.c
+++ b/libemail-engine/e-mail-utils.c
@@ -552,7 +552,7 @@ second_preference:
        }
 
        extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
-       list = e_source_registry_list_sources (registry, extension_name);
+       list = e_source_registry_list_enabled (registry, extension_name);
 
        if (sort_func)
                sort_func (&list, sort_func_data);
@@ -560,8 +560,7 @@ second_preference:
        for (iter = list; iter != NULL; iter = g_list_next (iter)) {
                ESource *temp = E_SOURCE (iter->data);
 
-               if (e_source_registry_check_enabled (registry, temp) &&
-                   mail_account_in_recipients (registry, temp, recipients)) {
+               if (mail_account_in_recipients (registry, temp, recipients)) {
                        source = g_object_ref (temp);
                        break;
                }
diff --git a/modules/itip-formatter/itip-view.c b/modules/itip-formatter/itip-view.c
index b739392..21bc036 100644
--- a/modules/itip-formatter/itip-view.c
+++ b/modules/itip-formatter/itip-view.c
@@ -3277,7 +3277,7 @@ find_to_address (ItipView *view,
                return;
 
        /* Look through the list of attendees to find the user's address */
-       list = e_source_registry_list_sources (registry, extension_name);
+       list = e_source_registry_list_enabled (registry, extension_name);
 
        for (link = list; link != NULL; link = g_list_next (link)) {
                ESource *source = E_SOURCE (link->data);
@@ -3286,9 +3286,6 @@ find_to_address (ItipView *view,
                const gchar *address;
                gchar *text;
 
-               if (!e_source_registry_check_enabled (registry, source))
-                       continue;
-
                extension = e_source_get_extension (source, extension_name);
                address = e_source_mail_identity_get_address (extension);
 
@@ -3338,7 +3335,7 @@ find_to_address (ItipView *view,
         * accounts list again.
         */
 
-       list = e_source_registry_list_sources (registry, extension_name);
+       list = e_source_registry_list_enabled (registry, extension_name);
 
        for (link = list; link != NULL; link = g_list_next (link)) {
                ESource *source = E_SOURCE (link->data);
@@ -3347,9 +3344,6 @@ find_to_address (ItipView *view,
                const gchar *address;
                gchar *text;
 
-               if (!e_source_registry_check_enabled (registry, source))
-                       continue;
-
                extension = e_source_get_extension (source, extension_name);
                address = e_source_mail_identity_get_address (extension);
 
@@ -3433,16 +3427,13 @@ find_from_address (ItipView *view,
                pitip->from_name = g_strdup (icalparameter_get_cn (param));
 
        extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY;
-       list = e_source_registry_list_sources (registry, extension_name);
+       list = e_source_registry_list_enabled (registry, extension_name);
 
        for (link = list; link != NULL; link = g_list_next (link)) {
                ESource *source = E_SOURCE (link->data);
                ESourceMailIdentity *extension;
                const gchar *address;
 
-               if (!e_source_registry_check_enabled (registry, source))
-                       continue;
-
                extension = e_source_get_extension (source, extension_name);
                address = e_source_mail_identity_get_address (extension);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]