banshee r3807 - in trunk/banshee: . src/Core/Banshee.Services src/Core/Banshee.Services/Banshee.Preferences src/Core/Banshee.ThickClient/Banshee.Preferences.Gui src/Extensions/Banshee.AudioCd/Banshee.AudioCd



Author: abock
Date: Tue Apr 22 22:53:17 2008
New Revision: 3807
URL: http://svn.gnome.org/viewvc/banshee?rev=3807&view=rev

Log:
2008-04-22  Aaron Bockover  <abock gnome org>

    * src/Core/Banshee.Services/Banshee.Preferences/Page.cs: Cleaned up
    the default preferences

    * src/Core/Banshee.Services/Banshee.Preferences/PreferenceService.cs:
    Added an InstallWidgetAdapters event and a RequestWidgetAdapters method

    * src/Core/Banshee.Services/Banshee.Preferences/VoidPreference.cs:
    A wrapper to use for fake preferences that will basically be containers
    for advanced widgets bound to other preferences

    * src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/DefaultPreferenceWidgets.cs:
    A little cleanup and use VoidPreference

    * src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/PreferenceDialog.cs:
    Call RequestWidgetAdapters to notify listeners that they need to create
    and bind their widget adapters to preferences they own

    * src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/SectionBox.cs:
    Set the MnemonicWidget if the preference gets a label

    * src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdService.cs:
    Last of the preference migration - adds the import profile combo



Added:
   trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/VoidPreference.cs
