[banshee] [Import] Improve import src order, add separators



commit f8a21d3c151492a9916c7a738c6a671d39b71b0f
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Fri Jan 15 23:04:14 2010 -0800

    [Import] Improve import src order, add separators
    
    Also, remove 'Local' from Folder/File srcs when using !LocalOnly IO
    backend, eg Gio.

 .../Banshee.Library/HomeDirectoryImportSource.cs   |    2 +-
 .../Banshee.Library.Gui/FileImportSource.cs        |    4 ++--
 .../Banshee.Library.Gui/FolderImportSource.cs      |    4 ++--
 .../Banshee.Library.Gui/ImportDialog.cs            |   14 +++++++++++++-
 .../Banshee.Library.Gui/PhotoFolderImportSource.cs |    2 +-
 5 files changed, 19 insertions(+), 7 deletions(-)
---
diff --git a/src/Core/Banshee.Services/Banshee.Library/HomeDirectoryImportSource.cs b/src/Core/Banshee.Services/Banshee.Library/HomeDirectoryImportSource.cs
index c93ba97..3c63c32 100644
--- a/src/Core/Banshee.Services/Banshee.Library/HomeDirectoryImportSource.cs
+++ b/src/Core/Banshee.Services/Banshee.Library/HomeDirectoryImportSource.cs
@@ -59,7 +59,7 @@ namespace Banshee.Library
         }
 
         public int SortOrder {
-            get { return 10; }
+            get { return 12; }
         }
     }
 }
diff --git a/src/Core/Banshee.ThickClient/Banshee.Library.Gui/FileImportSource.cs b/src/Core/Banshee.ThickClient/Banshee.Library.Gui/FileImportSource.cs
index f09b446..a3523db 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Library.Gui/FileImportSource.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Library.Gui/FileImportSource.cs
@@ -56,7 +56,7 @@ namespace Banshee.Library.Gui
         }
 
         public string Name {
-            get { return Catalog.GetString ("Local Files"); }
+            get { return Banshee.IO.Provider.LocalOnly ? Catalog.GetString ("Local Files") : Catalog.GetString ("Files"); }
         }
 
         public string ImportLabel {
@@ -72,7 +72,7 @@ namespace Banshee.Library.Gui
         }
 
         public int SortOrder {
-            get { return 5; }
+            get { return 11; }
         }
 
         // Reserve strings in preparation for the forthcoming string freeze.
diff --git a/src/Core/Banshee.ThickClient/Banshee.Library.Gui/FolderImportSource.cs b/src/Core/Banshee.ThickClient/Banshee.Library.Gui/FolderImportSource.cs
index e9f4841..cba7ed3 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Library.Gui/FolderImportSource.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Library.Gui/FolderImportSource.cs
@@ -50,7 +50,7 @@ namespace Banshee.Library.Gui
         }
 
         public string Name {
-            get { return Catalog.GetString ("Local Folders"); }
+            get { return Banshee.IO.Provider.LocalOnly ? Catalog.GetString ("Local Folders") : Catalog.GetString ("Folders"); }
         }
 
         public string ImportLabel {
@@ -66,7 +66,7 @@ namespace Banshee.Library.Gui
         }
 
         public int SortOrder {
-            get { return 0; }
+            get { return 10; }
         }
 
         // Reserve strings in preparation for the forthcoming string freeze.
diff --git a/src/Core/Banshee.ThickClient/Banshee.Library.Gui/ImportDialog.cs b/src/Core/Banshee.ThickClient/Banshee.Library.Gui/ImportDialog.cs
index 6df7fc5..fd22d09 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Library.Gui/ImportDialog.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Library.Gui/ImportDialog.cs
@@ -84,6 +84,10 @@ namespace Banshee.Library.Gui
             Dialog.StyleSet += delegate {
                 UpdateIcons ();
             };
+
+            source_combo_box.RowSeparatorFunc = (model, iter) => {
+                return model.GetValue (iter, 2) == null;
+            };
         }
 
         private void UpdateImportLabel ()
@@ -130,8 +134,14 @@ namespace Banshee.Library.Gui
             sources.Sort (import_source_comparer);
 
             // And actually add them to the dialog
+            int? last_sort_order = null;
             foreach (IImportSource source in sources) {
+                if (last_sort_order != null && last_sort_order / 10 != source.SortOrder / 10) {
+                    source_model.AppendValues (null, null, null);
+                }
+
                 AddSource (source);
+                last_sort_order = source.SortOrder;
             }
 
             if (!active_iter.Equals(TreeIter.Zero) || (active_iter.Equals (TreeIter.Zero) &&
@@ -154,7 +164,9 @@ namespace Banshee.Library.Gui
                         ((Gdk.Pixbuf)o).Dispose ();
                     }
 
-                    source_model.SetValue (iter, 0, GetIcon (source));
+                    if (source != null) {
+                        source_model.SetValue (iter, 0, GetIcon (source));
+                    }
                 }
             }
         }
diff --git a/src/Core/Banshee.ThickClient/Banshee.Library.Gui/PhotoFolderImportSource.cs b/src/Core/Banshee.ThickClient/Banshee.Library.Gui/PhotoFolderImportSource.cs
index 602a250..06a6b45 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Library.Gui/PhotoFolderImportSource.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Library.Gui/PhotoFolderImportSource.cs
@@ -89,7 +89,7 @@ namespace Banshee.Library.Gui
         }
 
         public int SortOrder {
-            get { return 0; }
+            get { return 13; }
         }
     }
 }



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