#!/usr/bin/python
from gi.repository import Gtk

class MyWindow(Gtk.Window):
    def __init__(self):
        Gtk.Window.__init__(self, title="Hello World")
        self.set_size_request(450,350)

        hbox = Gtk.HBox()
        self.add(hbox)

        self.button = Gtk.Button(label="Click Here")
        self.button.connect("clicked", self.on_button_clicked)
        hbox.add(self.button)

        self.store = Gtk.TreeStore(str, object, int) # markup, file name, line number
        self.tree = Gtk.TreeView(model=self.store)
        tc = Gtk.TreeViewColumn("File", Gtk.CellRendererText(), markup=0)
        self.tree.append_column(tc)
        hbox.add(self.tree)


        it = self.store.append(None, ["foo", "abc", 0])
        self.store.append(it, ["foo1", "abc1", 42])

        it = self.store.append(None, ["bar", "xyz", 0])
        self.store.append(it, ["bar1", "xyz1", 23])

    def on_button_clicked(self, widget):
        self.tree.set_model(None)

win = MyWindow()
win.connect("delete-event", Gtk.main_quit)
win.show_all()
Gtk.main()

