diff options
Diffstat (limited to 'addressbook/gui')
-rw-r--r-- | addressbook/gui/merging/eab-contact-compare.c | 24 | ||||
-rw-r--r-- | addressbook/gui/merging/eab-contact-compare.h | 7 | ||||
-rw-r--r-- | addressbook/gui/merging/eab-contact-merging.c | 22 | ||||
-rw-r--r-- | addressbook/gui/merging/eab-contact-merging.h | 10 |
4 files changed, 41 insertions, 22 deletions
diff --git a/addressbook/gui/merging/eab-contact-compare.c b/addressbook/gui/merging/eab-contact-compare.c index 231a14281c..872648ca42 100644 --- a/addressbook/gui/merging/eab-contact-compare.c +++ b/addressbook/gui/merging/eab-contact-compare.c @@ -28,6 +28,7 @@ #include <ctype.h> #include <string.h> #include <libebook/e-book-query.h> +#include <libedataserver/e-source-registry.h> #include <libedataserverui/e-client-utils.h> #include "addressbook/util/eab-book-util.h" #include "eab-contact-compare.h" @@ -562,7 +563,6 @@ eab_contact_compare (EContact *contact1, typedef struct _MatchSearchInfo MatchSearchInfo; struct _MatchSearchInfo { - ESourceList *source_list; EContact *contact; GList *avoid; EABContactMatchQueryCallback cb; @@ -573,9 +573,6 @@ static void match_search_info_free (MatchSearchInfo *info) { if (info) { - if (info->source_list != NULL) - g_object_unref (info->source_list); - g_object_unref (info->contact); /* This should already have been deallocated, but just in case... */ @@ -786,15 +783,18 @@ book_loaded_cb (GObject *source_object, } void -eab_contact_locate_match (EContact *contact, +eab_contact_locate_match (ESourceRegistry *registry, + EContact *contact, EABContactMatchQueryCallback cb, gpointer closure) { - eab_contact_locate_match_full (NULL, contact, NULL, cb, closure); + eab_contact_locate_match_full ( + registry, NULL, contact, NULL, cb, closure); } /** * e_contact_locate_match_full: + * @registry: an #ESourceRegistry * @book: The book to look in. If this is NULL, use the default * addressbook. * @contact: The contact to compare to. @@ -805,7 +805,8 @@ eab_contact_locate_match (EContact *contact, * Look for the best match and return it using the EABContactMatchQueryCallback. **/ void -eab_contact_locate_match_full (EBookClient *book_client, +eab_contact_locate_match_full (ESourceRegistry *registry, + EBookClient *book_client, EContact *contact, GList *avoid, EABContactMatchQueryCallback cb, @@ -814,6 +815,7 @@ eab_contact_locate_match_full (EBookClient *book_client, MatchSearchInfo *info; ESource *source; + g_return_if_fail (E_IS_SOURCE_REGISTRY (registry)); g_return_if_fail (E_IS_CONTACT (contact)); g_return_if_fail (cb != NULL); @@ -829,14 +831,12 @@ eab_contact_locate_match_full (EBookClient *book_client, return; } - if (!e_book_client_get_sources (&info->source_list, NULL)) - return; - - source = e_source_list_peek_default_source (info->source_list); + source = e_source_registry_ref_default_address_book (registry); e_client_utils_open_new ( source, E_CLIENT_SOURCE_TYPE_CONTACTS, FALSE, NULL, - e_client_utils_authenticate_handler, NULL, book_loaded_cb, info); + + g_object_unref (source); } diff --git a/addressbook/gui/merging/eab-contact-compare.h b/addressbook/gui/merging/eab-contact-compare.h index 8c07a56f08..30c1c2d0cf 100644 --- a/addressbook/gui/merging/eab-contact-compare.h +++ b/addressbook/gui/merging/eab-contact-compare.h @@ -28,6 +28,7 @@ #include <libebook/e-contact.h> #include <libebook/e-book-client.h> +#include <libedataserver/e-source-registry.h> typedef enum { EAB_CONTACT_MATCH_NOT_APPLICABLE = 0, @@ -87,10 +88,12 @@ EABContactMatchType eab_contact_compare (EContact *contact1, EContact *contact2); -void eab_contact_locate_match (EContact *contact, +void eab_contact_locate_match (ESourceRegistry *registry, + EContact *contact, EABContactMatchQueryCallback cb, gpointer closure); -void eab_contact_locate_match_full (EBookClient *book_client, +void eab_contact_locate_match_full (ESourceRegistry *registry, + EBookClient *book_client, EContact *contact, GList *avoid, EABContactMatchQueryCallback cb, diff --git a/addressbook/gui/merging/eab-contact-merging.c b/addressbook/gui/merging/eab-contact-merging.c index f13b66d1c4..cbcb376734 100644 --- a/addressbook/gui/merging/eab-contact-merging.c +++ b/addressbook/gui/merging/eab-contact-merging.c @@ -45,6 +45,7 @@ typedef enum { typedef struct { EContactMergingOpType op; + ESourceRegistry *registry; EBookClient *book_client; /*contact is the new contact which the user has tried to add to the addressbook*/ EContact *contact; @@ -74,7 +75,7 @@ add_lookup (EContactMergingLookup *lookup) if (running_merge_requests < SIMULTANEOUS_MERGING_REQUESTS) { running_merge_requests++; eab_contact_locate_match_full ( - lookup->book_client, + lookup->registry, lookup->book_client, lookup->contact, lookup->avoid, match_query_callback, lookup); } @@ -100,7 +101,7 @@ finished_lookup (void) running_merge_requests++; eab_contact_locate_match_full ( - lookup->book_client, + lookup->registry, lookup->book_client, lookup->contact, lookup->avoid, match_query_callback, lookup); } @@ -109,6 +110,7 @@ finished_lookup (void) static void free_lookup (EContactMergingLookup *lookup) { + g_object_unref (lookup->registry); g_object_unref (lookup->book_client); g_object_unref (lookup->contact); g_list_free (lookup->avoid); @@ -674,16 +676,20 @@ match_query_callback (EContact *contact, } gboolean -eab_merging_book_add_contact (EBookClient *book_client, +eab_merging_book_add_contact (ESourceRegistry *registry, + EBookClient *book_client, EContact *contact, EABMergingIdAsyncCallback cb, gpointer closure) { EContactMergingLookup *lookup; + g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), FALSE); + lookup = g_new (EContactMergingLookup, 1); lookup->op = E_CONTACT_MERGING_ADD; + lookup->registry = g_object_ref (registry); lookup->book_client = g_object_ref (book_client); lookup->contact = g_object_ref (contact); lookup->id_cb = cb; @@ -697,16 +703,20 @@ eab_merging_book_add_contact (EBookClient *book_client, } gboolean -eab_merging_book_modify_contact (EBookClient *book_client, +eab_merging_book_modify_contact (ESourceRegistry *registry, + EBookClient *book_client, EContact *contact, EABMergingAsyncCallback cb, gpointer closure) { EContactMergingLookup *lookup; + g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), FALSE); + lookup = g_new (EContactMergingLookup, 1); lookup->op = E_CONTACT_MERGING_COMMIT; + lookup->registry = g_object_ref (registry); lookup->book_client = g_object_ref (book_client); lookup->contact = g_object_ref (contact); lookup->cb = cb; @@ -720,7 +730,8 @@ eab_merging_book_modify_contact (EBookClient *book_client, } gboolean -eab_merging_book_find_contact (EBookClient *book_client, +eab_merging_book_find_contact (ESourceRegistry *registry, + EBookClient *book_client, EContact *contact, EABMergingContactAsyncCallback cb, gpointer closure) @@ -730,6 +741,7 @@ eab_merging_book_find_contact (EBookClient *book_client, lookup = g_new (EContactMergingLookup, 1); lookup->op = E_CONTACT_MERGING_FIND; + lookup->registry = g_object_ref (registry); lookup->book_client = g_object_ref (book_client); lookup->contact = g_object_ref (contact); lookup->c_cb = cb; diff --git a/addressbook/gui/merging/eab-contact-merging.h b/addressbook/gui/merging/eab-contact-merging.h index a922d6b9fb..a4f62e80c0 100644 --- a/addressbook/gui/merging/eab-contact-merging.h +++ b/addressbook/gui/merging/eab-contact-merging.h @@ -27,6 +27,7 @@ #define __E_CONTACT_MERGING_H__ #include <libebook/e-book-client.h> +#include <libedataserver/e-source-registry.h> G_BEGIN_DECLS @@ -43,17 +44,20 @@ typedef void (*EABMergingContactAsyncCallback) EContact *contact, gpointer closure); -gboolean eab_merging_book_add_contact (EBookClient *book_client, +gboolean eab_merging_book_add_contact (ESourceRegistry *registry, + EBookClient *book_client, EContact *contact, EABMergingIdAsyncCallback cb, gpointer closure); -gboolean eab_merging_book_modify_contact (EBookClient *book_client, +gboolean eab_merging_book_modify_contact (ESourceRegistry *registry, + EBookClient *book_client, EContact *contact, EABMergingAsyncCallback cb, gpointer closure); -gboolean eab_merging_book_find_contact (EBookClient *book_client, +gboolean eab_merging_book_find_contact (ESourceRegistry *registry, + EBookClient *book_client, EContact *contact, EABMergingContactAsyncCallback cb, gpointer closure); |