diff --git a/Source/Addins/MonoDevelop.GtkSharp.Addin/GladeDesktopApplication.cs b/Source/Addins/MonoDevelop.GtkSharp.Addin/GladeDesktopApplication.cs index 6565857ef..411f7651a 100755 --- a/Source/Addins/MonoDevelop.GtkSharp.Addin/GladeDesktopApplication.cs +++ b/Source/Addins/MonoDevelop.GtkSharp.Addin/GladeDesktopApplication.cs @@ -1,30 +1,15 @@ using System; +using System.Collections.Generic; using System.Diagnostics; -using System.IO; -using Microsoft.Win32; +using System.Text; +using DBus; +using MonoDevelop.Ide.Commands; using MonoDevelop.Ide.Desktop; namespace MonoDevelop.GtkSharp.Addin { public class GladeDesktopApplication : DesktopApplication { - private static readonly string s_unixgladeapp; - - static GladeDesktopApplication() - { - try - { - var assembly = typeof(GladeDesktopApplication).Assembly.Location; - var gladesh = Path.Combine(Path.GetDirectoryName(assembly), "glade.sh"); - - s_unixgladeapp = "-c '" + File.ReadAllText(gladesh) + "'"; - } - catch (Exception ex) - { - Console.WriteLine(ex); - } - } - private readonly string _filename; public GladeDesktopApplication(string filename) : base("GladeApp", "Glade", true) @@ -36,25 +21,28 @@ namespace MonoDevelop.GtkSharp.Addin { try { - var process = new Process(); - - if (Environment.OSVersion.Platform == PlatformID.Win32NT) + if (Environment.OSVersion.Platform != PlatformID.Win32NT) { - var location = Registry.GetValue(@"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\GNOME Foundation Glade Interface Designer", "InstallLocation", ""); - if (location != null) + var bus = Bus.Session.GetObject("org.freedesktop.Flatpak", new ObjectPath("/org/freedesktop/Flatpak/Development")); + + if (bus != null) { - process.StartInfo.FileName = Path.Combine(location.ToString(), "bin", "glade.exe"); - process.StartInfo.Arguments = _filename; + var pid = bus.HostCommand( + new byte[0], + new byte[][] { + Encoding.ASCII.GetBytes ("xdg-open\0"), + Encoding.ASCII.GetBytes (_filename + "\0") + }, + new Dictionary { }, + new Dictionary { }, + 0 + ); + + return; } } - else - { - process.StartInfo.FileName = "bash"; - process.StartInfo.Arguments = s_unixgladeapp.Replace("$@", _filename); - } - if (!string.IsNullOrEmpty(process.StartInfo.FileName)) - process.Start(); + Process.Start(_filename); } catch (Exception ex) { diff --git a/Source/Addins/MonoDevelop.GtkSharp.Addin/MonoDevelop.GtkSharp.Addin.csproj b/Source/Addins/MonoDevelop.GtkSharp.Addin/MonoDevelop.GtkSharp.Addin.csproj old mode 100755 new mode 100644 index 0174f669a..cabcbf834 --- a/Source/Addins/MonoDevelop.GtkSharp.Addin/MonoDevelop.GtkSharp.Addin.csproj +++ b/Source/Addins/MonoDevelop.GtkSharp.Addin/MonoDevelop.GtkSharp.Addin.csproj @@ -1,5 +1,6 @@ + Debug AnyCPU @@ -36,19 +37,6 @@ - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - PreserveNewest @@ -76,21 +64,25 @@ PreserveNewest - + + PreserveNewest - - glade.sh + PreserveNewest - - + + + References\dbus-sharp.dll + + + diff --git a/Source/Addins/MonoDevelop.GtkSharp.Addin/MonoDevelop.GtkSharp.Addin.sln b/Source/Addins/MonoDevelop.GtkSharp.Addin/MonoDevelop.GtkSharp.Addin.sln new file mode 100644 index 000000000..cf3f93e71 --- /dev/null +++ b/Source/Addins/MonoDevelop.GtkSharp.Addin/MonoDevelop.GtkSharp.Addin.sln @@ -0,0 +1,17 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoDevelop.GtkSharp.Addin", "MonoDevelop.GtkSharp.Addin.csproj", "{52AC8491-F6B7-4631-92BA-D5E95A091B74}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {52AC8491-F6B7-4631-92BA-D5E95A091B74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {52AC8491-F6B7-4631-92BA-D5E95A091B74}.Debug|Any CPU.Build.0 = Debug|Any CPU + {52AC8491-F6B7-4631-92BA-D5E95A091B74}.Release|Any CPU.ActiveCfg = Release|Any CPU + {52AC8491-F6B7-4631-92BA-D5E95A091B74}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/Source/Addins/MonoDevelop.GtkSharp.Addin/Properties/AddinInfo.cs b/Source/Addins/MonoDevelop.GtkSharp.Addin/Properties/AddinInfo.cs index daf24d056..f20be4ebc 100755 --- a/Source/Addins/MonoDevelop.GtkSharp.Addin/Properties/AddinInfo.cs +++ b/Source/Addins/MonoDevelop.GtkSharp.Addin/Properties/AddinInfo.cs @@ -7,4 +7,8 @@ using Mono.Addins.Description; [assembly: AddinCategory("IDE extensions")] [assembly: AddinDescription("Provides modern Gtk# file / project templates and glade file integration.")] [assembly: AddinAuthor("cra0zy")] -[assembly: AddinUrl("https://github.com/gtk-sharp/gtk-sharp")] +[assembly: AddinUrl("https://github.com/GtkSharp/GtkSharp")] + +[assembly: AddinDependency("MonoDevelop.Core", MonoDevelop.BuildInfo.Version)] +[assembly: AddinDependency("MonoDevelop.Ide", MonoDevelop.BuildInfo.Version)] +[assembly: AddinDependency("MonoDevelop.DotNetCore", MonoDevelop.BuildInfo.Version)] \ No newline at end of file diff --git a/Source/Addins/MonoDevelop.GtkSharp.Addin/Properties/Manifest.addin.xml b/Source/Addins/MonoDevelop.GtkSharp.Addin/Properties/Manifest.addin.xml index baa20f6fc..2d187ddda 100755 --- a/Source/Addins/MonoDevelop.GtkSharp.Addin/Properties/Manifest.addin.xml +++ b/Source/Addins/MonoDevelop.GtkSharp.Addin/Properties/Manifest.addin.xml @@ -1,20 +1,10 @@ - - - - - - - - - - - - - + + + @@ -35,14 +25,26 @@ - + - - - - - - + + +