]> err.no Git - eweouz/commitdiff
More API updates, continue on error
authorTollef Fog Heen <tfheen@err.no>
Sun, 29 Sep 2013 13:30:24 +0000 (15:30 +0200)
committerTollef Fog Heen <tfheen@err.no>
Sun, 29 Sep 2013 13:30:24 +0000 (15:30 +0200)
src/eweouz-dump-addressbook.c

index 85477854c7b30f4af8fdd19096eb03964c1b3e7d..e286881ad57883c6fe497c383cb93fb3b4664e6f 100644 (file)
@@ -56,15 +56,15 @@ static GOptionEntry entries[] =
 
 int main(int argc, char **argv)
 {
-       EBook *book;
+       EBookClient *client;
        ESourceRegistry *eds_source_registry = NULL;
        GList *sources;
        ESource *source;
        GSList *groups;
        EBookQuery *query;
-       GList *contacts;
+       GSList *contacts;
        GList *g, *s;
-       GList *c;
+       GSList *c;
        GError *error = NULL;
        GOptionContext *optioncontext;
 
@@ -95,27 +95,23 @@ int main(int argc, char **argv)
 
        for (s = sources ; s; s = s->next) {
                source = E_SOURCE(s->data);
-               book = e_book_new(source, &error);
+               client = E_BOOK_CLIENT(e_book_client_connect_sync(source, NULL, &error));
 
                if (error != NULL) {
-                       fprintf(stderr, "%s\n", error->message);
-                       return 1;
+                 /* Probably no backend name, so skip */
+                 /*                    fprintf(stderr, "e_book_new: %s\n", error->message);*/
+                       g_error_free(error);
+                       error = NULL;
+                       continue;
                }
 
-               e_book_open(book, TRUE, &error);
-
-
+               /* XXX: leaks the query, but we're short running so doesn't really matter */
+               e_book_client_get_contacts_sync(client, e_book_query_to_string(query), &contacts, NULL, &error);
                if (error != NULL) {
                        fprintf(stderr, "%s\n", error->message);
                        return 1;
                }
-               
-               e_book_get_contacts(book, query, &contacts, &error);
-               if (error != NULL) {
-                       fprintf(stderr, "%s\n", error->message);
-                       return 1;
-               }
-               
+
                for (c = contacts; c; c = c->next) {
                        dump_as_vcard(E_CONTACT(c->data), 1);
                }