Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Hutchinson <mhutchinson@novell.com>2010-11-03 22:52:35 +0300
committerMichael Hutchinson <mhutchinson@novell.com>2010-11-03 22:53:05 +0300
commit43e9688ebeaaee6aa6731af6b2f3483e052fbb2e (patch)
tree35b79171de1e7c346615579ae0fa20fd8e88c599 /main/src/addins/GnomePlatform
parentaf6916cbb04b38ac4f574acb6edaf7034bff6c8d (diff)
[Gnome] Fix build
Diffstat (limited to 'main/src/addins/GnomePlatform')
-rw-r--r--main/src/addins/GnomePlatform/Gio.cs10
-rw-r--r--main/src/addins/GnomePlatform/GnomePlatform.cs16
2 files changed, 17 insertions, 9 deletions
diff --git a/main/src/addins/GnomePlatform/Gio.cs b/main/src/addins/GnomePlatform/Gio.cs
index a60ee2534a..269b090aed 100644
--- a/main/src/addins/GnomePlatform/Gio.cs
+++ b/main/src/addins/GnomePlatform/Gio.cs
@@ -78,6 +78,7 @@ namespace MonoDevelop.Platform {
if (!string.IsNullOrEmpty (name) && !string.IsNullOrEmpty (executable) && !executable.Contains ("monodevelop "))
return new GnomeDesktopApplication (executable, name, defaultApp != null && defaultApp.Id == id);
+ return null;
}
static IntPtr ContentTypeFromMimeType (string mime_type)
@@ -93,7 +94,7 @@ namespace MonoDevelop.Platform {
return content_type;
}
- static DesktopApplication GetDefaultForType (string mime_type)
+ public static DesktopApplication GetDefaultForType (string mime_type)
{
IntPtr content_type = ContentTypeFromMimeType (mime_type);
IntPtr ret = g_app_info_get_default_for_type (content_type, false);
@@ -112,8 +113,11 @@ namespace MonoDevelop.Platform {
var apps = new System.Collections.Generic.List<DesktopApplication> ();
while (l != IntPtr.Zero) {
GList node = (GList) Marshal.PtrToStructure (l, typeof (GList));
- if (node.data != IntPtr.Zero)
- apps.Add (AppFromAppInfoPtr (node.data, def));
+ if (node.data != IntPtr.Zero) {
+ var app = AppFromAppInfoPtr (node.data, def);
+ if (app != null)
+ apps.Add (app);
+ }
l = node.next;
}
g_list_free (ret);
diff --git a/main/src/addins/GnomePlatform/GnomePlatform.cs b/main/src/addins/GnomePlatform/GnomePlatform.cs
index 975ca850db..71a38a1fe8 100644
--- a/main/src/addins/GnomePlatform/GnomePlatform.cs
+++ b/main/src/addins/GnomePlatform/GnomePlatform.cs
@@ -65,7 +65,7 @@ namespace MonoDevelop.Platform
return null;
}
- IEnumerable<DesktopApplication> GetGnomeVfsApplications ()
+ IEnumerable<DesktopApplication> GetGnomeVfsApplications (string mimeType)
{
var def = GetGnomeVfsDefaultApplication (mimeType);
var list = new List<DesktopApplication> ();
@@ -82,8 +82,12 @@ namespace MonoDevelop.Platform
public override IEnumerable<DesktopApplication> GetApplications (string filename)
{
- var mimeType = DesktopService.GetMimeTypeForUri (fileName);
-
+ var mimeType = GetMimeTypeForUri (filename);
+ return GetApplicationsForMimeType (mimeType);
+ }
+
+ IEnumerable<DesktopApplication> GetApplicationsForMimeType (string mimeType)
+ {
if (useGio)
return Gio.GetAllForType (mimeType);
else
@@ -118,8 +122,8 @@ namespace MonoDevelop.Platform
protected override bool OnGetMimeTypeIsText (string mimeType)
{
// If gedit can open the file, this editor also can do it
- foreach (DesktopApplication app in GetAllApplications (mimeType))
- if (app.Command == "gedit")
+ foreach (DesktopApplication app in GetApplicationsForMimeType (mimeType))
+ if (app.Id == "gedit")
return true;
return base.OnGetMimeTypeIsText (mimeType);
}
@@ -347,7 +351,7 @@ namespace MonoDevelop.Platform
class GnomeDesktopApplication : DesktopApplication
{
- public GnomeDesktopApplication (string command, string displayName) : base (command, displayName)
+ public GnomeDesktopApplication (string command, string displayName, bool isDefault) : base (command, displayName, isDefault)
{
}