[Banshee-List] Native file open dialogs, feedback needed



Hi all,

I was just playing around with implementing native OS X "file open" dialogs in banshee. I am somewhat unsure of what is the best design decision of implementing that.

Right now, (all (or at least the most) platform-specific code goes into its according backends which are Banshee.Osx, Banshee.Unix and Banshee.Windows. This works for the HardwareManager and other plattform specific code very well. The FileChooserDialog.cs resides in the Banshee.Gui.Dialogs within Banshee.ThickClient, and is compiled on all plattforms atm.

I see a bunch of possibilities of how I could implement the native FileChooser:

(1): Create a OsxFileChooser.cs within Banshee.Gui.Dialogs and have it completely surrounded by #if PLATFORM_DARWIN compile conditionals. This would require changes to the autofoo scripts. Same could be done with a future possible WindowsFileChooserDialog.cs. Current FileChooserDialog.cs is moved into GtkFileChooser.cs and the FileChooser.cs (and its class) are replaced by a bridge class (using the bridge design pattern), that uses Hyena.PlatformDetection to decide which of the classes is to be instantiated and returned. This would require compile conditionals #if in the FileChooserDialog.cs, to.

(2): like (1), but without the bridge design pattern and without the #if in the FileChooser.cs file. Instead, create an empty partial class FileChooserDialog, and the other implementations ({Osx|Gtk|Win}FileChooserDialog) are also partial - again the #if compile conditionals surround each platform-specific version, and thus decide which class is compiled into the actual FileChooser

(3): Move the platform dependent {Osx|Gtk|Win}FileChooser (and possibly other dialogs) in the according Backends like Banshee.{Osx|Windows|Unix}. Change the FileChooserDialog.cs to load the correct implementation via mono.addins as an ExtensionNode, depending on Hyena.PlatformDetection. This has the advantage of not having to introduce preprocessor conditionals, as the autofoo code for conditionally compile the correct Osx/Windows/Unix backends is already in place. Disadvantage is, it is the solution which changes the most code and design change.

Any suggestions or feedback which is the best way to go?

Greetz
Timo

--
Erstellt mit Operas revolutionärem E-Mail-Modul: http://www.opera.com/mail/


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