from gi.repository import GObject, Gdk, Gtk

if __name__ == "__main__": 
    store = Gtk.TreeStore(GObject.TYPE_STRING)
    store.append(None, ("Row #1",))
    store.append(None, ("Row #2",))
    store.append(None, ("Row #3",))
    
    treeview = Gtk.TreeView.new_with_model(store)
    
    cell = Gtk.CellRendererText()
    column = Gtk.TreeViewColumn("Rows")
    column.pack_start(cell, True)
    column.add_attribute(cell, 'text', 0)
    treeview.append_column(column)
    
    targets = [('MY_TREE_MODEL_ROW', Gtk.TargetFlags.SAME_WIDGET, 0),]
    try:
        treeview.enable_model_drag_source(Gdk.ModifierType.BUTTON1_MASK, 
                                          targets,
                                          Gdk.DragAction.DEFAULT |
                                          Gdk.DragAction.MOVE)
    except TypeError as e:
        print "With 4 arguments: %s" % str(e)
    
    try:
        treeview.enable_model_drag_source(Gdk.ModifierType.BUTTON1_MASK, 
                                          targets,
                                          len(targets),
                                          Gdk.DragAction.DEFAULT |
                                          Gdk.DragAction.MOVE)
    except TypeError as e:
        print "With 5 arguments: %s" % str(e)
    
                                      
    window = Gtk.Window()
    window.set_default_size(300, 200)
    window.connect("destroy", Gtk.main_quit)
    window.add(treeview)
    window.show_all()
    
    Gtk.main()
