#!/usr/bin/python

from gi.repository import EDataServer
from gi.repository import EBook

registry = EDataServer.SourceRegistry.new_sync(None)
source = registry.ref_default_address_book()
address_book = EBook.BookClient.new(source)
address_book.open_sync(False, None)

contact = EBook.Contact()
contact.set_property('home-phone', "555-0000")
contact.set_property('business-phone', "555-1234")
contact.set_property('other-phone', "999-1111")
print("Home: %s" % contact.get_property("home-phone"))
print("Work: %s" % contact.get_property("business-phone"))
print("Other: %s" % contact.get_property("other-phone"))
print("VCard: %s" % contact.to_string(False))
