void HandleEditClicked(object sender, EventArgs e)
    {
        TreeIter iter;
        if (!treeView.Selection.GetSelected (out iter))
            return;
        var song = (Song)treeView.Model.GetValue (iter, 0);
        var pos = songs.IndexOf (song);

        var dlg = new EditSongDialog (song, pos, true, songs.Count);
        dlg.Run ();
        dlg.Destroy ();
    }
    void HandleReplaceClicked(object sender, EventArgs e)
    {
        TreeIter iter;
        if (!treeView.Selection.GetSelected (out iter))
            return;
        var song = (Song)treeView.Model.GetValue (iter, 0);
        var pos = songs.IndexOf (song);

        var dlg = new EditSongDialog (pos, songs.Count, true);
        if ((ResponseType)dlg.Run () == ResponseType.Ok)
            songs [pos] = dlg.Song;
        dlg.Destroy ();
    }
 void HandleAddClicked(object sender, EventArgs e)
 {
     var dlg = new EditSongDialog (songs.Count, songs.Count, false);
     if ((ResponseType)dlg.Run () == ResponseType.Ok)
         songs.Insert (dlg.Position, dlg.Song);
     dlg.Destroy ();
 }