Skip to content

Commit

Permalink
Add --uri support to eds-get-vcard
Browse files Browse the repository at this point in the history
  • Loading branch information
rossburton committed Feb 11, 2008
1 parent 38c5a38 commit 084284a
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions tools/eds-get-vcard.c
@@ -1,21 +1,41 @@
#include <libebook/e-book.h>
#include "util.h"

static char *uri = NULL;

static const GOptionEntry options[] = {
{ "uri", 'u', 0, G_OPTION_ARG_STRING, &uri, "URI of book to open (default: system addressbook)." },
{ NULL }
};


int
main (int argc, char **argv)
{
GError *error = NULL;
GOptionContext *context;
EBook *book;
EContact *contact = NULL;

g_type_init ();

context = g_option_context_new ("<UID> - get vCard");
g_option_context_add_main_entries (context, options, NULL);
if (!g_option_context_parse (context, &argc, &argv, &error)) {
g_error ("Cannot parse arguments: %s", error->message);
}

if (argc != 2) {
g_print ("Usage: eds-get-vcard <UID>");
g_print ("Usage: eds-get-vcard <UID>\n");
return 1;
}

book = e_book_new_system_addressbook (&error);
if (uri) {
book = e_book_new_from_uri (uri, &error);
g_free (uri);
} else {
book = e_book_new_system_addressbook (&error);
}
if (!book)
die ("Cannot get book", error);

Expand Down

0 comments on commit 084284a

Please sign in to comment.