Author: mhutch
Date: 2007-12-06 20:30:08 -0500 (Thu, 06 Dec 2007)
New Revision: 90883

Added:
   trunk/monodevelop/main/src/addins/GnomePlatform/
   trunk/monodevelop/main/src/addins/GnomePlatform/ChangeLog
   trunk/monodevelop/main/src/addins/GnomePlatform/GnomePlatform.addin.xml
   trunk/monodevelop/main/src/addins/GnomePlatform/GnomePlatform.cs
   trunk/monodevelop/main/src/addins/GnomePlatform/Makefile.am
   trunk/monodevelop/main/src/addins/MacPlatform/
   trunk/monodevelop/main/src/addins/MacPlatform/ChangeLog
   trunk/monodevelop/main/src/addins/MacPlatform/MacPlatform.addin.xml
   trunk/monodevelop/main/src/addins/MacPlatform/MacPlatform.cs
   trunk/monodevelop/main/src/addins/MacPlatform/Makefile.am
Modified:
   trunk/monodevelop/main/ChangeLog
   trunk/monodevelop/main/configure.in
   trunk/monodevelop/main/src/addins/Makefile.am
Log:
Add kangaroo's new platform abstraction layer implementations.


Modified: trunk/monodevelop/main/ChangeLog
===================================================================
--- trunk/monodevelop/main/ChangeLog    2007-12-07 01:27:41 UTC (rev 90882)
+++ trunk/monodevelop/main/ChangeLog    2007-12-07 01:30:08 UTC (rev 90883)
@@ -1,3 +1,18 @@
+2007-12-03  Michael Hutchinson  <[EMAIL PROTECTED]>
+
+       * configure.in: Fix a couple of requirement checks. Add some more 
+         output about which options are enabled.
+
+2007-12-06  Geoff Norton  <[EMAIL PROTECTED]>
+
+       * src/addins/Makefile.am: Add the GnomePlatform and MacPlatform
+         AddIns.
+       * configure.in: Only hard depend on update-*-database if their
+         usage is enabled.  Change the hard dependency on gnome-sharp, 
+         gnome-vfs-sharp, gconf-sharp, to a soft dependency.  Add flags
+         to buld the gnomeplatform and macplatform support.  Default the
+         gnomeplatform to yes and macplatform to no.
+
 2007-12-04  Lluis Sanchez Gual <[EMAIL PROTECTED]> 
 
        * configure.in, src/addins/Makefile.am: Moved SourceEditor2 back to 
main.

Modified: trunk/monodevelop/main/configure.in
===================================================================
--- trunk/monodevelop/main/configure.in 2007-12-07 01:27:41 UTC (rev 90882)
+++ trunk/monodevelop/main/configure.in 2007-12-07 01:30:08 UTC (rev 90883)
@@ -21,15 +21,31 @@
 AC_SUBST(LD_LIBRARY_PATH)
 
 dnl Add MD's mimetypes to mime and desktop databases
-AC_PATH_PROG(UPDATE_MIME_DB, update-mime-database, no)
-if test "x$UPDATE_MIME_DB" = "xno"; then
-   AC_MSG_ERROR([You need to install update-mime-database])
+AC_ARG_ENABLE(update-mimedb,
+   AC_HELP_STRING([--disable-update-mimedb],
+                   [disable the update-mime-database after install 
[default=no]]),,
+    enable_update_mimedb=yes)
+ AM_CONDITIONAL(ENABLE_UPDATE_MIMEDB, test x$enable_update_mimedb = xyes)
+
+if test "x$enable_update_mimedb" = "xyes"; then
+  AC_PATH_PROG(UPDATE_MIME_DB, update-mime-database, no)
+  if test "x$UPDATE_MIME_DB" = "xno"; then
+    AC_MSG_ERROR([You need to install update-mime-database])
+  fi
 fi
 AC_SUBST(UPDATE_MIME_DB)
 
-AC_PATH_PROG(UPDATE_DESKTOP_DB, update-desktop-database, no)
-if test "x$UPDATE_DESKTOP_DB" = "xno"; then
-   AC_MSG_ERROR([You need to install update-desktop-database])
+AC_ARG_ENABLE(update-desktopdb,
+   AC_HELP_STRING([--disable-update-desktopdb],
+                  [disable the update-desktop-database after install 
[default=np]]),,
+                  enable_update_desktopdb=yes)
+   AM_CONDITIONAL(ENABLE_UPDATE_DESKTOPDB, test x$enable_update_desktopdb = 
xyes)
+
+if test "x$enable_update_desktopdb" = "xyes"; then
+  AC_PATH_PROG(UPDATE_DESKTOP_DB, update-desktop-database, no)
+  if test "x$UPDATE_DESKTOP_DB" = "xno"; then
+    AC_MSG_ERROR([You need to install update-desktop-database])
+  fi
 fi
 AC_SUBST(UPDATE_DESKTOP_DB)
 
