public void fill() { Gtk.Button cancel = new Gtk.Button("Cancel scan"); Gtk.VSeparator sep = new Gtk.VSeparator(); cancel.Clicked += delegate(object sender, EventArgs args) { _fill_canceled = true; }; bar.Add(sep); sep.Show(); bar.Add(cancel); cancel.Show(); bar.Show(); getSheets().Clear(); basedir = MySource.getCueSheetDir(); Hyena.Log.Information("Base directory=" + basedir); if (basedir != null) { _fill_ready = false; _fill_count = 0; _fill_dir_count = 0; _fill_canceled = false; _fill_cues.Clear(); _fill_dirs.Clear(); fill(basedir); GLib.Timeout.Add(500, delegate() { if (_fill_ready || _fill_canceled) { try { Hyena.Log.Information("Reload albums"); MySource.getAlbumModel().Reload(); Hyena.Log.Information(MySource.getAlbumModel().Count.ToString()); Hyena.Log.Information("Reload artists"); MySource.getArtistModel().Reload(); Hyena.Log.Information(MySource.getArtistModel().Count.ToString()); Hyena.Log.Information("Reload composers"); MySource.getComposerModel().Reload(); Hyena.Log.Information(MySource.getComposerModel().Count.ToString()); Hyena.Log.Information("Reload genres"); MySource.getGenreModel().Reload(); Hyena.Log.Information(MySource.getGenreModel().Count.ToString()); Hyena.Log.Information("Reload tracks"); MySource.getTrackModel().Reload(); Hyena.Log.Information("Reload play lists"); MySource.getPlayListsModel().Reload(); Hyena.Log.Information("Reloaded all"); } catch (System.Exception e) { Hyena.Log.Information(e.ToString()); } Hyena.Log.Information("Reloaded"); filling.Text = ""; bar.Remove(sep); bar.Remove(cancel); bar.Hide(); FillLibrary(); return(false); } else { return(true); } }); } }