[Monodevelop-patches-list] r1237 - in trunk/MonoDevelop/src: Libraries/MonoDevelop.Gui.Utils Libraries/MonoDevelop.Gui.Utils/VFS Main/Base Main/Base/Services/File
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Thu Mar 25 00:16:46 EST 2004
Author: tberman
Date: 2004-03-25 00:16:45 -0500 (Thu, 25 Mar 2004)
New Revision: 1237
Added:
trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Utils/ChangeLog
Modified:
trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Utils/VFS/Vfs.cs
trunk/MonoDevelop/src/Main/Base/ChangeLog
trunk/MonoDevelop/src/Main/Base/Services/File/DefaultFileService.cs
Log:
new mime-type file loading junk to work around broken gnome issues.
Added: trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Utils/ChangeLog
===================================================================
--- trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Utils/ChangeLog 2004-03-24 18:33:30 UTC (rev 1236)
+++ trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Utils/ChangeLog 2004-03-25 05:16:45 UTC (rev 1237)
@@ -0,0 +1,4 @@
+2004-03-25 Todd Berman <tberman at sevenl.net>
+
+ * VFS/Vfs.cs: Added new code from Dashboard to provide a different
+ external app identification mechanism.
Modified: trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Utils/VFS/Vfs.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Utils/VFS/Vfs.cs 2004-03-24 18:33:30 UTC (rev 1236)
+++ trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Utils/VFS/Vfs.cs 2004-03-25 05:16:45 UTC (rev 1237)
@@ -71,4 +71,54 @@
get { return gnome_vfs_init (); }
}
}
+
+ public class MimeApplication {
+ [Flags]
+ public enum ArgumentType {
+ URIS,
+ PATHS,
+ URIS_FOR_NON_FILES,
+ }
+ [StructLayout(LayoutKind.Sequential)]
+ public class Info {
+ public string id;
+ public string name;
+ public string command;
+ public bool can_open_multiple_files;
+ public ArgumentType expects_uris;
+ public IntPtr supported_uri_schemes;
+ public bool requires_terminal;
+
+ public IntPtr reserved1;
+ public IntPtr reserved2;
+ }
+
+ [DllImport ("libgnomevfs-2")]
+ extern static Info gnome_vfs_mime_get_default_application ( string mime_type );
+ [DllImport ("libgnomevfs-2")]
+ extern static void gnome_vfs_mime_application_free ( Info info );
+
+ public static void Exec (string mime_type, string uri)
+ {
+ Info info;
+ info = gnome_vfs_mime_get_default_application (mime_type);
+ if (info == null)
+ {
+ // Can we please stop hard coding Nautilus!?
+ System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo ("nautilus", "\"" + uri + "\"");
+ psi.UseShellExecute = false;
+
+ System.Diagnostics.Process.Start (psi);
+ } else {
+ System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo (info.command, "\"" + uri + "\"");
+ psi.UseShellExecute = false;
+ System.Diagnostics.Process.Start (psi);
+ }
+//FIXME: Memory leak, causes crashes, dunno why...needs fixed
+// gnome_vfs_mime_application_free (info);
+ }
+
+ }
+
+
}
Modified: trunk/MonoDevelop/src/Main/Base/ChangeLog
===================================================================
--- trunk/MonoDevelop/src/Main/Base/ChangeLog 2004-03-24 18:33:30 UTC (rev 1236)
+++ trunk/MonoDevelop/src/Main/Base/ChangeLog 2004-03-25 05:16:45 UTC (rev 1237)
@@ -1,5 +1,11 @@
-2003-03-21 John Luke <jluke at cfl.rr.com>
+2004-03-25 Todd Berman <tberman at sevenl.net>
+ * Services/File/DefaultFileService.cs: adding a new method of external
+ app launching based on gnome vfs stuff, works around broken gnome
+ installs.
+
+2004-03-21 John Luke <jluke at cfl.rr.com>
+
* Commands/ProjectBrowserCommands/FolderNodeCommands.cs:
set the default of the FileSelector to ~/MonoDevelopProjects
closes bug #55188
Modified: trunk/MonoDevelop/src/Main/Base/Services/File/DefaultFileService.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Services/File/DefaultFileService.cs 2004-03-24 18:33:30 UTC (rev 1236)
+++ trunk/MonoDevelop/src/Main/Base/Services/File/DefaultFileService.cs 2004-03-25 05:16:45 UTC (rev 1237)
@@ -19,6 +19,8 @@
using MonoDevelop.Gui;
using MonoDevelop.Core.AddIns.Codons;
+using MonoDevelop.Gui.Utils;
+
namespace MonoDevelop.Services
{
public class DefaultFileService : AbstractService, IFileService
@@ -136,7 +138,13 @@
}
} else {
try {
- Gnome.Url.Show ("file://" + fileName);
+ string mimetype = Vfs.GetMimeType (fileName);
+ Console.WriteLine ("About to MimeApp.Exec on mimetype: " + mimetype);
+ if (mimetype != null) {
+ MimeApplication.Exec (mimetype, fileName);
+ } else {
+ Gnome.Url.Show ("file://" + fileName);
+ }
} catch {
if (fileUtilityService.ObservedLoad(new NamedFileOperationDelegate (new LoadFileWrapper (displayBindingService.LastBinding, null, null).Invoke), fileName) == FileOperationResult.OK) {
fileService.RecentOpen.AddLastFile (fileName);
More information about the Monodevelop-patches-list
mailing list