public AlbumListView() : base() { renderer = new ColumnCellAlbum(); grid_layout = new DataViewLayoutGrid() { ChildAllocator = () => new DataViewChildAlbum(), View = this }; grid_layout.ChildCountChanged += (o, e) => { var artwork_manager = ServiceManager.Get <ArtworkManager> (); if (artwork_manager != null && e.Value > 0) { int size = (int)((DataViewChildAlbum)grid_layout[0]).ImageSize; artwork_manager.ChangeCacheSize(size, e.Value); } }; ViewLayout = grid_layout; DisableAlbumGridPref = new SchemaPreference <bool> (DisableAlbumGrid, Catalog.GetString("Disable album grid"), Catalog.GetString("Disable album grid and show the classic layout instead"), ToggleAlbumGrid); ServiceManager.SourceManager.SourceRemoved += UninstallPreferences; ServiceManager.SourceManager.SourceAdded += InstallPreferences; if (ServiceManager.SourceManager.MusicLibrary != null) { InstallPreferences(); } ServiceManager.PlayerEngine.ConnectEvent(OnPlayerEvent, PlayerEvent.TrackInfoUpdated); Banshee.Metadata.MetadataService.Instance.ArtworkUpdated += OnArtworkUpdated; }
private void BuildPreferences() { conf_ns = "sync"; manually_manage = dap.CreateSchema <bool> (conf_ns, "enabled", true, Catalog.GetString("Manually manage this device"), Catalog.GetString("Manually managing your device means you can drag and drop items onto the device, and manually remove them.") ); auto_sync = dap.CreateSchema <bool> (conf_ns, "auto_sync", false, Catalog.GetString("Automatically sync the device when plugged in or when the libraries change"), Catalog.GetString("Begin synchronizing the device as soon as the device is plugged in or the libraries change.") ); dap_prefs_section = new Section("dap", Catalog.GetString("Sync Preferences"), 0); pref_sections.Add(dap_prefs_section); manually_manage_pref = dap_prefs_section.Add(manually_manage); manually_manage_pref.ShowDescription = true; manually_manage_pref.ShowLabel = false; manually_manage_pref.ValueChanged += OnManuallyManageChanged; auto_sync_pref = dap_prefs_section.Add(auto_sync); auto_sync_pref.ValueChanged += OnAutoSyncChanged; //manually_manage_pref.Changed += OnEnabledChanged; //auto_sync_pref.Changed += delegate { OnUpdated (); }; //OnEnabledChanged (null); }
public LastfmPreferences (LastfmSource source) { var service = ServiceManager.Get<PreferenceService> (); if (service == null) { return; } this.source = source; service.InstallWidgetAdapters += OnPreferencesServiceInstallWidgetAdapters; source_page = new Banshee.Preferences.SourcePage (source) { (account_section = new Section ("lastfm-account", Catalog.GetString ("Account"), 20) { (username_preference = new SchemaPreference<string> (LastfmSource.LastUserSchema, Catalog.GetString ("_Username")) { ShowLabel = false }), new VoidPreference ("lastfm-signup") }), (prefs_section = new Section ("lastfm-settings", Catalog.GetString ("Preferences"), 30)) }; scrobbler = ServiceManager.Get<Banshee.Lastfm.Audioscrobbler.AudioscrobblerService> (); if (scrobbler != null) { reporting_preference = new Preference<bool> ("enable-song-reporting", Catalog.GetString ("_Enable Song Reporting"), null, scrobbler.Enabled); reporting_preference.ValueChanged += root => scrobbler.Enabled = reporting_preference.Value; prefs_section.Add (reporting_preference); } }
public LastfmPreferences(LastfmSource source) { var service = ServiceManager.Get <PreferenceService> (); if (service == null) { return; } this.source = source; service.InstallWidgetAdapters += OnPreferencesServiceInstallWidgetAdapters; source_page = new Banshee.Preferences.SourcePage(source) { (account_section = new Section("lastfm-account", Catalog.GetString("Account"), 20) { (username_preference = new SchemaPreference <string> (LastfmSource.LastUserSchema, Catalog.GetString("_Username")) { ShowLabel = false }), new VoidPreference("lastfm-signup") }), (prefs_section = new Section("lastfm-settings", Catalog.GetString("Preferences"), 30)) }; scrobbler = ServiceManager.Get <Banshee.Lastfm.Audioscrobbler.AudioscrobblerService> (); if (scrobbler != null) { reporting_preference = new Preference <bool> ("enable-song-reporting", Catalog.GetString("_Enable Song Reporting"), null, scrobbler.Enabled); reporting_preference.ValueChanged += root => scrobbler.Enabled = reporting_preference.Value; prefs_section.Add(reporting_preference); } }
public LibraryLocationButton(LibrarySource source) { this.source = source; preference = source.PreferencesPage["library-location"]["library-location"] as SchemaPreference <string>; preference.ShowLabel = false; preference.DisplayWidget = this; string dir = preference.Value ?? source.DefaultBaseDirectory; Spacing = 5; // FileChooserButton wigs out if the directory does not exist, // so create it if it doesn't and store the fact that we did // in case it ends up not being used, we can remove it try { if (!Banshee.IO.Directory.Exists(dir)) { Banshee.IO.Directory.Create(dir); created_directory = dir; Log.DebugFormat("Created library directory: {0}", created_directory); } } catch { } chooser = new FileChooserButton(Catalog.GetString("Select library location"), FileChooserAction.SelectFolder); // Only set the LocalOnly property if false; setting it when true // causes the "Other..." entry to be hidden in older Gtk+ if (!Banshee.IO.Provider.LocalOnly) { chooser.LocalOnly = Banshee.IO.Provider.LocalOnly; } chooser.SetCurrentFolder(dir); chooser.SelectionChanged += OnChooserChanged; HBox box = new HBox(); box.Spacing = 2; box.PackStart(new Image(Stock.Undo, IconSize.Button), false, false, 0); box.PackStart(new Label(Catalog.GetString("Reset")), false, false, 0); reset = new Button() { Sensitive = dir != source.DefaultBaseDirectory, TooltipText = String.Format(Catalog.GetString("Reset location to default ({0})"), source.DefaultBaseDirectory) }; reset.Clicked += OnReset; reset.Add(box); //Button open = new Button (); //open.PackStart (new Image (Stock.Open, IconSize.Button), false, false, 0); //open.Clicked += OnOpen; PackStart(chooser, true, true, 0); PackStart(reset, false, false, 0); //PackStart (open, false, false, 0); chooser.Show(); reset.ShowAll(); }
private void BuildPreferences() { conf_ns = String.Format("{0}.{1}", sync.ConfigurationNamespace, library.ParentConfigurationId); enabled = sync.Dap.CreateSchema <bool> (conf_ns, "enabled", true, String.Format(Catalog.GetString("Sync {0}"), library.Name), ""); sync_entire_library = sync.Dap.CreateSchema <bool> (conf_ns, "sync_entire_library", true, "Whether to sync the entire library and all playlists.", ""); playlist_ids = sync.Dap.CreateSchema <string[]> (conf_ns, "playlist_ids", new string [0], "If sync_entire_library is false, this contains a list of playlist ids specifically to sync", ""); library_prefs_section = new Section(String.Format("{0} sync", library.Name), library.Name, 0); enabled_pref = library_prefs_section.Add <bool> (enabled); enabled_pref.ShowDescription = true; enabled_pref.ShowLabel = false; }
private void InstallPreferences() { PreferenceService service = ServiceManager.Get <PreferenceService> (); if (service == null) { return; } service.InstallWidgetAdapters += OnPreferencesServiceInstallWidgetAdapters; pref_page = new Banshee.Preferences.SourcePage(this); pref_section = pref_page.Add(new Section("lastfm-account", Catalog.GetString("Account"), 20)); pref_section.ShowLabel = false; user_pref = new SchemaPreference <string> (LastUserSchema, Catalog.GetString("_Username")); pref_section.Add(user_pref); pref_section.Add(new VoidPreference("lastfm-signup")); }
private void BuildPreferences() { conf_ns = "sync"; LegacyManuallyManage = dap.CreateSchema <bool> (conf_ns, "enabled", false, "", ""); auto_sync = dap.CreateSchema <bool> (conf_ns, "auto_sync", false, Catalog.GetString("Sync when first plugged in and when the libraries change"), Catalog.GetString("Begin synchronizing the device as soon as the device is plugged in or the libraries change.") ); sync_prefs = new Section("sync", Catalog.GetString("Sync Preferences"), 0); pref_sections.Add(sync_prefs); sync_prefs.Add(new VoidPreference("library-options")); auto_sync_pref = sync_prefs.Add(auto_sync); auto_sync_pref.ValueChanged += OnAutoSyncChanged; }
private void InitPlayQueue(PlayQueueSource play_queue) { if (actions == null) { play_queue.Populate = false; played_songs_number = PlayQueueSource.PlayedSongsNumberSchema.Get(); var service = ServiceManager.Get <PreferenceService> (); var section = service["source-specific"].ChildPages[play_queue.PreferencesPageId][null]; played_songs_number_pref = (SchemaPreference <int>)section[PlayQueueSource.PlayedSongsNumberSchema.Key]; played_songs_number_pref.Value = 0; actions = new MuinsheeActions(play_queue); actions.Actions.AddActionGroup(actions); ServiceManager.SourceManager.SetActiveSource(play_queue); play_queue.TrackModel.Reloaded += HandleTrackModelReloaded; BuildPrimaryLayout(); ConnectEvents(); track_view.SetModel(play_queue.TrackModel); InitialShowPresent(); } }
private void BuildPreferences() { conf_ns = "sync"; LegacyManuallyManage = dap.CreateSchema<bool> (conf_ns, "enabled", false, "", ""); auto_sync = dap.CreateSchema<bool> (conf_ns, "auto_sync", false, Catalog.GetString ("Sync when first plugged in and when the libraries change"), Catalog.GetString ("Begin synchronizing the device as soon as the device is plugged in or the libraries change.") ); sync_prefs = new Section ("sync", Catalog.GetString ("Sync Preferences"), 0); pref_sections.Add (sync_prefs); sync_prefs.Add (new VoidPreference ("library-options")); auto_sync_pref = sync_prefs.Add (auto_sync); auto_sync_pref.ValueChanged += OnAutoSyncChanged; }
private void InitPlayQueue(PlayQueueSource play_queue) { if (actions == null) { play_queue.Populate = false; played_songs_number = PlayQueueSource.PlayedSongsNumberSchema.Get (); var service = ServiceManager.Get<PreferenceService> (); var section = service["source-specific"].ChildPages[play_queue.PreferencesPageId][null]; played_songs_number_pref = (SchemaPreference<int>) section[PlayQueueSource.PlayedSongsNumberSchema.Key]; played_songs_number_pref.Value = 0; actions = new MuinsheeActions (play_queue); actions.Actions.AddActionGroup (actions); ServiceManager.SourceManager.SetActiveSource (play_queue); play_queue.TrackModel.Reloaded += HandleTrackModelReloaded; BuildPrimaryLayout (); ConnectEvents (); track_view.SetModel (play_queue.TrackModel); InitialShowPresent (); } }
internal static void AddToSection <T> (Section section, SchemaEntry <T> entry, SchemaPreferenceUpdatedHandler func) { SchemaPreference <T> pref = new SchemaPreference <T> (entry, entry.ShortDescription, entry.LongDescription, func); section.Add(pref); }