banshee r5111 - in trunk/banshee: . src/Core/Banshee.Services src/Core/Banshee.Services/Banshee.Library src/Core/Banshee.Services/Banshee.Preferences src/Core/Banshee.Services/Banshee.Sources src/Core/Banshee.ThickClient src/Core/Banshee.ThickClient/Banshee.Gui src/Core/Banshee.ThickClient/Banshee.Preferences.Gui src/Core/Banshee.ThickClient/Resources src/Extensions/Banshee.AudioCd/Banshee.AudioCd src/Extensions/Banshee.AudioCd/Resources src/Extensions/Banshee.Bpm/Banshee.Bpm
- From: gburt svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r5111 - in trunk/banshee: . src/Core/Banshee.Services src/Core/Banshee.Services/Banshee.Library src/Core/Banshee.Services/Banshee.Preferences src/Core/Banshee.Services/Banshee.Sources src/Core/Banshee.ThickClient src/Core/Banshee.ThickClient/Banshee.Gui src/Core/Banshee.ThickClient/Banshee.Preferences.Gui src/Core/Banshee.ThickClient/Resources src/Extensions/Banshee.AudioCd/Banshee.AudioCd src/Extensions/Banshee.AudioCd/Resources src/Extensions/Banshee.Bpm/Banshee.Bpm
- Date: Thu, 5 Mar 2009 20:37:25 +0000 (UTC)
Author: gburt
Date: Thu Mar 5 20:37:25 2009
New Revision: 5111
URL: http://svn.gnome.org/viewvc/banshee?rev=5111&view=rev
Log:
2009-03-05 Gabriel Burt <gabriel burt gmail com>
* src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/DefaultPreferenceWidgets.cs:
* src/Core/Banshee.Services/Banshee.Library/MusicLibrarySource.cs: Move
the folder selector into its own section, add a new misc section, and
override the label for the new SourcePreferences action. Add the
music-library prefs that were defined in PreferenceService.
* src/Core/Banshee.Services/Banshee.Preferences/PreferenceService.cs: Name
the file-related prefs section File Policies and show the label. Add a
source-specific tab and remove music-library prefs. Move Banshee-specific
preferences from Page to the PrefrenceService. Add ChildPages and
IconName properties to Page class, allowing Pages to have child Pages.
* src/Core/Banshee.Services/Makefile.am:
* src/Core/Banshee.Services/Banshee.Preferences/SourcePage.cs: New
convenience subclass of Page that adds a source-specific page.
* src/Core/Banshee.Services/Banshee.Sources/Source.cs: Add virtual
PreferencePageId property that if !null will mean the
SourcePreferencesAction will appear in the source's context menu, and will
open the Preferences dialog to the relevant souce-specific section. Add
PreferencesPage property that creates a source-specific prefs page for this
source, and Dispose it when the source is Removed.
* src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml:
* src/Core/Banshee.ThickClient/Banshee.Gui/SourceActions.cs: Add new
SourcePreferences action as described elsewhere.
* src/Core/Banshee.ThickClient/Makefile.am:
* src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/PageComboBox.cs:
New ComboBox subclass to switch a Notebook between Pages, with the ability
to set the active source-specific page via its Id.
* src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdService.cs: Pass
the appropriate Order to the prefs ctor. Add the new Audio CDs page as a
source-specific page so it appears in the Source Specific preferences tab,
instead of its own tab.
* src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdSource.cs:
Override PreferencesPageId and the SourcePreference label.
* src/Extensions/Banshee.AudioCd/Resources/GlobalUI.xml: Show the
SourcePreferencesAction in the audio cd context menu.
* src/Extensions/Banshee.Bpm/Banshee.Bpm/BpmService.cs: Add the BPM pref
to the Music source-specific section instead of the Generic tab.
* src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/NotebookPage.cs: If
a page has ChildPages, create a PageComboBox and Notebook to
contain/switch between them.
Added:
trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/SourcePage.cs
- copied, changed from r5110, /trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/PreferenceService.cs
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/PageComboBox.cs
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Core/Banshee.Services/Banshee.Library/MusicLibrarySource.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/Page.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/PreferenceService.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/Source.cs
trunk/banshee/src/Core/Banshee.Services/Makefile.am
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/SourceActions.cs
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/DefaultPreferenceWidgets.cs
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/NotebookPage.cs
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/PreferenceDialog.cs
trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am
trunk/banshee/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml
trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdService.cs
trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdSource.cs
trunk/banshee/src/Extensions/Banshee.AudioCd/Resources/GlobalUI.xml
trunk/banshee/src/Extensions/Banshee.Bpm/Banshee.Bpm/BpmService.cs
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Library/MusicLibrarySource.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Library/MusicLibrarySource.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Library/MusicLibrarySource.cs Thu Mar 5 20:37:25 2009
@@ -34,6 +34,8 @@
using Banshee.Collection;
using Banshee.SmartPlaylist;
+using Banshee.Preferences;
+using Banshee.Configuration.Schema;
namespace Banshee.Library
{
@@ -44,6 +46,27 @@
MediaTypes = TrackMediaAttributes.Music | TrackMediaAttributes.AudioStream;
NotMediaTypes = TrackMediaAttributes.Podcast | TrackMediaAttributes.VideoStream | TrackMediaAttributes.AudioBook;
Properties.SetStringList ("Icon.Name", "audio-x-generic", "source-library");
+ Properties.SetString ("SourcePreferencesActionLabel", Catalog.GetString ("Music Library Preferences"));
+
+ Section library_section = PreferencesPage.Add (new Section ("library-location",
+ Catalog.GetString ("Music Library Folder"), 2));
+
+ library_section.Add (new LibraryLocationPreference ());
+
+ Section file_system = PreferencesPage.Add (new Section ("file-system",
+ Catalog.GetString ("File System Organization"), 5));
+
+ file_system.Add (new SchemaPreference<string> (LibrarySchema.FolderPattern,
+ Catalog.GetString ("Folder hie_rarchy")));
+
+ file_system.Add (new SchemaPreference<string> (LibrarySchema.FilePattern,
+ Catalog.GetString ("File _name")));
+
+ PreferencesPage.Add (new Section ("misc", Catalog.GetString ("Miscellaneous"), 10));
+ }
+
+ public override string PreferencesPageId {
+ get { return UniqueId; }
}
public override IEnumerable<SmartPlaylistDefinition> DefaultSmartPlaylists {
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/Page.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/Page.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/Page.cs Thu Mar 5 20:37:25 2009
@@ -27,60 +27,32 @@
//
using System;
-using Mono.Unix;
-
-using Banshee.Library;
-using Banshee.Configuration.Schema;
namespace Banshee.Preferences
{
public class Page : Collection<Section>
{
+ private Collection<Page> child_pages;
+ public Collection<Page> ChildPages {
+ get { return child_pages; }
+ }
+
+ private string icon_name;
+ public string IconName {
+ get { return icon_name; }
+ set { icon_name = value; }
+ }
+
public Page ()
{
+ child_pages = new Collection<Page> ();
}
- public Page (string id, string name, int order)
+ public Page (string id, string name, int order) : this ()
{
Id = id;
Name = name;
Order = order;
}
-
- internal static void SetupDefaults (PreferenceService service)
- {
- Page general = service.Add (new Page ("general", Catalog.GetString ("General"), 0));
-
- // Music Library Prefs
- Section music_library = general.Add (new Section ("music-library",
- Catalog.GetString ("Music Library"), 0));
-
- music_library.Add (new LibraryLocationPreference ());
-
- music_library.Add (new SchemaPreference<bool> (LibrarySchema.CopyOnImport,
- Catalog.GetString ("Co_py files to media folders when importing")));
-
- music_library.Add (new SchemaPreference<bool> (LibrarySchema.WriteMetadata,
- Catalog.GetString ("Write _metadata to files"),
- Catalog.GetString ("Enable this option to save tags and other metadata inside supported audio files.")));
-
- music_library.Add (new SchemaPreference<bool> (LibrarySchema.MoveOnInfoSave,
- Catalog.GetString ("_Update file and folder names"),
- Catalog.GetString ("Enabling this option ensures that files and folders are renamed according to the metadata.")));
-
- // File System Organization Prefs
- Section file_system = general.Add (new Section ("file-system",
- Catalog.GetString ("File System Organization"), 10));
-
- file_system.Add (new SchemaPreference<string> (LibrarySchema.FolderPattern,
- Catalog.GetString ("Folder hie_rarchy")));
-
- file_system.Add (new SchemaPreference<string> (LibrarySchema.FilePattern,
- Catalog.GetString ("File _name")));
-
- general.Add (new Section ("misc", Catalog.GetString ("Miscellaneous"), 20));
-
- service.Add (new Page ("extensions", Catalog.GetString ("Extensions"), 10));
- }
}
}
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/PreferenceService.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/PreferenceService.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/PreferenceService.cs Thu Mar 5 20:37:25 2009
@@ -27,8 +27,11 @@
//
using System;
+using Mono.Unix;
using Banshee.ServiceStack;
+using Banshee.Library;
+using Banshee.Configuration.Schema;
namespace Banshee.Preferences
{
@@ -42,7 +45,27 @@
public PreferenceService ()
{
- Page.SetupDefaults (this);
+ // Pages (tabs)
+ Page general = Add (new Page ("general", Catalog.GetString ("General"), 0));
+ Add (new Page ("source-specific", Catalog.GetString ("Source Specific"), 1));
+ Add (new Page ("extensions", Catalog.GetString ("Extensions"), 10));
+
+ // General policies
+ Section policies = general.Add (new Section ("policies", Catalog.GetString ("File Policies"), 0));
+
+ policies.Add (new SchemaPreference<bool> (LibrarySchema.CopyOnImport,
+ Catalog.GetString ("Co_py files to media folders when importing")));
+
+ policies.Add (new SchemaPreference<bool> (LibrarySchema.WriteMetadata,
+ Catalog.GetString ("Write _metadata to files"),
+ Catalog.GetString ("Enable this option to save tags and other metadata inside supported audio files.")));
+
+ policies.Add (new SchemaPreference<bool> (LibrarySchema.MoveOnInfoSave,
+ Catalog.GetString ("_Update file and folder names"),
+ Catalog.GetString ("Enabling this option ensures that files and folders are renamed according to the metadata.")));
+
+ // Misc section
+ general.Add (new Section ("misc", Catalog.GetString ("Miscellaneous"), 20));
}
public void RequestWidgetAdapters ()
Copied: trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/SourcePage.cs (from r5110, /trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/PreferenceService.cs)
==============================================================================
--- /trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/PreferenceService.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/SourcePage.cs Thu Mar 5 20:37:25 2009
@@ -1,10 +1,10 @@
//
-// PreferenceService.cs
+// SourcePage.cs
//
// Author:
-// Aaron Bockover <abockover novell com>
+// Gabriel Burt <gburt novell com>
//
-// Copyright (C) 2008 Novell, Inc.
+// Copyright (C) 2009 Novell, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
@@ -29,32 +29,30 @@
using System;
using Banshee.ServiceStack;
+using Banshee.Sources;
namespace Banshee.Preferences
{
- public class PreferenceService : Collection<Page>, IRequiredService
+ public class SourcePage : Page, IDisposable
{
- private event EventHandler install_widget_adapters;
- public event EventHandler InstallWidgetAdapters {
- add { install_widget_adapters += value; }
- remove { install_widget_adapters -= value; }
- }
-
- public PreferenceService ()
+ public SourcePage (Source source) : this (source.UniqueId, source.Name, null, source.Order)
{
- Page.SetupDefaults (this);
+ if (source.Properties.GetType ("Icon.Name") == typeof(string)) {
+ IconName = source.Properties.Get<string> ("Icon.Name");
+ } else if (source.Properties.GetType ("Icon.Name") == typeof(string[])) {
+ IconName = source.Properties.Get<string[]> ("Icon.Name")[0];
+ }
}
-
- public void RequestWidgetAdapters ()
+
+ public SourcePage (string uniqueId, string name, string iconName, int order) : base (uniqueId, name, order)
{
- EventHandler handler = install_widget_adapters;
- if (handler != null) {
- handler (this, EventArgs.Empty);
- }
+ IconName = iconName;
+ ServiceManager.Get<Banshee.Preferences.PreferenceService> ()["source-specific"].ChildPages.Add (this);
}
-
- string IService.ServiceName {
- get { return "PreferenceService"; }
+
+ public void Dispose ()
+ {
+ ServiceManager.Get<Banshee.Preferences.PreferenceService> ()["source-specific"].ChildPages.Remove (this);
}
}
}
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/Source.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/Source.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/Source.cs Thu Mar 5 20:37:25 2009
@@ -133,6 +133,10 @@
protected void Remove ()
{
+ if (prefs_page != null) {
+ prefs_page.Dispose ();
+ }
+
if (ServiceManager.SourceManager.ContainsSource (this)) {
if (this.Parent != null) {
this.Parent.RemoveChildSource (this);
@@ -718,7 +722,18 @@
{
return new SchemaEntry<T> (String.Format ("sources.{0}.{1}", ParentConfigurationId, ns), name, defaultValue, shortDescription, longDescription);
}
-
+
+ public virtual string PreferencesPageId {
+ get { return null; }
+ }
+
+ private Banshee.Preferences.SourcePage prefs_page;
+ public Banshee.Preferences.Page PreferencesPage {
+ get {
+ return prefs_page ?? (prefs_page = new Banshee.Preferences.SourcePage (this));
+ }
+ }
+
public void CycleStatusFormat ()
{
int new_status_format = CurrentStatusFormat + 1;
Modified: trunk/banshee/src/Core/Banshee.Services/Makefile.am
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Makefile.am (original)
+++ trunk/banshee/src/Core/Banshee.Services/Makefile.am Thu Mar 5 20:37:25 2009
@@ -142,6 +142,7 @@
Banshee.Preferences/Root.cs \
Banshee.Preferences/SchemaPreference.cs \
Banshee.Preferences/Section.cs \
+ Banshee.Preferences/SourcePage.cs \
Banshee.Preferences/VoidPreference.cs \
Banshee.Query/AbstractPlaylistQueryValue.cs \
Banshee.Query/BansheeQuery.cs \
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/SourceActions.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/SourceActions.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/SourceActions.cs Thu Mar 5 20:37:25 2009
@@ -103,7 +103,11 @@
new ActionEntry ("SortChildrenAction", Stock.SortDescending,
Catalog.GetString ("Sort Children by"), null, null,
- OnSortChildrenMenu)
+ OnSortChildrenMenu),
+
+ new ActionEntry ("SourcePreferencesAction", null, String.Empty,
+ Catalog.GetString ("Edit preferences related to this source"), null, OnSourcePreferences),
+
});
this["NewSmartPlaylistAction"].ShortLabel = Catalog.GetString ("New _Smart Playlist");
@@ -111,6 +115,7 @@
this["UnmapSourceAction"].IconName = Stock.Delete;
this["SourcePropertiesAction"].IconName = Stock.Properties;
this["SortChildrenAction"].HideIfEmpty = false;
+ this["SourcePreferencesAction"].IconName = Stock.Preferences;
AddImportant (
new ActionEntry ("RefreshSmartPlaylistAction", Stock.Refresh,
@@ -329,6 +334,17 @@
}
}
+ private void OnSourcePreferences (object o, EventArgs args)
+ {
+ try {
+ Banshee.Preferences.Gui.PreferenceDialog dialog = new Banshee.Preferences.Gui.PreferenceDialog ();
+ dialog.ShowSourcePageId (ActionSource.PreferencesPageId);
+ dialog.Run ();
+ dialog.Destroy ();
+ } catch (ApplicationException) {
+ }
+ }
+
#endregion
#region Utility Methods
@@ -354,6 +370,7 @@
UpdateAction ("ImportSourceAction", import_source != null, import_source != null && import_source.CanImport, source);
UpdateAction ("ExportPlaylistAction", source is AbstractPlaylistSource, true, source);
UpdateAction ("SourcePropertiesAction", source.HasProperties, true, source);
+ UpdateAction ("SourcePreferencesAction", source.PreferencesPageId != null, true, source);
UpdateAction ("RefreshSmartPlaylistAction", smart_playlist != null && smart_playlist.CanRefresh, true, source);
bool playlists_writable = primary_source != null && primary_source.SupportsPlaylists && !primary_source.PlaylistsReadOnly;
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/DefaultPreferenceWidgets.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/DefaultPreferenceWidgets.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/DefaultPreferenceWidgets.cs Thu Mar 5 20:37:25 2009
@@ -30,13 +30,16 @@
using Mono.Unix;
using Gtk;
+
+using Hyena;
+using Hyena.Widgets;
+
using Banshee.Base;
using Banshee.Library;
using Banshee.Preferences;
using Banshee.Collection;
+using Banshee.ServiceStack;
-using Hyena;
-using Hyena.Widgets;
using Banshee.Widgets;
using Banshee.Gui.Widgets;
@@ -46,18 +49,18 @@
{
public static void Load (PreferenceService service)
{
- Page general = service["general"];
+ Page music = ServiceManager.SourceManager.MusicLibrary.PreferencesPage;
- PreferenceBase library_location = general["music-library"]["library-location"];
+ PreferenceBase library_location = music["library-location"]["library-location"];
library_location.DisplayWidget = new LibraryLocationButton (library_location);
- PreferenceBase folder_pattern = general["file-system"]["folder_pattern"];
+ PreferenceBase folder_pattern = music["file-system"]["folder_pattern"];
folder_pattern.DisplayWidget = new PatternComboBox (folder_pattern, FileNamePattern.SuggestedFolders);
- PreferenceBase file_pattern = general["file-system"]["file_pattern"];
+ PreferenceBase file_pattern = music["file-system"]["file_pattern"];
file_pattern.DisplayWidget = new PatternComboBox (file_pattern, FileNamePattern.SuggestedFiles);
- PreferenceBase pattern_display = general["file-system"].FindOrAdd (new VoidPreference ("file_folder_pattern"));
+ PreferenceBase pattern_display = music["file-system"].FindOrAdd (new VoidPreference ("file_folder_pattern"));
pattern_display.DisplayWidget = new PatternDisplay (folder_pattern.DisplayWidget, file_pattern.DisplayWidget);
// Set up the extensions tab UI
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/NotebookPage.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/NotebookPage.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/NotebookPage.cs Thu Mar 5 20:37:25 2009
@@ -63,6 +63,30 @@
foreach (Section section in page) {
AddSection (section);
}
+
+ if (page.ChildPages.Count > 0) {
+ Notebook notebook = new Notebook ();
+ notebook.ShowBorder = false;
+ notebook.ShowTabs = false;
+ notebook.Show ();
+
+ PageComboBox page_combo = new PageComboBox (page.ChildPages, notebook);
+ PackStart (page_combo, false, false, 0);
+
+ HSeparator sep = new HSeparator ();
+ sep.Show ();
+ PackStart (sep, false, false, 0);
+
+ foreach (Page child_page in page.ChildPages) {
+ NotebookPage page_ui = new NotebookPage (child_page);
+ page_ui.BorderWidth = 0;
+ page_ui.Spacing = 0;
+ page_ui.Show ();
+ notebook.AppendPage (page_ui, null);
+ }
+
+ PackStart (notebook, true, true, 0);
+ }
}
}
Added: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/PageComboBox.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/PageComboBox.cs Thu Mar 5 20:37:25 2009
@@ -0,0 +1,84 @@
+// PageComboBox.cs
+//
+// Authors:
+// Gabriel Burt <gburt novell com>
+//
+// Copyright (C) 2009 Novell, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Generic;
+using Gtk;
+
+using Banshee.ServiceStack;
+
+namespace Banshee.Preferences.Gui
+{
+ public class PageComboBox : ComboBox
+ {
+ private ListStore model;
+ private Notebook notebook;
+ private IList<Page> pages;
+
+ public PageComboBox (IList<Page> pages, Notebook notebook)
+ {
+ this.pages = pages;
+ this.notebook = notebook;
+
+ // icon, name, order, Page object itself
+ model = new ListStore (typeof(string), typeof(string), typeof(int), typeof(Page));
+ model.SetSortColumnId (2, SortType.Ascending);
+ Model = model;
+
+ CellRendererPixbuf icon = new CellRendererPixbuf ();
+ PackStart (icon, false);
+ AddAttribute (icon, "icon-name", 0);
+
+ CellRendererText name = new CellRendererText ();
+ PackStart (name, true);
+ AddAttribute (name, "text", 1);
+
+ foreach (Page page in pages) {
+ model.AppendValues (page.IconName ?? "image-missing", page.Name, page.Order, page);
+ }
+
+ Active = 0;
+ Show ();
+ }
+
+ public string ActivePageId {
+ set {
+ for (int i = 0; i < pages.Count; i++) {
+ if (pages[i].Id == value) {
+ Active = i;
+ break;
+ }
+ }
+ }
+ }
+
+ protected override void OnChanged ()
+ {
+ notebook.CurrentPage = Active;
+ }
+ }
+}
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/PreferenceDialog.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/PreferenceDialog.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/PreferenceDialog.cs Thu Mar 5 20:37:25 2009
@@ -64,6 +64,23 @@
BuildDialog ();
LoadPages ();
}
+
+ public void ShowSourcePageId (string id)
+ {
+ if (pages.ContainsKey ("source-specific")) {
+ NotebookPage notebook_page = pages["source-specific"];
+ notebook.CurrentPage = notebook.PageNum (notebook_page);
+
+ PageComboBox page_combo;
+ foreach (Widget child in notebook_page.Children) {
+ page_combo = child as PageComboBox;
+ if (page_combo != null) {
+ page_combo.ActivePageId = id;
+ break;
+ }
+ }
+ }
+ }
private void BuildDialog ()
{
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am Thu Mar 5 20:37:25 2009
@@ -125,6 +125,7 @@
Banshee.Preferences.Gui/DefaultPreferenceWidgets.cs \
Banshee.Preferences.Gui/DescriptionLabel.cs \
Banshee.Preferences.Gui/NotebookPage.cs \
+ Banshee.Preferences.Gui/PageComboBox.cs \
Banshee.Preferences.Gui/PreferenceDialog.cs \
Banshee.Preferences.Gui/SectionBox.cs \
Banshee.Preferences.Gui/WidgetFactory.cs \
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml Thu Mar 5 20:37:25 2009
@@ -120,6 +120,7 @@
<placeholder name="AboveImportSource"/>
<menuitem name="ImportSource" action="ImportSourceAction"/>
<menuitem name="RenameSource" action="RenameSourceAction"/>
+ <menuitem name="SourcePreferences" action="SourcePreferencesAction"/>
<menuitem name="UnmapSource" action="UnmapSourceAction"/>
<separator/>
<menuitem name="SourceProperties" action="SourcePropertiesAction"/>
@@ -135,9 +136,11 @@
<menuitem name="RenameSource" action="RenameSourceAction"/>
<menuitem name="RefreshSmartPlaylist" action="RefreshSmartPlaylistAction"/>
<menuitem name="ExportPlaylist" action="ExportPlaylistAction"/>
+ <menuitem name="SourcePreferences" action="SourcePreferencesAction"/>
<menuitem name="UnmapSource" action="UnmapSourceAction"/>
<separator/>
<menuitem name="SourceProperties" action="SourcePropertiesAction"/>
+ <menuitem name="SourcePreferences" action="SourcePreferencesAction"/>
</popup>
<popup name="TrackContextMenu" action="TrackContextMenuAction">
Modified: trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdService.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdService.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdService.cs Thu Mar 5 20:37:25 2009
@@ -44,7 +44,7 @@
{
private Dictionary<string, AudioCdSource> sources;
private List<DeviceCommand> unhandled_device_commands;
- private Page pref_page;
+ private SourcePage pref_page;
private Section pref_section;
private uint global_interface_id;
@@ -89,7 +89,7 @@
sources = null;
DisposeActions ();
- }
+ }
}
private void MapCdromDevice (ICdromDevice device)
@@ -229,11 +229,10 @@
service.InstallWidgetAdapters += OnPreferencesServiceInstallWidgetAdapters;
- pref_page = new Page ("audio-cd", Catalog.GetString ("Audio CD"), 3);
- service.Add (pref_page);
+ pref_page = new Banshee.Preferences.SourcePage ("audio-cd", Catalog.GetString ("Audio CDs"), "media-cdrom", 400);
- pref_section = pref_page.Add (new Section ("audio-cd",
- Catalog.GetString ("Audio CD Importing"), 20));
+ pref_section = pref_page.Add (new Section ("audio-cd", Catalog.GetString ("Audio CD Importing"), 20));
+ pref_section.ShowLabel = false;
pref_section.Add (new VoidPreference ("import-profile", Catalog.GetString ("_Import format")));
pref_section.Add (new VoidPreference ("import-profile-desc"));
@@ -262,7 +261,7 @@
service.InstallWidgetAdapters -= OnPreferencesServiceInstallWidgetAdapters;
- service.Remove (pref_page);
+ pref_page.Dispose ();
pref_page = null;
pref_section = null;
}
@@ -328,7 +327,7 @@
Catalog.GetString ("Duplicate this audio CD"),
OnDuplicateDisc)
);
-
+
global_interface_id = uia_service.UIManager.AddUiFromResource ("GlobalUI.xml");
}
@@ -343,7 +342,7 @@
uia_service.GlobalActions.Remove ("DuplicateDiscAction");
uia_service.UIManager.RemoveUi (global_interface_id);
}
-
+
private void OnImportDisc (object o, EventArgs args)
{
ImportOrDuplicateDisc (true);
Modified: trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdSource.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdSource.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdSource.cs Thu Mar 5 20:37:25 2009
@@ -265,6 +265,10 @@
get { return disc_model.Count; }
}
+ public override string PreferencesPageId {
+ get { return "audio-cd"; }
+ }
+
public override bool HasEditableTrackProperties {
get { return true; }
}
@@ -399,6 +403,7 @@
private void SetupGui ()
{
Properties.SetStringList ("Icon.Name", "media-cdrom", "gnome-dev-cdrom-audio", "source-cd-audio");
+ Properties.SetString ("SourcePreferencesActionLabel", Catalog.GetString ("Audio CD Preferences"));
Properties.SetString ("UnmapSourceActionLabel", Catalog.GetString ("Eject Disc"));
Properties.SetString ("UnmapSourceActionIconName", "media-eject");
Properties.SetString ("ActiveSourceUIResource", "ActiveSourceUI.xml");
Modified: trunk/banshee/src/Extensions/Banshee.AudioCd/Resources/GlobalUI.xml
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.AudioCd/Resources/GlobalUI.xml (original)
+++ trunk/banshee/src/Extensions/Banshee.AudioCd/Resources/GlobalUI.xml Thu Mar 5 20:37:25 2009
@@ -2,6 +2,7 @@
<popup name="AudioCdContextMenu">
<menuitem name="RipDisc" action="RipDiscAction"/>
<menuitem name="DuplicateDisc" action="DuplicateDiscAction"/>
+ <menuitem name="SourcePreferences" action="SourcePreferencesAction"/>
<separator/>
<menuitem name="UnmapSource" action="UnmapSourceAction"/>
</popup>
Modified: trunk/banshee/src/Extensions/Banshee.Bpm/Banshee.Bpm/BpmService.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Bpm/Banshee.Bpm/BpmService.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.Bpm/Banshee.Bpm/BpmService.cs Thu Mar 5 20:37:25 2009
@@ -144,22 +144,17 @@
return;
}
- enabled_pref = service["general"]["misc"].Add (new SchemaPreference<bool> (EnabledSchema,
- Catalog.GetString ("_Automatically detect BPM for all songs"),
- Catalog.GetString ("Detect BPM for all songs that don't already have a value set"),
- delegate { Enabled = EnabledSchema.Get (); }
- ));
+ enabled_pref = ServiceManager.SourceManager.MusicLibrary.PreferencesPage["misc"].Add (
+ new SchemaPreference<bool> (EnabledSchema,
+ Catalog.GetString ("_Automatically detect BPM for all songs"),
+ Catalog.GetString ("Detect BPM for all songs that don't already have a value set"),
+ delegate { Enabled = EnabledSchema.Get (); })
+ );
}
private void UninstallPreferences ()
{
- PreferenceService service = ServiceManager.Get<PreferenceService> ();
- if (service == null) {
- return;
- }
-
- service["general"]["misc"].Remove (enabled_pref);
- enabled_pref = null;
+ ServiceManager.SourceManager.MusicLibrary.PreferencesPage["misc"].Remove (enabled_pref);
}
#endregion
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]