diff options
author | Michael Hutchinson <mhutchinson@novell.com> | 2010-02-11 04:21:41 +0300 |
---|---|---|
committer | Michael Hutchinson <mhutchinson@novell.com> | 2010-02-11 04:21:41 +0300 |
commit | 3f547ad89b9a43b9e18151de21f170ea93378ec2 (patch) | |
tree | ac7accc9d1f2978de4fc9431ce1b616f2d966309 /main/src/addins/GnomePlatform | |
parent | 692716dd51bcb10e7c7d57ea6d0f57ec5e158151 (diff) |
* GnomePlatform.cs: Tidy up GIO vs. GnomeVFS a bit.
svn path=/trunk/monodevelop/; revision=151277
Diffstat (limited to 'main/src/addins/GnomePlatform')
-rw-r--r-- | main/src/addins/GnomePlatform/ChangeLog | 4 | ||||
-rw-r--r-- | main/src/addins/GnomePlatform/GnomePlatform.cs | 30 |
2 files changed, 20 insertions, 14 deletions
diff --git a/main/src/addins/GnomePlatform/ChangeLog b/main/src/addins/GnomePlatform/ChangeLog index ff24f1728a..79ad77d2bb 100644 --- a/main/src/addins/GnomePlatform/ChangeLog +++ b/main/src/addins/GnomePlatform/ChangeLog @@ -1,3 +1,7 @@ +2010-02-10 Michael Hutchinson <mhutchinson@novell.com> + + * GnomePlatform.cs: Tidy up GIO vs. GnomeVFS a bit. + 2009-10-30 Lluis Sanchez Gual <lluis@novell.com> * AssemblyInfo.cs: diff --git a/main/src/addins/GnomePlatform/GnomePlatform.cs b/main/src/addins/GnomePlatform/GnomePlatform.cs index f24e8c8fb4..a5c67ab4db 100644 --- a/main/src/addins/GnomePlatform/GnomePlatform.cs +++ b/main/src/addins/GnomePlatform/GnomePlatform.cs @@ -35,7 +35,7 @@ using System.Runtime.InteropServices; using MonoDevelop.Core.Gui; using Gnome; -using Gnome.Vfs; +using System.Collections.Generic; namespace MonoDevelop.Platform @@ -54,6 +54,7 @@ namespace MonoDevelop.Platform } catch (Exception ex) { Console.WriteLine (ex); } + //apparently Gnome.Icon needs GnomeVFS initialized even when we're using GIO. Gnome.Vfs.Vfs.Initialize (); } @@ -63,7 +64,7 @@ namespace MonoDevelop.Platform if (useGio) return Gio.GetDefaultForType (mimeType); - MimeApplication app = Mime.GetDefaultApplication (mimeType); + var app = Gnome.Vfs.Mime.GetDefaultApplication (mimeType); if (app != null) return (DesktopApplication) Marshal.PtrToStructure (app.Handle, typeof(DesktopApplication)); else @@ -75,13 +76,13 @@ namespace MonoDevelop.Platform if (useGio) return Gio.GetAllForType (mimeType); - ArrayList list = new ArrayList (); - MimeApplication[] apps = Mime.GetAllApplications (mimeType); - foreach (MimeApplication app in apps) { - DesktopApplication dap = (DesktopApplication) Marshal.PtrToStructure (app.Handle, typeof(DesktopApplication)); + var list = new List<DesktopApplication> (); + var apps = Gnome.Vfs.Mime.GetAllApplications (mimeType); + foreach (var app in apps) { + var dap = (DesktopApplication) Marshal.PtrToStructure (app.Handle, typeof(DesktopApplication)); list.Add (dap); } - return (DesktopApplication[]) list.ToArray (typeof(DesktopApplication)); + return list.ToArray (); } protected override string OnGetMimeTypeDescription (string mt) @@ -89,17 +90,18 @@ namespace MonoDevelop.Platform if (useGio) return Gio.GetMimeTypeDescription (mt); else - return Mime.GetDescription (mt); + return Gnome.Vfs.Mime.GetDescription (mt); } protected override string OnGetMimeTypeForUri (string uri) { - if (useGio) { - string mt = Gio.GetMimeTypeForUri (uri); - if (mt != null) - return mt; - } - return uri != null ? Gnome.Vfs.MimeType.GetMimeTypeForUri (ConvertFileNameToVFS (uri)) : null; + if (uri == null) + return null; + + if (useGio) + return Gio.GetMimeTypeForUri (uri); + else + return Gnome.Vfs.MimeType.GetMimeTypeForUri (ConvertFileNameToVFS (uri)); } protected override bool OnGetMimeTypeIsText (string mimeType) |