@@ -90,23 +106,28 @@
 AC_SUBST(GLIB_SHARP_LIBS)
 PKG_CHECK_MODULES(GTK_SHARP, gtk-sharp-2.0 >= $GTKSHARP_REQUIRED_VERSION)
 AC_SUBST(GTK_SHARP_LIBS)
-PKG_CHECK_MODULES(GNOME_SHARP, gnome-sharp-2.0 >= $GTKSHARP_REQUIRED_VERSION)
-AC_SUBST(GNOME_SHARP_LIBS)
-PKG_CHECK_MODULES(GNOME_VFS_SHARP, gnome-vfs-sharp-2.0 >= 
$GTKSHARP_REQUIRED_VERSION)
-AC_SUBST(GNOME_VFS_SHARP_LIBS)
 PKG_CHECK_MODULES(GLADE_SHARP, glade-sharp-2.0 >= $GTKSHARP_REQUIRED_VERSION)
 AC_SUBST(GLADE_SHARP_LIBS)
-PKG_CHECK_MODULES(GCONF_SHARP, gconf-sharp-2.0 >= $GTKSHARP_REQUIRED_VERSION)
-AC_SUBST(GCONF_SHARP_LIBS)
-PKG_CHECK_MODULES(GTKHTML_SHARP, gtkhtml-sharp-2.0 >= 
$GTKSHARP_REQUIRED_VERSION)
-AC_SUBST(GTKHTML_SHARP_LIBS)
-PKG_CHECK_MODULES(GECKO_SHARP, gecko-sharp-2.0 >= $GECKOSHARP_REQUIRED_VERSION)
-AC_SUBST(GECKO_SHARP_LIBS)
+
 PKG_CHECK_MODULES(MONODOC, monodoc >= $MONODOC_REQUIRED_VERSION)
 AC_SUBST(MONODOC_LIBS)
 PKG_CHECK_MODULES(MONO_CAIRO, mono-cairo >= 1.2)
 AC_SUBST(MONO_CAIRO_LIBS)
 
+dnl soft dependencies
+PKG_CHECK_MODULES(GNOME_SHARP, gnome-sharp-2.0 >= $GTKSHARP_REQUIRED_VERSION, 
[gnome_sharp=yes], [gnome_sharp=no])
+AC_SUBST(GNOME_SHARP_LIBS)
+AM_CONDITIONAL(HAVE_GNOME_SHARP, test x$gnome_sharp = xyes)
+PKG_CHECK_MODULES(GNOME_VFS_SHARP, gnome-vfs-sharp-2.0 >= 
$GTKSHARP_REQUIRED_VERSION, [gnome_vfs_sharp=yes], [gnome_vfs_sharp=no])
+AC_SUBST(GNOME_VFS_SHARP_LIBS)
+AM_CONDITIONAL(HAVE_GNOME_VFS_SHARP, test x$gnome_vfs_sharp = xyes)
+PKG_CHECK_MODULES(GCONF_SHARP, gconf-sharp-2.0 >= $GTKSHARP_REQUIRED_VERSION, 
[gconf_sharp=yes], [gconf_sharp=no])
+AC_SUBST(GCONF_SHARP_LIBS)
+AM_CONDITIONAL(HAVE_GCONF_SHARP, test x$gconf_sharp = xyes)
+PKG_CHECK_MODULES(GECKO_SHARP, gecko-sharp-2.0 >= 
$GECKOSHARP_REQUIRED_VERSION, [gecko_sharp=yes], [gecko_sharp=no])
+AC_SUBST(GECKO_SHARP_LIBS)
+AM_CONDITIONAL(HAVE_GECKO_SHARP, test x$gecko_sharp = xyes)
+
 gtksharp_prefix="`$PKG_CONFIG --variable=prefix gtk-sharp-2.0`"
 AC_SUBST(gtksharp_prefix)
 
