private void AddLibrary(DapLibrarySync library_sync) { var opts = new LibrarySyncOptions(library_sync); table.AddRow(library_sync, opts.RowCells); library_opts.Add(library_sync, opts); }
private void RemoveLibrary(DapLibrarySync library_sync) { table.RemoveRow(library_sync); var opts = library_opts[library_sync]; library_opts.Remove(library_sync); opts.Dispose(); }
public LibrarySyncOptions(DapLibrarySync library_sync) { this.library_sync = library_sync; var library = library_sync.Library; // Translators: {0} is the name of a library, eg 'Music' or 'Podcasts' var label = new Label(String.Format(Catalog.GetString("{0}:"), library.Name)) { Xalign = 1f }; // Create the combo for selecting what type of sync to do for this library combo = new DictionaryComboBox <DatabaseSource> (); combo.RowSeparatorFunc = (model, iter) => { return((string)model.GetValue(iter, 0) == "---"); }; combo.Add(null, Catalog.GetString("Manage manually"), -10); combo.Add(null, Catalog.GetString("Sync entire library"), -9); foreach (var child in library.Children) { AddPlaylist(child); } library.ChildSourceAdded += OnChildSourceAdded; library.ChildSourceRemoved += OnChildSourceRemoved; if (!library_sync.Enabled) { combo.Active = 0; } else if (library_sync.SyncEntireLibrary) { combo.Active = 1; } else if (library_sync.SyncSource != null) { combo.ActiveValue = library_sync.SyncSource; } combo.Changed += (o, a) => { library_sync.Enabled = combo.Active != 0; library_sync.SyncEntireLibrary = combo.Active == 1; if (combo.Active > 1) { library_sync.SyncSource = combo.ActiveValue; } library_sync.MaybeTriggerAutoSync(); }; RowCells = new Widget [] { label, combo }; }