]> err.no Git - eweouz/commitdiff
Initial import from non-versioned sources
authorTollef Fog Heen <tfheen@err.no>
Tue, 16 Oct 2007 15:31:10 +0000 (17:31 +0200)
committerTollef Fog Heen <tfheen@err.no>
Tue, 16 Oct 2007 15:31:10 +0000 (17:31 +0200)
Makefile.am [new file with mode: 0644]
autogen.sh [new file with mode: 0755]
configure.ac [new file with mode: 0644]
src/Makefile.am [new file with mode: 0644]
src/dump-addressbook.c [new file with mode: 0644]

diff --git a/Makefile.am b/Makefile.am
new file mode 100644 (file)
index 0000000..c24d07c
--- /dev/null
@@ -0,0 +1,2 @@
+
+SUBDIRS=src
\ No newline at end of file
diff --git a/autogen.sh b/autogen.sh
new file mode 100755 (executable)
index 0000000..f1fd559
--- /dev/null
@@ -0,0 +1,10 @@
+#! /bin/sh
+
+set -e
+
+aclocal-1.9
+autoheader
+libtoolize --copy --force
+automake-1.9 --copy --add-missing --foreign
+autoconf
+./configure --enable-maintainer-mode "$@"
diff --git a/configure.ac b/configure.ac
new file mode 100644 (file)
index 0000000..9dd8c8c
--- /dev/null
@@ -0,0 +1,28 @@
+
+AC_INIT([eds-address], 0.1)
+AC_CONFIG_SRCDIR(src/dump-addressbook.c)
+AM_INIT_AUTOMAKE([1.9])
+AM_CONFIG_HEADER(config.h)
+# AM_MAINTAINER_MODE
+
+PKG_CHECK_MODULES(EDS_ADDRESS, [libedataserver-1.2 libebook-1.2 gconf-2.0 glib-2.0])
+
+AC_CHECK_TYPES([sig_atomic_t], [], [], [#include <signal.h>])
+AC_CHECK_HEADER([sys/types.h], [], [exit 1], [])
+AC_CHECK_HEADER([tdb.h],[],[exit 1],[[
+#include <sys/types.h>
+#include <signal.h>
+]])
+
+AC_DISABLE_STATIC
+AM_PROG_LIBTOOL
+
+AC_PROG_CC
+
+#GETTEXT_PACKAGE=evolution-backend-tdb
+#AC_SUBST(GETTEXT_PACKAGE)
+#AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [The prefix for our gettext translation domains.])
+
+#AM_GLIB_GNU_GETTEXT
+
+AC_OUTPUT([Makefile src/Makefile])
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644 (file)
index 0000000..e91f9a7
--- /dev/null
@@ -0,0 +1,6 @@
+
+bin_PROGRAMS = dump-addressbook
+
+dump_addressbook_SOURCES = dump-addressbook.c
+AM_CFLAGS = $(EDS_ADDRESS_CFLAGS)
+AM_LDFLAGS = $(EDS_ADDRESS_LIBS)
diff --git a/src/dump-addressbook.c b/src/dump-addressbook.c
new file mode 100644 (file)
index 0000000..bdd63e6
--- /dev/null
@@ -0,0 +1,49 @@
+#include <libebook/e-book.h>
+#include <libedataserver/e-source-group.h>
+#include <gconf/gconf.h>
+#include <glib.h>
+
+int main(int argc, char **argv) {
+  EBook *book;
+  ESourceList *source_list;
+  ESourceGroup *group;
+  ESource *source;
+  GSList *groups;
+  EBookQuery *query;
+  GList *contacts;
+  EContact *contact;
+  GSList *sources;
+  GSList *g, *s;
+  GList *c;
+
+  int i;
+  GError *error = NULL;
+
+  fprintf(stderr,"%d\n", e_book_get_addressbooks(&source_list, &error));
+  if (error != NULL) {
+    fprintf(stderr, "%s\n", error->message);
+  }
+  groups = e_source_list_peek_groups(source_list);
+  for (g = groups; g; g = g->next) {
+
+    group = E_SOURCE_GROUP (g->data);
+    fprintf(stderr, "SOURCE GROUP: %s\n", e_source_group_peek_base_uri(group));
+    sources = e_source_group_peek_sources(group);
+    
+    for (s = sources ; s; s = s->next) {
+      source = E_SOURCE(s->data);
+      book = e_book_new(source, &error);
+      e_book_open(book, TRUE, &error);
+      fprintf(stderr, "\tSOURCE: %s\n", e_source_peek_name(source));
+      //      query = e_book_query_any_field_contains("");
+      query = e_book_query_field_exists(E_CONTACT_FULL_NAME);
+      e_book_get_contacts(book, query, &contacts, &error);
+
+      for (c = contacts; c; c = c->next) {
+       contact = E_CONTACT(c->data);
+       fprintf(stderr, "\t\tCONTACT: %s\n", e_contact_get(contact, E_CONTACT_FULL_NAME));
+      }
+      
+    }
+  }
+}