import gtk
gtk.gdk.threads_init()

import threading
import evolution

class Tester(threading.Thread):
    def run(self):
        print "*"*50
        book = evolution.ebook.open_addressbook("default")
        print "#"*50
        print book.get_all_contacts()

class GUI:
    def __init__(self):
        w = gtk.Window()
        b = gtk.Button("Click")
        b.connect("clicked", self._click)
        w.add(b)
        w.show_all()

        print evolution.ebook.list_addressbooks()

    def _click(*args):
        t = Tester()
        t.start()

if __name__ == "__main__":
    g = GUI()
    gtk.main()
