[evolution-data-server/account-mgmt: 24/33] Adapt ENameSelectorEntry to the new ESource API.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/account-mgmt: 24/33] Adapt ENameSelectorEntry to the new ESource API.
- Date: Wed, 7 Sep 2011 16:09:07 +0000 (UTC)
commit caabb2ee5f04697391dbcc0cc3713c9c618c37ec
Author: Matthew Barnes <mbarnes redhat com>
Date: Tue Nov 30 20:25:58 2010 -0600
Adapt ENameSelectorEntry to the new ESource API.
libedataserverui/e-name-selector-entry.c | 63 ++++++++++++++---------------
1 files changed, 30 insertions(+), 33 deletions(-)
---
diff --git a/libedataserverui/e-name-selector-entry.c b/libedataserverui/e-name-selector-entry.c
index 37120d3..7a00524 100644
--- a/libedataserverui/e-name-selector-entry.c
+++ b/libedataserverui/e-name-selector-entry.c
@@ -30,7 +30,11 @@
#include <libebook/e-book-client.h>
#include <libebook/e-contact.h>
#include <libebook/e-destination.h>
+#include <libebook/e-source-address-book.h>
+#include <libedataserverui/e-book-auth-util.h>
#include <libedataserverui/e-client-utils.h>
+#include <libedataserver/e-source-autocomplete.h>
+#include <libedataserver/e-source-registry.h>
#include <libedataserver/e-sexp.h>
#include "e-name-selector-entry.h"
@@ -38,7 +42,6 @@
struct _ENameSelectorEntryPrivate {
PangoAttrList *attr_list;
- ESourceList *source_list;
EContactStore *contact_store;
ETreeModelGenerator *email_generator;
EDestinationStore *destination_store;
@@ -2077,8 +2080,9 @@ static void
setup_default_contact_store (ENameSelectorEntry *name_selector_entry)
{
EContactStore *contact_store;
- GSList *groups;
- GSList *l;
+ ESourceRegistry *registry;
+ GList *list, *iter;
+ const gchar *extension_name;
g_return_if_fail (name_selector_entry->priv->contact_store == NULL);
@@ -2086,34 +2090,34 @@ setup_default_contact_store (ENameSelectorEntry *name_selector_entry)
contact_store = e_contact_store_new ();
name_selector_entry->priv->contact_store = contact_store;
- groups = e_source_list_peek_groups (name_selector_entry->priv->source_list);
- for (l = groups; l; l = g_slist_next (l)) {
- ESourceGroup *group = l->data;
- GSList *sources = e_source_group_peek_sources (group);
- GSList *m;
+ registry = e_source_registry_get_default ();
+ extension_name = E_SOURCE_EXTENSION_ADDRESS_BOOK;
+ list = e_source_registry_list_sources (registry, extension_name);
- for (m = sources; m; m = g_slist_next (m)) {
- ESource *source = m->data;
- GCancellable *cancellable;
- const gchar *completion;
+ for (iter = list; iter != NULL; iter = g_list_next (iter)) {
+ ESource *source = E_SOURCE (iter->data);
+ ESourceAutocomplete *extension;
+ GCancellable *cancellable;
+ const gchar *extension_name;
- /* Skip non-completion sources */
- completion = e_source_get_property (source, "completion");
- if (!completion || g_ascii_strcasecmp (completion, "true"))
- continue;
+ extension_name = E_SOURCE_EXTENSION_AUTOCOMPLETE;
+ extension = e_source_get_extension (source, extension_name);
- cancellable = g_cancellable_new ();
+ /* Skip non-completion sources. */
+ if (!e_source_autocomplete_get_include_me (extension))
+ continue;
- g_queue_push_tail (
- &name_selector_entry->priv->cancellables,
- cancellable);
+ cancellable = g_cancellable_new ();
- e_client_utils_open_new (
- source, E_CLIENT_SOURCE_TYPE_CONTACTS, TRUE, cancellable,
- e_client_utils_authenticate_handler, NULL,
- book_loaded_cb, g_object_ref (contact_store));
- }
+ g_queue_push_tail (
+ &name_selector_entry->priv->cancellables,
+ cancellable);
+
+ e_client_utils_open_new (
+ source, E_CLIENT_SOURCE_TYPE_CONTACTS, TRUE, cancellable,
+ e_client_utils_authenticate_handler, NULL,
+ book_loaded_cb, g_object_ref (contact_store));
}
setup_contact_store (name_selector_entry);
@@ -2373,7 +2377,7 @@ find_client_by_contact (GSList *clients,
if (!source)
continue;
- if (g_strcmp0 (source_uid, e_source_peek_uid (source)) == 0)
+ if (g_strcmp0 (source_uid, e_source_get_uid (source)) == 0)
return client;
}
}
@@ -2985,13 +2989,6 @@ e_name_selector_entry_init (ENameSelectorEntry *name_selector_entry)
g_queue_init (&name_selector_entry->priv->cancellables);
- /* Source list */
-
- if (!e_book_client_get_sources (&name_selector_entry->priv->source_list, NULL)) {
- g_warning ("ENameSelectorEntry can't find any addressbooks!");
- return;
- }
-
/* read minimum_query_length from gconf*/
gconf = gconf_client_get_default ();
if (COMPLETION_CUE_MIN_LEN == 0) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]