public void onStartDetecting(object o, EventArgs args) { if (source == null) { source = new DuplicateSongDetectorSource(); ServiceManager.SourceManager.MusicLibrary.AddChildSource(source); } ServiceManager.SourceManager.SetActiveSource(source); SongDuplicateView.ReloadWindow(); source.Parent.ChildSourceRemoved += delegate(Sources.SourceEventArgs source_args) { if (source_args.Source.Equals(source)) { source = null; } }; }
public DuplicateSongDetectorSource() : base(AddinManager.CurrentLocalizer.GetString("Duplicate Song Detector"), AddinManager.CurrentLocalizer.GetString("Duplicate Song Detector"), sort_order, "extension-unique-id") { Properties.SetStringList("Icon.Name", "search", "gtk-search"); Properties.Set <Banshee.Sources.Gui.ISourceContents> ("Nereid.SourceContents", new SongDuplicateView()); Properties.SetString("ActiveSourceUIResource", "ActiveUI.xml"); Properties.SetString("UnmapSourceActionLabel", AddinManager.CurrentLocalizer.GetString("Close")); Properties.SetString("UnmapSourceActionIconName", "gtk-close"); var actions = new BansheeActionGroup("duplicate-source"); actions.AddImportant( new Gtk.ActionEntry("onStartDetecting", Gtk.Stock.Refresh, AddinManager.CurrentLocalizer.GetString("Refresh"), null, null, (o, a) => { SongDuplicateView.ReloadWindow(); }) ); actions.Register(); }