#!/usr/bin/env python
import sys
from gi.repository import Gtk, Gio
from gi.repository import EvinceDocument
from gi.repository import EvinceView

def sync_source(ev, a):
    print "Sync source"
    print ev
    print a
    
def quit(w, *a):
    w.destroy()
    Gtk.main_quit()
    return False

window = Gtk.Window.new(Gtk.WindowType.TOPLEVEL)
window.set_border_width(24)
scroll = Gtk.ScrolledWindow()
window.add(scroll)

EvinceDocument.init()
doc = EvinceDocument.Document.factory_get_document('file:///home/user/file.pdf')
view = EvinceView.View()
model = EvinceView.DocumentModel()
model.set_document(doc)
view.set_model(model)
scroll.add(view)
view.connect("sync-source",sync_source)
window.connect("delete-event",quit)

window.show_all()
sys.exit(Gtk.main())
