[banshee] Fixup: allow solver's preferences (bgo#733930)



commit e0591ded4566b223849f95391eeb7ffc9c36f77f
Author: Marcin Kolny <marcin kolny gmail com>
Date:   Tue Jul 29 19:39:14 2014 +0200

    Fixup: allow solver's preferences (bgo#733930)

 .../Banshee.Fixup/Banshee.Fixup/FixSource.cs       |   19 +++++++++++++++++++
 .../Banshee.Fixup/Banshee.Fixup/Solver.cs          |    4 ++++
 2 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/src/Extensions/Banshee.Fixup/Banshee.Fixup/FixSource.cs 
b/src/Extensions/Banshee.Fixup/Banshee.Fixup/FixSource.cs
index 25ed3bf..c7c0352 100644
--- a/src/Extensions/Banshee.Fixup/Banshee.Fixup/FixSource.cs
+++ b/src/Extensions/Banshee.Fixup/Banshee.Fixup/FixSource.cs
@@ -38,12 +38,15 @@ using Hyena.Data.Sqlite;
 using Banshee.ServiceStack;
 using Banshee.Gui;
 using Banshee.Sources;
+using Banshee.Preferences;
 
 namespace Banshee.Fixup
 {
     public class FixSource : Source, IUnmapableSource
     {
         ProblemModel problem_model = new ProblemModel ();
+        private SourcePage page = null;
+        private HashSet<Section> sections = new HashSet<Section> ();
 
         public FixSource () : base (Catalog.GetString ("Metadata Fixer"), Catalog.GetString ("Metadata 
Fixer"), -1)
         {
@@ -55,8 +58,19 @@ namespace Banshee.Fixup
 
             var combo = new Banshee.Widgets.DictionaryComboBox<Solver> ();
             foreach (var solver in problem_model.Solvers) {
+                if (solver.PreferencesSection != null) {
+                    sections.Add (solver.PreferencesSection);
+                }
                 combo.Add (solver.Name, solver);
             }
+
+            if (sections.Count > 0) {
+                page = new SourcePage (this);
+                foreach (var section in sections) {
+                    page.Add (section);
+                }
+            }
+
             combo.Changed += (o, a) => {
                 problem_model.Solver = combo.ActiveValue;
                 SetStatus (problem_model.Solver.Description, false, false, "gtk-info");
@@ -98,7 +112,12 @@ namespace Banshee.Fixup
             Parent.RemoveChildSource (this);
             Properties.Get<Banshee.Sources.Gui.ISourceContents> ("Nereid.SourceContents").Widget.Destroy ();
             problem_model.Dispose ();
+            page.Dispose ();
             return true;
         }
+
+        public override string PreferencesPageId {
+            get { return page == null ? String.Empty : page.Id; }
+        }
     }
 }
diff --git a/src/Extensions/Banshee.Fixup/Banshee.Fixup/Solver.cs 
b/src/Extensions/Banshee.Fixup/Banshee.Fixup/Solver.cs
index 712abbd..dd66fd8 100644
--- a/src/Extensions/Banshee.Fixup/Banshee.Fixup/Solver.cs
+++ b/src/Extensions/Banshee.Fixup/Banshee.Fixup/Solver.cs
@@ -48,6 +48,10 @@ namespace Banshee.Fixup
         {
         }
 
+        internal protected virtual Banshee.Preferences.Section PreferencesSection {
+            get { return null; }
+        }
+
         // Total hack to work make unit tests work
         internal static bool EnableUnitTests;
 


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