#!/usr/bin/env python

import sys

import gi
from gi.repository import Gtk

def _quit(*args):
    Gtk.main_quit()

class Window(Gtk.Window):
    __gtype_name__ = 'TestWindow'

    def __init__(self):
        Gtk.Window.__init__(self)

        self.set_title('GtkSourceView Demo')
        self.set_default_size(500, 500)
        self.connect_after('destroy', _quit)

        self._vbox = Gtk.VBox()
        self.add(self._vbox)

        sw = Gtk.ScrolledWindow(hadjustment=None,
                                vadjustment=None)
        sw.set_shadow_type(Gtk.ShadowType.IN)

        self._buf = Gtk.TextBuffer()
        self._view = Gtk.TextView.new_with_buffer(self._buf)

        self._vbox.pack_start(sw, True, True, 0)
        sw.add(self._view)

def main(args = []):
    global window

    window = Window()
    window.show_all()
    Gtk.main()

if __name__ == '__main__':
    main(sys.argv)

