]> err.no Git - eweouz/commitdiff
API updates
authorTollef Fog Heen <tfheen@err.no>
Sun, 29 Sep 2013 13:41:01 +0000 (15:41 +0200)
committerTollef Fog Heen <tfheen@err.no>
Sun, 29 Sep 2013 13:41:01 +0000 (15:41 +0200)
src/eweouz-write-addressbook.c

index fbaba2e0a39426d96b977214bb699d3bebd94f56..81cbfbad4cffecc8639da7af0f06a3a80c833e1b 100644 (file)
@@ -33,15 +33,14 @@ Notes     String or      `bbdb-record-raw-notes'    String or Association
 
 int main(int argc, char **argv)
 {
-       EBook *book;
+       EBookClient *client;
        ESourceRegistry *eds_source_registry = NULL;
        EBookClient *ebc;
        ESource *source;
-       EBookQuery *query;
-       GList *contacts;
+       GSList *contacts;
        GList *sources;
        GList *g, *s;
-       GList *c;
+       GSList *c;
        GError *error = NULL;
        GOptionContext *optioncontext;
 
@@ -129,15 +128,13 @@ int main(int argc, char **argv)
                }
        } else {
                char *qu = g_strdup_printf ("(is \"id\" \"%s\")", id);
-               query = e_book_query_from_string(qu);
 
-               sources = e_source_registry_list_sources (eds_source_registry, NULL);
+               sources = e_source_registry_list_sources (eds_source_registry, E_SOURCE_EXTENSION_ADDRESS_BOOK);
 
                for (s = sources ; s; s = s->next) {
                        source = E_SOURCE(s->data);
-                       book = e_book_new(source, &error);
-                       e_book_open(book, TRUE, &error);
-                       e_book_get_contacts(book, query, &contacts, &error);
+                       client = E_BOOK_CLIENT(e_book_client_connect_sync(source, NULL, &error));
+                       e_book_client_get_contacts_sync(client, qu, &contacts, NULL, &error);
 
                        for (c = contacts; c; c = c->next) {
                                if (full_name)
@@ -164,10 +161,9 @@ int main(int argc, char **argv)
                                        }
                                        g_object_set(E_CONTACT(c->data), "email", el, NULL);
                                }
-                               e_book_commit_contact(book, E_CONTACT(c->data), &error);
+                               e_book_client_modify_contact_sync(client, E_CONTACT(c->data), NULL, &error);
                        }
                }
-               e_book_query_unref (query);
                g_free(qu);
        }
        return 0;