@@ -144,10 +165,49 @@
 AC_ARG_ENABLE(subversion,
        AC_HELP_STRING([--enable-subversion],
                [enable Subversion support [default=yes]]),
-               enable_versioncontrol=${enableval}, enable_subversion=yes)
+               enable_subversion=${enableval}, 
enable_subversion=${enable_versioncontrol})
 
+if test x$enable_versioncontrol = xno && test x$enable_subversion = xyes; then
+       AC_MSG_ERROR([Subversion addin cannot be built without Version Control 
addin])
+fi
+
 AM_CONDITIONAL(ENABLE_SUBVERSION, test x$enable_subversion = xyes)
 
+platform_bindings=""
+
+# Gnome platform addin
+AC_ARG_ENABLE(gnomeplatform,
+       AC_HELP_STRING([--enable-gnomeplatform],
+               [enable Gnome platform support [default=yes]]),
+               enable_gnomeplatform=${enableval}, enable_gnomeplatform=yes)
+
+if test x$enable_gnomeplatform = xyes; then
+       if test x$gnome_sharp = xno; then
+               AC_MSG_ERROR([Cannot enable GNOME platform without 
gnome-sharp-2.0])
+       fi
+       if test x$gnome_vfs_sharp = xno; then
+               AC_MSG_ERROR([Cannot enable GNOME platform without 
gnome-vfs-sharp-2.0])
+       fi
+       if test x$gconf_sharp = xno; then
+               AC_MSG_ERROR([Cannot enable GNOME platform without 
gconf-sharp-2.0])
+       fi
+       platform_bindings="${platform_bindings}GNOME "
+fi
+
+AM_CONDITIONAL(ENABLE_GNOMEPLATFORM, [test x$enable_gnomeplatform = xyes])
+
+# Mac platform addin
+AC_ARG_ENABLE(macplatform,
+       AC_HELP_STRING([--enable-macplatform],
+               [enable Mac platform support [default=no]]),
+               enable_macplatform=${enableval}, enable_macplatform=no)
+
+if test x$enable_macplatform = xyes; then
+       platform_bindings="${platform_bindings}Mac "
+fi
+
+AM_CONDITIONAL(ENABLE_MACPLATFORM, [test x$enable_macplatform = xyes])
+
 # ASP.NET project addin
 AC_ARG_ENABLE(aspnet,
        AC_HELP_STRING([--enable-aspnet],
@@ -156,19 +216,6 @@
 
 AM_CONDITIONAL(ENABLE_ASPNET, [test x$enable_aspnet = xyes]) 
 
-# Optional Mozilla dependency
-AC_ARG_ENABLE(geckosharp,
-       AC_HELP_STRING([--enable-geckosharp],
-               [enable GeckoSharp Mozilla support [default=yes]]),
-               enable_geckosharp=${enableval}, enable_geckosharp=yes)
-
-if test "x$enable_geckosharp" = "xyes"; then
-       PKG_CHECK_MODULES(GECKO_SHARP, gecko-sharp-2.0 >= 
$GECKOSHARP_REQUIRED_VERSION)
-       AC_SUBST(GECKO_SHARP_LIBS)
-fi
-
-AM_CONDITIONAL(ENABLE_GECKOSHARP, [test x$enable_geckosharp = xyes])
-
 #We need to know where Mozilla is for launch scripts and possible for 
AspNetEdit
 #Check pkg-config first
 MOZILLA_HOME="`$PKG_CONFIG --variable=libdir mozilla-gtkmozembed`"
@@ -209,29 +256,34 @@
        MOZILLA_HOME=`find_libgtkembedmoz`
 fi
 
+# Optional Mozilla dependency
+AC_ARG_ENABLE(geckobrowser,
+       AC_HELP_STRING([--enable-geckobrowser],
+               [enable Gecko Mozilla browser support [default=yes]]),
+               enable_geckobrowser=${enableval}, enable_geckobrowser=yes)
+
+if test "x$enable_geckobrowser" = "xyes"; then
+       if test x$gecko_sharp = xno; then
+               AC_MSG_ERROR([Cannot enable Gecko Browser addin without 
gecko-sharp-2.0])
+       fi
+       if test -z "$MOZILLA_HOME"; then
+               AC_MSG_ERROR([Cannot enable Gecko Browser, as Mozilla library 
directory was not detected. You can set MOZILLA_FIVE_HOME to assist the 
search.])
+       fi
+fi
+
 if test -z "$MOZILLA_HOME"; then
        MOZILLA_HOME=
-       AC_MSG_WARN([Cannot detect Mozilla library directory. WelcomePage addin 
may not be able to function.])
+       AC_MSG_WARN([Cannot detect Mozilla library directory. Some addins may 
not be able to function.])
 fi
-       
+
+AM_CONDITIONAL(ENABLE_GECKOBROWSER, [test x$enable_geckobrowser = xyes])
+
 AC_SUBST(MOZILLA_HOME)
 
 # C/C++ project addin
 AC_ARG_ENABLE(c, AC_HELP_STRING([--enable-c], [enable C/C++ project support 
[default=yes]]), enable_c=${enableval}, enable_c=yes)
 AM_CONDITIONAL(ENABLE_C, [test x$enable_c = xyes])
 
-AC_ARG_ENABLE(update-mimedb,
-   AC_HELP_STRING([--disable-update-mimedb],
-                   [disable the update-mime-database after install 
[default=no]]),,
-    enable_update_mimedb=yes)
- AM_CONDITIONAL(ENABLE_UPDATE_MIMEDB, test x$enable_update_mimedb = xyes)
-
-AC_ARG_ENABLE(update-desktopdb,
-   AC_HELP_STRING([--disable-update-desktopdb],
-                  [disable the update-desktop-database after install 
[default=np]]),,
-                  enable_update_desktopdb=yes)
-   AM_CONDITIONAL(ENABLE_UPDATE_DESKTOPDB, test x$enable_update_desktopdb = 
xyes)
-
 dnl Intl
 ALL_LINGUAS="cs da de es fr ja pt_BR tr pl it zh_TW zh_CN ru sl_SI ca gl pt sv"
 GETTEXT_PACKAGE=monodevelop
@@ -256,6 +308,10 @@
 AC_SUBST(MD_ADDIN_DIR)
 AC_SUBST(MD_DIR)
 
+if test -z "$platform_bindings"; then
+       AC_MSG_ERROR([You must enable one of the platform bindings])
+fi
+
 AC_OUTPUT([
 build/data/Makefile
 build/data/resources/css/Makefile
@@ -323,6 +379,8 @@
 src/addins/GeckoWebBrowser/Makefile
 src/addins/SourceEditor2/AssemblyInfo.cs
 src/addins/SourceEditor2/Makefile
+src/addins/GnomePlatform/Makefile
+src/addins/MacPlatform/Makefile
 Makefile
 monodevelop
 mdtool
@@ -346,4 +404,6 @@
 echo "   * Web References: yes"
 echo "   * C/C++ project support: $enable_c"
 echo "   * GtkSourceView2: $enable_gtksourceview2"
+echo "   * Gecko Browser: $enable_geckobrowser"
+echo "   * Platform bindings: $platform_bindings"
 echo ""


Property changes on: trunk/monodevelop/main/src/addins/GnomePlatform
___________________________________________________________________
Name: svn:ignore
   + Makefile
Makefile.in


Added: trunk/monodevelop/main/src/addins/GnomePlatform/ChangeLog
===================================================================
--- trunk/monodevelop/main/src/addins/GnomePlatform/ChangeLog   2007-12-07 
01:27:41 UTC (rev 90882)
+++ trunk/monodevelop/main/src/addins/GnomePlatform/ChangeLog   2007-12-07 
01:30:08 UTC (rev 90883)
@@ -0,0 +1,3 @@
+2007-12-06  Geoff Norton  <[EMAIL PROTECTED]>
+
+       * Initial check-in for the Gnome backend to the PlatformService

Added: trunk/monodevelop/main/src/addins/GnomePlatform/GnomePlatform.addin.xml
===================================================================
--- trunk/monodevelop/main/src/addins/GnomePlatform/GnomePlatform.addin.xml     
2007-12-07 01:27:41 UTC (rev 90882)
+++ trunk/monodevelop/main/src/addins/GnomePlatform/GnomePlatform.addin.xml     
2007-12-07 01:30:08 UTC (rev 90883)
@@ -0,0 +1,23 @@
+<Addin id          = "GnomePlatform"
+       namespace   = "MonoDevelop"
+       name        = "GGNOME Platform Support"
+       author      = "Geoff Norton"
+       copyright   = "MIT X11"
+       url         = "http://monodevelop.com/";
+       description = "GNOME Platform Support for MonoDevelop"
+       category    = "Platform Support"
+       version     = "0.17.0">
+       
+       <Runtime>
+               <Import assembly="GnomePlatform.dll"/>
+       </Runtime>
+
+       <Dependencies>
+               <Addin id="Core" version="0.17.0"/>
+       </Dependencies>
+       
+       <Extension path = "/MonoDevelop/Core/PlatformService">
+               <Class id      = "PlatformService"
+                      class   = "MonoDevelop.Platform.GnomePlatform"/>
+       </Extension>
+</Addin>

Added: trunk/monodevelop/main/src/addins/GnomePlatform/GnomePlatform.cs
===================================================================
--- trunk/monodevelop/main/src/addins/GnomePlatform/GnomePlatform.cs    
2007-12-07 01:27:41 UTC (rev 90882)
+++ trunk/monodevelop/main/src/addins/GnomePlatform/GnomePlatform.cs    
2007-12-07 01:30:08 UTC (rev 90883)
@@ -0,0 +1,92 @@
+//
+// GnomePlatform.cs
+//
+// Author:
+//   Geoff Norton  <[EMAIL PROTECTED]>
+//
+// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
+// 
+// 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.IO;
+using System.Collections;
+using System.Diagnostics;
+using System.Text.RegularExpressions;
+using System.Runtime.InteropServices;
+
+using MonoDevelop.Core;
+using Gnome;
+using Gnome.Vfs;
+
+namespace MonoDevelop.Platform
+{
+       public class GnomePlatform : PlatformService
+       {
+               Gnome.ThumbnailFactory thumbnailFactory = new 
Gnome.ThumbnailFactory (Gnome.ThumbnailSize.Normal);
+               Gnome.IconLookupResultFlags result;
+
+               static GnomePlatform () {
+                       Gnome.Vfs.Vfs.Initialize ();
+               }
+
+               public override DesktopApplication GetDefaultApplication 
(string mimeType) {
+                       MimeApplication app = Mime.GetDefaultApplication 
(mimeType);
+                       if (app != null)
+                               return (DesktopApplication) 
Marshal.PtrToStructure (app.Handle, typeof(DesktopApplication));
+                       else
+                               return new DesktopApplication ();
+               }
+               
+               public override DesktopApplication [] GetAllApplications 
(string mimeType) {
+                       MimeApplication[] apps = Mime.GetAllApplications 
(mimeType);
+                       ArrayList list = new ArrayList ();
+                       foreach (MimeApplication app in apps) {
+                               DesktopApplication dap = (DesktopApplication) 
Marshal.PtrToStructure (app.Handle, typeof(DesktopApplication));
+                               list.Add (dap);
+                       }
+                       return (DesktopApplication[]) list.ToArray 
(typeof(DesktopApplication));
+               }
+
+               public override string GetDescription (string mt) {
+                       return Mime.GetDescription (mt);
+               }
+
+               public override string GetMimeTypeForUri (string uri)
+               {
+                       return Gnome.Vfs.MimeType.GetMimeTypeForUri (uri);
+               }
+
+               public override void ShowUrl (string url)
+               {
+                       Gnome.Url.Show (url);
+               }
+               
+               public override string DefaultMonospaceFont {
+                       get { return (string) (new GConf.Client ().Get 
("/desktop/gnome/interface/monospace_font_name")); }
+               }
+               
+               public override string IconForFile (string filename)
+               {
+                       return Gnome.Icon.LookupSync (IconTheme.Default, 
thumbnailFactory, filename, null, Gnome.IconLookupFlags.None, out result);
+               }
+       }
+}

Added: trunk/monodevelop/main/src/addins/GnomePlatform/Makefile.am
===================================================================
--- trunk/monodevelop/main/src/addins/GnomePlatform/Makefile.am 2007-12-07 
01:27:41 UTC (rev 90882)
+++ trunk/monodevelop/main/src/addins/GnomePlatform/Makefile.am 2007-12-07 
01:30:08 UTC (rev 90883)
@@ -0,0 +1,34 @@
+
+ADDIN_BUILD = $(top_builddir)/build/AddIns
+ASSEMBLY = $(ADDIN_BUILD)/GnomePlatform.dll
+REFS =  \
+       -r:$(top_builddir)/build/bin/MonoDevelop.Core.dll \
+       -pkg:gnome-sharp-2.0 \
+       -pkg:gconf-sharp-2.0 \
+       -r:System
+
+FILES =  \
+       GnomePlatform.cs
+
+RES =  \
+       GnomePlatform.addin.xml
+
+if ENABLE_GNOMEPLATFORM
+all: $(ASSEMBLY)
+else
+all:
+endif
+
+$(ASSEMBLY): $(FILES)
+       mkdir -p $(ADDIN_BUILD)
+       $(CSC) $(CSC_FLAGS) $(REFS) $(build_resources:%=/resource:%) 
$(build_sources) -out:$@ -target:library
+
+if ENABLE_GNOMEPLATFORM
+assemblydir = $(MD_ADDIN_DIR)/GnomePlatform
+assembly_DATA = $(ASSEMBLY)
+endif
+
+CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb
+EXTRA_DIST = $(FILES) $(RES)
+
+include $(top_srcdir)/Makefile.include


Property changes on: trunk/monodevelop/main/src/addins/MacPlatform
___________________________________________________________________
Name: svn:ignore
   + Makefile
Makefile.in


Added: trunk/monodevelop/main/src/addins/MacPlatform/ChangeLog
===================================================================
--- trunk/monodevelop/main/src/addins/MacPlatform/ChangeLog     2007-12-07 
01:27:41 UTC (rev 90882)
+++ trunk/monodevelop/main/src/addins/MacPlatform/ChangeLog     2007-12-07 
01:30:08 UTC (rev 90883)
@@ -0,0 +1,4 @@
+2007-12-06  Geoff Norton  <[EMAIL PROTECTED]>
+       
+       * Initial check in of the Mac PlatformService that provides
+       Mac equivalents to the Gnome calls in Gnome.Vfs

Added: trunk/monodevelop/main/src/addins/MacPlatform/MacPlatform.addin.xml
===================================================================
--- trunk/monodevelop/main/src/addins/MacPlatform/MacPlatform.addin.xml 
2007-12-07 01:27:41 UTC (rev 90882)
+++ trunk/monodevelop/main/src/addins/MacPlatform/MacPlatform.addin.xml 
2007-12-07 01:30:08 UTC (rev 90883)
@@ -0,0 +1,23 @@
+<Addin id          = "MacPlatform"
+       namespace   = "MonoDevelop"
+       name        = "MonoDevelop Mac Platform Support"
+       author      = "Geoff Norton"
+       copyright   = "MIT X11"
+       url         = "http://blog.sublimeintervention.com/";
+       description = "Mac Platform Support for MonoDevelop"
+       category    = "IDE extensions"
+       version     = "0.17.0">
+       
+       <Runtime>
+               <Import assembly="MacPlatform.dll"/>
+       </Runtime>
+
+       <Dependencies>
+           <Addin id="Core" version="0.17.0"/>
+       </Dependencies>
+       
+       <Extension path = "/MonoDevelop/Core/PlatformService">
+               <Class id      = "PlatformService"
+                      class   = "MonoDevelop.Platform.MacPlatform"/>
+       </Extension>
+</Addin>

Added: trunk/monodevelop/main/src/addins/MacPlatform/MacPlatform.cs
===================================================================
--- trunk/monodevelop/main/src/addins/MacPlatform/MacPlatform.cs        
2007-12-07 01:27:41 UTC (rev 90882)
+++ trunk/monodevelop/main/src/addins/MacPlatform/MacPlatform.cs        
2007-12-07 01:30:08 UTC (rev 90883)
@@ -0,0 +1,100 @@
+//
+// MacPlatform.cs
+//
+// Author:
+//   Geoff Norton  <[EMAIL PROTECTED]>
+//
+// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
+//
+// 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.IO;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Text.RegularExpressions;
+
+using MonoDevelop.Core;
+
+namespace MonoDevelop.Platform
+{
+       public class MacPlatform : PlatformService
+       {
+               static Dictionary<string, string> mimemap;
+
+               static MacPlatform () {
+                       mimemap = new Dictionary<string, string> ();
+                       LoadMimeMap ();
+               }
+
+               public override DesktopApplication GetDefaultApplication 
(string mimetype) {
+                       return new DesktopApplication ();
+               }
+               
+               public override DesktopApplication [] GetAllApplications 
(string mimetype) {
+                       return new DesktopApplication [] {new 
DesktopApplication ()};
+               }
+
+               public override string GetDescription (string mt) {
+                       return "";
+               }
+
+               public override string GetMimeTypeForUri (string uri)
+               {
+                       FileInfo file = new FileInfo (uri);
+                       
+                       if (mimemap.ContainsKey (file.Extension))
+                               return mimemap [file.Extension];
+
+                       return base.GetMimeTypeForUri (uri);
+               }
+
+               public override void ShowUrl (string url)
+               {
+                       Process.Start (url);
+               }
+
+               public override string DefaultMonospaceFont {
+                       get { return "Bitstream Vera Serif"; }
+               }
+               
+               public override string IconForFile (string filename)
+               {
+                       return "gnome-fs-regular";
+               }
+
+               private static void LoadMimeMap () {
+                       // All recent Macs should have this file; if not we'll 
just die silently
+                       try {
+                               StreamReader reader = new StreamReader 
(File.OpenRead ("/etc/apache2/mime.types"));
+                               Regex mime = new Regex 
("([a-zA-Z]+/[a-zA-z0-9+-_.]+)\t+([a-zA-Z]+)");
+                               string line;
+                               while ((line = reader.ReadLine ()) != null) {
+                                       Match m = mime.Match (line);
+                                       if (m.Success)
+                                               mimemap ["." + m.Groups 
[2].Captures [0].Value] = m.Groups [1].Captures [0].Value; 
+                               }
+                       } catch (Exception ex){
+                               MonoDevelop.Core.LoggingService.LogError 
("Could not load Apache mime database", ex);
+                       }
+               }
+       }
+}

Added: trunk/monodevelop/main/src/addins/MacPlatform/Makefile.am
===================================================================
--- trunk/monodevelop/main/src/addins/MacPlatform/Makefile.am   2007-12-07 
01:27:41 UTC (rev 90882)
+++ trunk/monodevelop/main/src/addins/MacPlatform/Makefile.am   2007-12-07 
01:30:08 UTC (rev 90883)
@@ -0,0 +1,32 @@
+
+ADDIN_BUILD = $(top_builddir)/build/AddIns
+ASSEMBLY = $(ADDIN_BUILD)/MacPlatform.dll
+REFS =  \
+       -r:$(top_builddir)/build/bin/MonoDevelop.Core.dll \
+       -r:System
+
+FILES =  \
+       MacPlatform.cs
+
+RES =  \
+       MacPlatform.addin.xml
+
+if ENABLE_MACPLATFORM
+all: $(ASSEMBLY)
+else
+all:
+endif
+
+$(ASSEMBLY): $(FILES)
+       mkdir -p $(ADDIN_BUILD)
+       $(CSC) $(CSC_FLAGS) $(REFS) $(build_resources:%=/resource:%) 
$(build_sources) -out:$@ -target:library
+
+if ENABLE_MACPLATFORM
+assemblydir = $(MD_ADDIN_DIR)/MacPlatform
+assembly_DATA = $(ASSEMBLY)
+endif
+
+CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb
+EXTRA_DIST = $(FILES) $(RES)
+
+include $(top_srcdir)/Makefile.include

Modified: trunk/monodevelop/main/src/addins/Makefile.am
===================================================================
--- trunk/monodevelop/main/src/addins/Makefile.am       2007-12-07 01:27:41 UTC 
(rev 90882)
+++ trunk/monodevelop/main/src/addins/Makefile.am       2007-12-07 01:30:08 UTC 
(rev 90883)
@@ -1,2 +1,2 @@
 
-SUBDIRS = MonoDevelop.DesignerSupport Deployment MonoDevelop.SourceEditor 
SourceEditor2 MonoDevelop.Autotools MonoDevelop.Gettext CSharpBinding 
ILAsmBinding NUnit MonoDeveloperExtensions VersionControl VBNetBinding 
prj2make-sharp-lib WelcomePage ChangeLogAddIn MonoDevelop.GtkCore AspNetAddIn 
MonoDevelop.WebReferences MonoDevelop.RegexToolkit CBinding GeckoWebBrowser
+SUBDIRS = MacPlatform GnomePlatform MonoDevelop.DesignerSupport Deployment 
MonoDevelop.SourceEditor SourceEditor2 MonoDevelop.Autotools 
MonoDevelop.Gettext CSharpBinding ILAsmBinding NUnit MonoDeveloperExtensions 
VersionControl VBNetBinding prj2make-sharp-lib WelcomePage ChangeLogAddIn 
MonoDevelop.GtkCore AspNetAddIn MonoDevelop.WebReferences 
MonoDevelop.RegexToolkit CBinding GeckoWebBrowser

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to