diff options
author | Milan Crha <mcrha@redhat.com> | 2011-06-14 14:54:20 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2011-06-14 14:54:20 +0800 |
commit | 38790d8478e906a5c59d0c4a5216f297f305bfeb (patch) | |
tree | 0f9a96db2765901f2a27b68c84815a491214ecc1 /widgets | |
parent | 08af0d1f81a4e983bb49d8fb8fe74e670adbb8f6 (diff) | |
download | gsoc2013-evolution-38790d8478e906a5c59d0c4a5216f297f305bfeb.tar.gz gsoc2013-evolution-38790d8478e906a5c59d0c4a5216f297f305bfeb.tar.zst gsoc2013-evolution-38790d8478e906a5c59d0c4a5216f297f305bfeb.zip |
Do not use deprecated EBook/ECal API
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/misc/e-contact-map-window.c | 48 | ||||
-rw-r--r-- | widgets/misc/e-contact-map-window.h | 4 |
2 files changed, 29 insertions, 23 deletions
diff --git a/widgets/misc/e-contact-map-window.c b/widgets/misc/e-contact-map-window.c index 117051528d..1618086a1b 100644 --- a/widgets/misc/e-contact-map-window.c +++ b/widgets/misc/e-contact-map-window.c @@ -30,7 +30,8 @@ #include <champlain/champlain.h> -#include <libebook/e-book.h> +#include <libebook/e-book-client.h> +#include <libebook/e-book-query.h> #include <libebook/e-contact.h> #include <string.h> @@ -73,25 +74,27 @@ marker_doubleclick_cb (ClutterActor *marker, } static void -book_contacts_received_cb (EBook *book, - const GError *error, - GList *list, - gpointer closure) +book_contacts_received_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { - EContactMapWindow *window = closure; - GList *p; + EContactMapWindow *window = user_data; + EBookClient *client = E_BOOK_CLIENT (source_object); + GSList *contacts = NULL, *p; + GError *error = NULL; - g_return_if_fail (error == NULL); + if (!e_book_client_get_contacts_finish (client, result, &contacts, &error)) + contacts = NULL; - for (p = list; p; p = p->next) { + if (error) { + g_debug ("%s: Failed to get contacts: %s", G_STRFUNC, error ? error->message : "Unknown error"); + g_clear_error (&error); + } + for (p = contacts; p; p = p->next) { e_contact_map_add_contact (window->priv->map, (EContact*) p->data); - } - g_list_foreach (list, (GFunc) g_object_unref, NULL); - g_list_free (list); - g_object_unref (book); + e_client_util_free_object_slist (contacts); + g_object_unref (client); } static void @@ -435,23 +438,26 @@ e_contact_map_window_new (void) */ void e_contact_map_window_load_addressbook (EContactMapWindow *map, - EBook *book) + EBookClient *book_client) { EBookQuery *book_query; + gchar *query_string; + + g_return_if_fail (E_IS_CONTACT_MAP_WINDOW (map)); + g_return_if_fail (E_IS_BOOK_CLIENT (book_client)); + /* Reference book, so that it does not get deleted before the callback is involved. The book is unrefed in the callback */ - g_object_ref (book); - - g_return_if_fail (E_IS_CONTACT_MAP_WINDOW (map)); - g_return_if_fail (E_IS_BOOK (book)); + g_object_ref (book_client); book_query = e_book_query_field_exists (E_CONTACT_ADDRESS); + query_string = e_book_query_to_string (book_query); + e_book_query_unref (book_query); - e_book_get_contacts_async (book, book_query, - (EBookListAsyncCallback) book_contacts_received_cb, map); + e_book_client_get_contacts (book_client, query_string, NULL, book_contacts_received_cb, map); - e_book_query_unref (book_query); + g_free (query_string); } EContactMap* diff --git a/widgets/misc/e-contact-map-window.h b/widgets/misc/e-contact-map-window.h index ea96d88e39..ea92d75c46 100644 --- a/widgets/misc/e-contact-map-window.h +++ b/widgets/misc/e-contact-map-window.h @@ -23,7 +23,7 @@ #include <gtk/gtk.h> -#include <libebook/e-book.h> +#include <libebook/e-book-client.h> #include <e-contact-map.h> @@ -68,7 +68,7 @@ GType e_contact_map_window_get_type (void) G_GNUC_CONST; EContactMapWindow* e_contact_map_window_new (void); void e_contact_map_window_load_addressbook (EContactMapWindow *window, - EBook *book); + EBookClient *book); EContactMap* e_contact_map_window_get_map (EContactMapWindow *window); |