[banshee] Fixup: added an informative column (bgo#732339)



commit 21bf04cb397a8bffaa39d7ad1d520d495c1db7f3
Author: Marcin Kolny <marcin kolny gmail com>
Date:   Thu Jul 10 16:57:17 2014 +0200

    Fixup: added an informative column (bgo#732339)
    
    This column may be useful so other extensions that use the
    MetadataFixer can give more info about the track being fixed
    (current solvers of this extension can fix many tracks per
    row, so this may not be useful for them, because using just
    a cell to show information about more than one track may be
    ugly; but the solvers being developed in b-c-e mostly add
    one-fix-per-track solvers, therefore the HasTrackDetails
    property will be marked as FALSE by default, but virtual,
    so derived classes can override it).
    
    Signed-off-by: Andrés G. Aragoneses <knocte gmail com>

 .../Banshee.Fixup/Banshee.Fixup/Problem.cs         |    4 ++++
 .../Banshee.Fixup/Banshee.Fixup/Solver.cs          |    5 ++++-
 src/Extensions/Banshee.Fixup/Banshee.Fixup/View.cs |   19 +++++++++----------
 3 files changed, 17 insertions(+), 11 deletions(-)
---
diff --git a/src/Extensions/Banshee.Fixup/Banshee.Fixup/Problem.cs 
b/src/Extensions/Banshee.Fixup/Banshee.Fixup/Problem.cs
index b18c0d3..ff3d6dd 100644
--- a/src/Extensions/Banshee.Fixup/Banshee.Fixup/Problem.cs
+++ b/src/Extensions/Banshee.Fixup/Banshee.Fixup/Problem.cs
@@ -77,6 +77,9 @@ namespace Banshee.Fixup
         [DatabaseColumn]
         public int ObjectCount { get; private set; }
 
+        [DatabaseColumn ("TrackDetails")]
+        public string TrackDetails { get; private set; }
+
         private int [] object_ids;
         public int [] ObjectIds {
             get {
@@ -135,6 +138,7 @@ namespace Banshee.Fixup
                         SolutionOptions     TEXT,
                         ObjectIds   TEXT,
                         ObjectCount INTEGER,
+                        TrackDetails TEXT,
 
                         UNIQUE (ProblemType, Generation, ObjectIds) ON CONFLICT IGNORE
                     )"
diff --git a/src/Extensions/Banshee.Fixup/Banshee.Fixup/Solver.cs 
b/src/Extensions/Banshee.Fixup/Banshee.Fixup/Solver.cs
index 8353079..712abbd 100644
--- a/src/Extensions/Banshee.Fixup/Banshee.Fixup/Solver.cs
+++ b/src/Extensions/Banshee.Fixup/Banshee.Fixup/Solver.cs
@@ -30,7 +30,6 @@ using System.Collections.Generic;
 
 using Mono.Unix;
 
-using Hyena;
 using Hyena.Data.Sqlite;
 
 using Banshee.ServiceStack;
@@ -70,6 +69,10 @@ namespace Banshee.Fixup
         public string Description { get; set; }
         public int Generation { get; private set; }
 
+        internal protected virtual bool HasTrackDetails {
+            get { return false; }
+        }
+
         public void FindProblems ()
         {
             // Bump the generation number
diff --git a/src/Extensions/Banshee.Fixup/Banshee.Fixup/View.cs 
b/src/Extensions/Banshee.Fixup/Banshee.Fixup/View.cs
index bcf4be9..a2e0b0d 100644
--- a/src/Extensions/Banshee.Fixup/Banshee.Fixup/View.cs
+++ b/src/Extensions/Banshee.Fixup/Banshee.Fixup/View.cs
@@ -25,26 +25,17 @@
 // THE SOFTWARE.
 
 using System;
-using System.Collections.Generic;
 
 using Mono.Unix;
 
 using Gtk;
 
-using Hyena;
-using Hyena.Data;
 using Hyena.Data.Gui;
-using Hyena.Data.Sqlite;
-
 using Hyena.Widgets;
 
-using Banshee.ServiceStack;
 using Banshee.Sources;
 using Banshee.Library;
-
-using Banshee.Gui;
 using Banshee.Sources.Gui;
-using Banshee.Preferences.Gui;
 
 namespace Banshee.Fixup
 {
@@ -83,7 +74,15 @@ namespace Banshee.Fixup
                 var summary = new ColumnCellSolutionOptions ();
                 var summary_col = new Column ("", summary, 1.0);
                 ColumnController.Add (summary_col);
-                model.Reloaded += (o, a) => summary_col.Title = model.Solver.Name;
+
+                var track_details_col = new Column (Catalog.GetString ("Track details"),
+                                                    new ColumnCellText ("TrackDetails", true), 0);
+                ColumnController.Add (track_details_col);
+
+                model.Reloaded += (o, a) => {
+                    track_details_col.Visible = model.Solver.HasTrackDetails;
+                    summary_col.Title = model.Solver.Name;
+                };
 
                 RowOpaquePropertyName = "Selected";
                 RulesHint = true;


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