[banshee] OSX: Add support for native file chooser dialogs (bgo#682093)



commit 0aab39fbe5e818376d04daf1ef9261f7b62e1805
Author: Timo DÃrr <timo latecrew de>
Date:   Tue Jul 17 13:21:10 2012 +0200

    OSX: Add support for native file chooser dialogs (bgo#682093)
    
    Rework some UI dialog logic to allow backends to have custom file
    chooser dialogs. On OSX, using the native dialog enables access to USB
    drives, network shares, etc.
    
    Right now this is limited to a basic FileChooserDialog,
    and does not work for other file open/save dialogs with custom widgets.
    In this case, the GtkFileChooserDialog is used.
    
    Signed-off-by: Bertrand Lorentz <bertrand lorentz gmail com>

 po/POTFILES.in                                     |    2 +
 src/Backends/Banshee.Osx/Banshee.Osx.addin.xml     |    7 +-
 src/Backends/Banshee.Osx/Banshee.Osx.csproj        |    4 +
 .../Banshee.OsxBackend/OsxFileChooserDialog.cs     |  103 +++++++++++++++
 src/Backends/Banshee.Osx/Makefile.am               |    1 +
 .../Banshee.Gui.Dialogs/FileChooserDialog.cs       |  138 +++++---------------
 .../Banshee.Gui.Dialogs/GtkFileChooserDialog.cs    |  126 ++++++++++++++++++
 .../Banshee.Gui.Dialogs/ImageFileChooserDialog.cs  |    2 +-
 .../Banshee.Gui.Dialogs/OpenLocationDialog.cs      |    2 +-
 .../Banshee.Gui/PlaybackSubtitleActions.cs         |    2 +-
 .../Banshee.Playlist.Gui/PlaylistExportDialog.cs   |    2 +-
 .../Banshee.ThickClient.addin.xml                  |    6 +-
 .../Banshee.ThickClient/Banshee.ThickClient.csproj |    1 +
 src/Core/Banshee.ThickClient/Makefile.am           |    1 +
 14 files changed, 289 insertions(+), 108 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 26232d7..19669bf 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -26,6 +26,7 @@ src/Backends/Banshee.GStreamerSharp/Banshee.GStreamerSharp/AudioCdRipper.cs
 src/Backends/Banshee.GStreamerSharp/Banshee.GStreamerSharp/BpmDetector.cs
 src/Backends/Banshee.GStreamerSharp/Banshee.GStreamerSharp/PlayerEngine.cs
 src/Backends/Banshee.GStreamerSharp/Banshee.GStreamerSharp/Transcoder.cs
+src/Backends/Banshee.Osx/Banshee.OsxBackend/OsxFileChooserDialog.cs
 src/Backends/Banshee.Osx/Banshee.OsxBackend/OsxService.cs
 src/Backends/Banshee.Windows/Banshee.Windows/VersionUpdater.cs
 src/Backends/Banshee.Windows/Banshee.Windows/WindowsService.cs
@@ -115,6 +116,7 @@ src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/ConfirmShutdownDialog.cs
 src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/DefaultApplicationHelperDialog.cs
 src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/ErrorListDialog.cs
 src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/FileChooserDialog.cs
+src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/GtkFileChooserDialog.cs
 src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/ImageFileChooserDialog.cs
 src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/OpenLocationDialog.cs
 src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/SeekDialog.cs
diff --git a/src/Backends/Banshee.Osx/Banshee.Osx.addin.xml b/src/Backends/Banshee.Osx/Banshee.Osx.addin.xml
index 6043926..1e86dd0 100644
--- a/src/Backends/Banshee.Osx/Banshee.Osx.addin.xml
+++ b/src/Backends/Banshee.Osx/Banshee.Osx.addin.xml
@@ -3,7 +3,7 @@
     id="Banshee.Osx"
     version="1.0"
     compatVersion="1.0"
-    copyright="Â 2009-2010 Novell Inc, Â 2008 Eoin Hennessy. Licensed under the MIT X11 license."
+    copyright="Â 2012 Timo DÃrr, Â 2009-2010 Novell Inc, Â 2008 Eoin Hennessy. Licensed under the MIT X11 license."
     category="required:Backends"
     description="Backend providers for the OSX platform. Includes general OSX integration."
     defaultEnabled="true">
@@ -11,6 +11,7 @@
   <Dependencies>
     <Addin id="Banshee.Core" version="1.0"/>
     <Addin id="Banshee.Services" version="1.0"/>
+    <Addin id="Banshee.ThickClient" version="1.0"/>
   </Dependencies>
 
   <Extension path="/Banshee/ServiceManager/Service">
@@ -20,4 +21,8 @@
   <Extension path="/Banshee/Platform/HardwareManager">
     <HardwareManager class="Banshee.OsxBackend.HardwareManager" id="Banshee.OsxBackend.HardwareManager" />
   </Extension>
+
+  <Extension path="/Banshee/Gui/NativeFileChooserDialog">
+    <NativeFileChooserDialog class="Banshee.OsxBackend.OsxFileChooserDialog" />
+  </Extension>
 </Addin>
diff --git a/src/Backends/Banshee.Osx/Banshee.Osx.csproj b/src/Backends/Banshee.Osx/Banshee.Osx.csproj
index fb1e52c..3b36c30 100644
--- a/src/Backends/Banshee.Osx/Banshee.Osx.csproj
+++ b/src/Backends/Banshee.Osx/Banshee.Osx.csproj
@@ -70,6 +70,9 @@
       <Private>False</Private>
     </Reference>
     <Reference Include="System.Core" />
+    <Reference Include="Mono.Addins, Version=0.6.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756">
+      <Private>False</Private>
+    </Reference>
   </ItemGroup>
   <ItemGroup>
     <Compile Include="Banshee.OsxBackend\HardwareManager.cs" />
@@ -86,6 +89,7 @@
     <Compile Include="Banshee.Hardware.Osx\LowLevel\OsxUsbData.cs" />
     <Compile Include="Banshee.Hardware.Osx\LowLevel\DiskArbitration.cs" />
     <Compile Include="Banshee.Hardware.Osx\LowLevel\CoreFoundation.cs" />
+    <Compile Include="Banshee.OsxBackend\OsxFileChooserDialog.cs" />
   </ItemGroup>
   <ItemGroup>
     <EmbeddedResource Include="Banshee.Osx.addin.xml">
diff --git a/src/Backends/Banshee.Osx/Banshee.OsxBackend/OsxFileChooserDialog.cs b/src/Backends/Banshee.Osx/Banshee.OsxBackend/OsxFileChooserDialog.cs
new file mode 100644
index 0000000..f69dfeb
--- /dev/null
+++ b/src/Backends/Banshee.Osx/Banshee.OsxBackend/OsxFileChooserDialog.cs
@@ -0,0 +1,103 @@
+//
+// OsxFileChooserDialog.cs
+//
+// Author:
+//   Timo DÃrr <timo latecrew de>
+//
+// Copyright (C) 2012 Timo DÃrr
+//
+// 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.Linq;
+using System.Collections.Generic;
+
+using Gtk;
+using Mono.Addins;
+using MonoMac.AppKit;
+
+using Banshee.Gui.Dialogs;
+using Banshee.Configuration;
+using Banshee.ServiceStack;
+using Hyena;
+
+namespace Banshee.OsxBackend
+{
+    public class OsxFileChooserDialog : IBansheeFileChooser
+    {
+        private NSOpenPanel open_panel;
+
+        // this ctor is required for Mono.Addins
+        public OsxFileChooserDialog ()
+        {
+        }
+
+        public IBansheeFileChooser CreateForImport (string title, bool files)
+        {
+            return new OsxFileChooserDialog (title, files);
+        }
+
+        public OsxFileChooserDialog (string title, bool files)
+        {
+            var panel = new NSOpenPanel () {
+                Title = title,
+                CanChooseDirectories = !files,
+                CanChooseFiles = files,
+                AllowsMultipleSelection = true,
+                // Translators: verb
+                Prompt = Mono.Unix.Catalog.GetString ("Import")
+            };
+            open_panel = panel;
+        }
+
+        #region IBansheeFileChooser implementation
+        public string[] Filenames {
+            get {
+                return open_panel.Urls.Select (uri => SafeUri.UriToFilename (uri.ToString ())).ToArray<string> ();
+            }
+        }
+        public string[] Uris {
+            get {
+                return open_panel.Urls.Select (uri => uri.ToString ()).ToArray<string> ();
+            }
+        }
+
+        public void Destroy ()
+        {
+            open_panel.Close ();
+        }
+
+        public int Run ()
+        {
+            int ret = open_panel.RunModal ();
+            // TODO someday MonoMac should provide NSOKButton constant
+            if (ret == 1)
+                return (int) Gtk.ResponseType.Ok;
+            else
+                return (int) Gtk.ResponseType.Cancel;
+        }
+
+        public void AddFilter (FileFilter filter)
+        {
+        }
+        #endregion
+    }
+}
diff --git a/src/Backends/Banshee.Osx/Makefile.am b/src/Backends/Banshee.Osx/Makefile.am
index b898ec8..f540c1e 100644
--- a/src/Backends/Banshee.Osx/Makefile.am
+++ b/src/Backends/Banshee.Osx/Makefile.am
@@ -17,6 +17,7 @@ SOURCES =  \
 	Banshee.Hardware.Osx/UsbVolume.cs \
 	Banshee.Hardware.Osx/Volume.cs \
 	Banshee.OsxBackend/HardwareManager.cs \
+	Banshee.OsxBackend/OsxFileChooserDialog.cs \
 	Banshee.OsxBackend/OsxService.cs \
 	OsxIntegration.GtkOsxApplication/GtkOsxApplication.cs
 
diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/FileChooserDialog.cs b/src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/FileChooserDialog.cs
index c904bf2..c974c22 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/FileChooserDialog.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/FileChooserDialog.cs
@@ -2,121 +2,55 @@
 // FileChooserDialog.cs
 //
 // Author:
-//   Aaron Bockover <abockover novell com>
+//   Timo DÃrr <timo latecrew de>
 //
-// Copyright (C) 2006-2007 Novell, Inc.
+// Copyright 2012 Timo DÃrr
 //
-// 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:
+// 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 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.
-//
-
+// 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.Linq;
 using System;
-using Gtk;
-
-using Banshee.Configuration;
-using Banshee.ServiceStack;
-using Hyena;
+using Mono.Addins;
 
 namespace Banshee.Gui.Dialogs
 {
-    public class FileChooserDialog : Gtk.FileChooserDialog
+    public class FileChooserDialog
     {
-        public static FileChooserDialog CreateForImport (string title, bool files)
-        {
-            var chooser = new Banshee.Gui.Dialogs.FileChooserDialog (
-                title,
-                ServiceManager.Get<Banshee.Gui.GtkElementsService> ().PrimaryWindow,
-                files ? FileChooserAction.Open : FileChooserAction.SelectFolder
-            );
-
-            chooser.DefaultResponse = ResponseType.Ok;
-            chooser.SelectMultiple = true;
-
-            chooser.AddButton (Stock.Cancel, ResponseType.Cancel);
-            // Translators: verb
-            chooser.AddButton (Mono.Unix.Catalog.GetString("I_mport"), ResponseType.Ok);
-
-            // FIXME: this dialog should be library-specific, and so these shortcuts should be
-            // library-specific too
-            Hyena.Gui.GtkUtilities.SetChooserShortcuts (chooser,
-                ServiceManager.SourceManager.MusicLibrary.BaseDirectory,
-                ServiceManager.SourceManager.VideoLibrary.BaseDirectory,
-                GetPhotosFolder ()
-            );
-
-            return chooser;
-        }
-
-        public FileChooserDialog (string title, FileChooserAction action) : this (title, null, action)
+        public static IBansheeFileChooser CreateForImport (string title, bool files)
         {
-        }
-
-        public FileChooserDialog (string title, Window parent, FileChooserAction action) :
-            base (title, parent, action)
-        {
-            LocalOnly = Banshee.IO.Provider.LocalOnly;
-            string fallback = SafeUri.FilenameToUri (Environment.GetFolderPath (Environment.SpecialFolder.Personal));
-            SetCurrentFolderUri (LastFileChooserUri.Get (fallback));
-            WindowPosition = WindowPosition.Center;
-        }
-
-        public static string GetPhotosFolder ()
-        {
-            string personal = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
-            string desktop = Environment.GetFolderPath (Environment.SpecialFolder.Desktop);
-
-            var photo_folders = new string [] {
-                Environment.GetFolderPath (Environment.SpecialFolder.MyPictures),
-                Paths.Combine (desktop, "Photos"), Paths.Combine (desktop, "photos"),
-                Paths.Combine (personal, "Photos"), Paths.Combine (personal, "photos")
-            };
-
-            // Make sure we don't accidentally scan the entire home or desktop directory
-            for (int i = 0; i < photo_folders.Length; i++) {
-                if (photo_folders[i] == personal || photo_folders[i] == desktop) {
-                    photo_folders[i] = null;
-                }
+            var chooser = AddinManager.GetExtensionObjects <IBansheeFileChooser> ("/Banshee/Gui/NativeFileChooserDialog").FirstOrDefault ();
+            if (chooser == null) {
+                var gtkchooser = new GtkFileChooserDialog ();
+                return gtkchooser.CreateForImport (title, files);
             }
-
-            foreach (string folder in photo_folders) {
-                if (folder != null && folder != personal && folder != desktop && Banshee.IO.Directory.Exists (folder)) {
-                    return folder;
-                }
-            }
-
-            return null;
+            return chooser.CreateForImport (title, files);
         }
+    }
 
-        protected override void OnResponse (ResponseType response)
-        {
-            base.OnResponse (response);
-
-            if (CurrentFolderUri != null) {
-                LastFileChooserUri.Set (CurrentFolderUri);
-            }
-        }
+    public interface IBansheeFileChooser
+    {
+        string[] Filenames { get; }
+        string[] Uris { get; }
 
-        public static readonly SchemaEntry<string> LastFileChooserUri = new SchemaEntry<string> (
-            "player_window", "last_file_chooser_uri",
-            String.Empty,
-            "URI",
-            "URI of last file folder"
-        );
+        int Run ();
+        void Destroy ();
+        void AddFilter (Gtk.FileFilter filter);
+        IBansheeFileChooser CreateForImport (string title, bool files);
     }
 }
diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/GtkFileChooserDialog.cs b/src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/GtkFileChooserDialog.cs
new file mode 100644
index 0000000..58d08be
--- /dev/null
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/GtkFileChooserDialog.cs
@@ -0,0 +1,126 @@
+//
+// GtkFileChooserDialog.cs
+//
+// Author:
+//   Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 2006-2007 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 Gtk;
+
+using Banshee.Configuration;
+using Banshee.ServiceStack;
+using Hyena;
+
+namespace Banshee.Gui.Dialogs
+{
+    public class GtkFileChooserDialog : Gtk.FileChooserDialog, IBansheeFileChooser
+    {
+        public IBansheeFileChooser CreateForImport (string title, bool files)
+        {
+            var chooser = new Banshee.Gui.Dialogs.GtkFileChooserDialog (
+                title,
+                ServiceManager.Get<Banshee.Gui.GtkElementsService> ().PrimaryWindow,
+                files ? FileChooserAction.Open : FileChooserAction.SelectFolder
+            );
+
+            chooser.DefaultResponse = ResponseType.Ok;
+            chooser.SelectMultiple = true;
+
+            chooser.AddButton (Stock.Cancel, ResponseType.Cancel);
+            // Translators: verb
+            chooser.AddButton (Mono.Unix.Catalog.GetString("I_mport"), ResponseType.Ok);
+
+            // FIXME: this dialog should be library-specific, and so these shortcuts should be
+            // library-specific too
+            Hyena.Gui.GtkUtilities.SetChooserShortcuts (chooser,
+                ServiceManager.SourceManager.MusicLibrary.BaseDirectory,
+                ServiceManager.SourceManager.VideoLibrary.BaseDirectory,
+                GetPhotosFolder ()
+            );
+
+            return chooser;
+        }
+
+        public GtkFileChooserDialog ()
+        {
+        }
+
+        public GtkFileChooserDialog (string title, FileChooserAction action) : this (title, null, action)
+        {
+        }
+
+        public GtkFileChooserDialog (string title, Window parent, FileChooserAction action) :
+            base (title, parent, action)
+        {
+            LocalOnly = Banshee.IO.Provider.LocalOnly;
+            string fallback = SafeUri.FilenameToUri (Environment.GetFolderPath (Environment.SpecialFolder.Personal));
+            SetCurrentFolderUri (LastFileChooserUri.Get (fallback));
+            WindowPosition = WindowPosition.Center;
+        }
+
+        public static string GetPhotosFolder ()
+        {
+            string personal = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
+            string desktop = Environment.GetFolderPath (Environment.SpecialFolder.Desktop);
+
+            var photo_folders = new string [] {
+                Environment.GetFolderPath (Environment.SpecialFolder.MyPictures),
+                Paths.Combine (desktop, "Photos"), Paths.Combine (desktop, "photos"),
+                Paths.Combine (personal, "Photos"), Paths.Combine (personal, "photos")
+            };
+
+            // Make sure we don't accidentally scan the entire home or desktop directory
+            for (int i = 0; i < photo_folders.Length; i++) {
+                if (photo_folders[i] == personal || photo_folders[i] == desktop) {
+                    photo_folders[i] = null;
+                }
+            }
+
+            foreach (string folder in photo_folders) {
+                if (folder != null && folder != personal && folder != desktop && Banshee.IO.Directory.Exists (folder)) {
+                    return folder;
+                }
+            }
+
+            return null;
+        }
+
+        protected override void OnResponse (ResponseType response)
+        {
+            base.OnResponse (response);
+
+            if (CurrentFolderUri != null) {
+                LastFileChooserUri.Set (CurrentFolderUri);
+            }
+        }
+
+        public static readonly SchemaEntry<string> LastFileChooserUri = new SchemaEntry<string> (
+            "player_window", "last_file_chooser_uri",
+            String.Empty,
+            "URI",
+            "URI of last file folder"
+        );
+    }
+}
diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/ImageFileChooserDialog.cs b/src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/ImageFileChooserDialog.cs
index 3cc9cb7..163ae7c 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/ImageFileChooserDialog.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/ImageFileChooserDialog.cs
@@ -32,7 +32,7 @@ using Gtk;
 
 namespace Banshee.Gui.Dialogs
 {
-    public class ImageFileChooserDialog : Banshee.Gui.Dialogs.FileChooserDialog
+    public class ImageFileChooserDialog : Banshee.Gui.Dialogs.GtkFileChooserDialog
     {
         private Image preview = new Image ();
 
diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/OpenLocationDialog.cs b/src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/OpenLocationDialog.cs
index b808ee5..0fa992e 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/OpenLocationDialog.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/OpenLocationDialog.cs
@@ -99,7 +99,7 @@ namespace Banshee.Gui.Dialogs
 
         private void OnBrowseClicked(object o, EventArgs args)
         {
-            FileChooserDialog chooser = new FileChooserDialog(
+            var chooser = new GtkFileChooserDialog(
                 Catalog.GetString("Open Location"),
                 null,
                 FileChooserAction.Open
diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui/PlaybackSubtitleActions.cs b/src/Core/Banshee.ThickClient/Banshee.Gui/PlaybackSubtitleActions.cs
index 749b8cc..b224ab7 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Gui/PlaybackSubtitleActions.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui/PlaybackSubtitleActions.cs
@@ -75,7 +75,7 @@ namespace Banshee.Gui
 
         private void OnLoadSubtitleAction (object o, EventArgs args)
         {
-            var chooser = new Banshee.Gui.Dialogs.FileChooserDialog (
+            var chooser = new Banshee.Gui.Dialogs.GtkFileChooserDialog (
                 Catalog.GetString ("Load Subtitle File"),
                 ServiceManager.Get<Banshee.Gui.GtkElementsService> ().PrimaryWindow,
                 FileChooserAction.Open
diff --git a/src/Core/Banshee.ThickClient/Banshee.Playlist.Gui/PlaylistExportDialog.cs b/src/Core/Banshee.ThickClient/Banshee.Playlist.Gui/PlaylistExportDialog.cs
index fe88e58..acf54e3 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Playlist.Gui/PlaylistExportDialog.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Playlist.Gui/PlaylistExportDialog.cs
@@ -9,7 +9,7 @@ using Banshee.Playlists.Formats;
 
 namespace Banshee.Playlist.Gui
 {
-    public class PlaylistExportDialog : Banshee.Gui.Dialogs.FileChooserDialog
+    public class PlaylistExportDialog : Banshee.Gui.Dialogs.GtkFileChooserDialog
     {
         protected ComboBox combobox;
         protected ListStore store;
diff --git a/src/Core/Banshee.ThickClient/Banshee.ThickClient.addin.xml b/src/Core/Banshee.ThickClient/Banshee.ThickClient.addin.xml
index 0d26a37..42505f1 100644
--- a/src/Core/Banshee.ThickClient/Banshee.ThickClient.addin.xml
+++ b/src/Core/Banshee.ThickClient/Banshee.ThickClient.addin.xml
@@ -60,5 +60,9 @@
     <Description>Defines an extension for the track editor that can modify it in some way.</Description>
     <ExtensionNode name="Modifier"/>
   </ExtensionPoint>
-  
+
+  <ExtensionPoint path="/Banshee/Gui/NativeFileChooserDialog">
+    <Description>Defines an extension that provides a custom (possibly native) file chooser dialog.</Description>
+    <ExtensionNode name="NativeFileChooserDialog"/>
+  </ExtensionPoint>
 </Addin>
diff --git a/src/Core/Banshee.ThickClient/Banshee.ThickClient.csproj b/src/Core/Banshee.ThickClient/Banshee.ThickClient.csproj
index ec6ccfc..dc733fd 100644
--- a/src/Core/Banshee.ThickClient/Banshee.ThickClient.csproj
+++ b/src/Core/Banshee.ThickClient/Banshee.ThickClient.csproj
@@ -308,6 +308,7 @@
     <Compile Include="Banshee.Gui\PlaybackSubtitleActions.cs" />
     <Compile Include="Banshee.Collection.Gui\YearListView.cs" />
     <Compile Include="Banshee.Gui.Widgets\Tests\TrackInfoDisplayTests.cs" />
+    <Compile Include="Banshee.Gui.Dialogs\GtkFileChooserDialog.cs" />
   </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <ProjectExtensions>
diff --git a/src/Core/Banshee.ThickClient/Makefile.am b/src/Core/Banshee.ThickClient/Makefile.am
index 7e56a78..5eeaff2 100644
--- a/src/Core/Banshee.ThickClient/Makefile.am
+++ b/src/Core/Banshee.ThickClient/Makefile.am
@@ -50,6 +50,7 @@ SOURCES =  \
 	Banshee.Gui.Dialogs/ErrorListDialog.cs \
 	Banshee.Gui.Dialogs/ExtensionManagerDialog.cs \
 	Banshee.Gui.Dialogs/FileChooserDialog.cs \
+	Banshee.Gui.Dialogs/GtkFileChooserDialog.cs \
 	Banshee.Gui.Dialogs/ImageFileChooserDialog.cs \
 	Banshee.Gui.Dialogs/OpenLocationDialog.cs \
 	Banshee.Gui.Dialogs/SeekDialog.cs \



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