Modified:
   trunk/banshee/ChangeLog
   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.Services.mdp
   trunk/banshee/src/Core/Banshee.Services/Makefile.am
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/DefaultPreferenceWidgets.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/PreferenceDialog.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/SectionBox.cs
   trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdService.cs

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	Tue Apr 22 22:53:17 2008
@@ -51,14 +51,28 @@
         {
             Page general = service.Add (new Page ("general", Catalog.GetString ("General"), 0));
             
-            Section music_library = general.Add (new Section ("music-library", Catalog.GetString ("Music _Library"), 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")));
             
-            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")));
+            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.")));
+            
+            // 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")));
         }
     }
 }

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	Tue Apr 22 22:53:17 2008
@@ -34,11 +34,25 @@
 {
     public class PreferenceService : Collection<Page>, IRequiredService
     {
+        private event EventHandler install_widget_adapters;
+        public event EventHandler InstallWidgetAdapters {
+            add { install_widget_adapters += value; }
+            remove { install_widget_adapters -= value; }
+        }
+    
         public PreferenceService ()
         {
             Page.SetupDefaults (this);
         }
         
+        public void RequestWidgetAdapters ()
+        {
+            EventHandler handler = install_widget_adapters;
+            if (handler != null) {
+                handler (this, EventArgs.Empty);
+            }
+        }
+        
         string IService.ServiceName {
             get { return "PreferenceService"; }
         }

Added: trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/VoidPreference.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/VoidPreference.cs	Tue Apr 22 22:53:17 2008
@@ -0,0 +1,43 @@
+//
+// VoidPreference.cs
+//
+// Author:
+//   Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 2008 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;
+
+namespace Banshee.Preferences
+{
+    public class VoidPreference : Preference<object>
+    {
+        public VoidPreference (string id) : base (id, null)
+        {
+        }
+        
+        public VoidPreference (string id, string name) : base (id, name)
+        {
+        }
+    }
+}

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Services.mdp
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Services.mdp	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Services.mdp	Tue Apr 22 22:53:17 2008
@@ -157,6 +157,7 @@
     <File name="Banshee.Preferences/Page.cs" subtype="Code" buildaction="Compile" />
     <File name="Banshee.Preferences/SchemaPreference.cs" subtype="Code" buildaction="Compile" />
     <File name="Banshee.Library/LibraryLocationPreference.cs" subtype="Code" buildaction="Compile" />
+    <File name="Banshee.Preferences/VoidPreference.cs" subtype="Code" buildaction="Compile" />
   </Contents>
   <References>
     <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

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	Tue Apr 22 22:53:17 2008
@@ -106,6 +106,7 @@
 	Banshee.Preferences/Root.cs \
 	Banshee.Preferences/SchemaPreference.cs \
 	Banshee.Preferences/Section.cs \
+	Banshee.Preferences/VoidPreference.cs \
 	Banshee.Query/AbstractPlaylistQueryValue.cs \
 	Banshee.Query/BansheeQuery.cs \
 	Banshee.Query/NaturalIntegerQueryValue.cs \

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	Tue Apr 22 22:53:17 2008
@@ -44,16 +44,18 @@
     {
         public static void Load (PreferenceService service)
         {
-            PreferenceBase library_location = service["general"]["music-library"]["library-location"];
+            Page general = service["general"];
+        
+            PreferenceBase library_location = general["music-library"]["library-location"];
             library_location.DisplayWidget = new LibraryLocationButton (library_location);
             
-            PreferenceBase folder_pattern = service["general"]["file-system"]["folder_pattern"];
+            PreferenceBase folder_pattern = general["file-system"]["folder_pattern"];
             folder_pattern.DisplayWidget = new PatternComboBox (folder_pattern, FileNamePattern.SuggestedFolders);
             
-            PreferenceBase file_pattern = service["general"]["file-system"]["file_pattern"];
+            PreferenceBase file_pattern = general["file-system"]["file_pattern"];
             file_pattern.DisplayWidget = new PatternComboBox (file_pattern, FileNamePattern.SuggestedFiles);
             
-            PreferenceBase pattern_display = service["general"]["file-system"].FindOrAdd (new Preference<object> ("file_folder_pattern", null));
+            PreferenceBase pattern_display = general["file-system"].FindOrAdd (new VoidPreference ("file_folder_pattern"));
             pattern_display.DisplayWidget = new PatternDisplay (folder_pattern.DisplayWidget, file_pattern.DisplayWidget);
         }
 

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	Tue Apr 22 22:53:17 2008
@@ -59,6 +59,7 @@
             }
             
             DefaultPreferenceWidgets.Load (service);
+            service.RequestWidgetAdapters ();
             
             BuildDialog ();
             LoadPages ();

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/SectionBox.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/SectionBox.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/SectionBox.cs	Tue Apr 22 22:53:17 2008
@@ -58,7 +58,7 @@
             uint start_row = NRows;
             uint start_col = 0;
             
-            Widget label = null;
+            Label label = null;
             
             if (!(widget is CheckButton) && preference.ShowLabel) {
                 label = AttachLabel (preference.Name, start_row);
@@ -70,6 +70,10 @@
                 AttachOptions.Expand | AttachOptions.Fill, 
                 AttachOptions.Expand | AttachOptions.Fill, 0, 0);
                 
+            if (label != null) {
+                label.MnemonicWidget = widget;
+            }
+                
             if (!String.IsNullOrEmpty (preference.Description)) {
                 if (tp_host == null) {
                      tp_host = TooltipSetter.CreateHost ();

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	Tue Apr 22 22:53:17 2008
@@ -141,7 +141,14 @@
                 return;
             }
             
-            pref_section = service["general"].Add (new Section ("audio-cd", Catalog.GetString ("Audio CD Importing"), 20));
+            service.InstallWidgetAdapters += OnPreferencesServiceInstallWidgetAdapters;
+            
+            pref_section = service["general"].Add (new Section ("audio-cd", 
+                Catalog.GetString ("Audio CD Importing"), 20));
+                
+            pref_section.Add (new VoidPreference ("import-profile",  Catalog.GetString ("O_utput format")));
+            pref_section.Add (new VoidPreference ("import-profile-desc"));
+            
             pref_section.Add (new SchemaPreference<bool> (ErrorCorrection, 
                 Catalog.GetString ("Use error correction when importing"),
                 Catalog.GetString ("Error correction tries to work around problem areas on a disc, such " +
@@ -155,10 +162,27 @@
                 return;
             }
             
+            service.InstallWidgetAdapters -= OnPreferencesServiceInstallWidgetAdapters;
+            
             service["general"].Remove (pref_section);
             pref_section = null;
         }
         
+        private void OnPreferencesServiceInstallWidgetAdapters (object o, EventArgs args)
+        {
+            if (pref_section == null) {
+                return;
+            }
+            
+            Gtk.HBox description_box = new Gtk.HBox ();
+            Banshee.MediaProfiles.Gui.ProfileComboBoxConfigurable chooser 
+                = new Banshee.MediaProfiles.Gui.ProfileComboBoxConfigurable (ServiceManager.MediaProfileManager, 
+                    "cd-importing", description_box);
+            
+            pref_section["import-profile"].DisplayWidget = chooser;
+            pref_section["import-profile-desc"].DisplayWidget = description_box;
+        }
+        
         public static readonly SchemaEntry<bool> ErrorCorrection = new SchemaEntry<bool> (
             "import", "audio_cd_error_correction", 
             false,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]