diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index e011b8e91..d1b569c08 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -5,6 +5,8 @@ on: [push, pull_request]
jobs:
build:
runs-on: ${{ matrix.os }}
+ permissions:
+ packages: write
strategy:
matrix:
os: [ubuntu-20.04]
@@ -24,7 +26,11 @@ jobs:
GITHUB_ACTIONS: true
- uses: actions/upload-artifact@main
with:
- name: Nuget Packages
+ name: NuGet Packages
path: |
BuildOutput/NugetPackages/**/*.nupkg
if-no-files-found: error
+ - name: Push NuGet to GitHub packages
+ run: dotnet nuget push BuildOutput/NugetPackages/**/*.nupkg --source https://nuget.pkg.github.com/$GITHUB_REPOSITORY_OWNER/index.json --api-key ${GITHUB_TOKEN}
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/CakeScripts/TargetEnvironment.cake b/CakeScripts/TargetEnvironment.cake
new file mode 100644
index 000000000..811351fae
--- /dev/null
+++ b/CakeScripts/TargetEnvironment.cake
@@ -0,0 +1,211 @@
+#addin "nuget:?package=Microsoft.Win32.Registry&version=5.0.0"
+using System;
+using D = System.IO.Directory;
+using F = System.IO.File;
+using P = System.IO.Path;
+using Pr = System.Diagnostics.Process;
+using PSI = System.Diagnostics.ProcessStartInfo;
+using R = Microsoft.Win32.Registry;
+using RI = System.Runtime.InteropServices.RuntimeInformation;
+using Z = System.IO.Compression.ZipFile;
+
+class TargetEnvironment
+{
+ public static string DotNetInstallPath { get; private set; }
+ public static string DotNetInstalledWorkloadsMetadataPath { get; private set; }
+ public static string DotNetInstallerTypeMetadataPath { get; private set; }
+ public static string DotNetManifestPath { get; private set; }
+ public static string DotNetPacksPath { get; private set; }
+ public static string DotNetTemplatePacksPath { get; private set; }
+
+ public static string DotNetCliPath { get; private set; }
+ public static string DotNetCliFeatureBand { get; private set; }
+
+ static TargetEnvironment()
+ {
+ DotNetInstallPath = Environment.GetEnvironmentVariable("DOTNET_ROOT");
+ if (DotNetInstallPath == null)
+ {
+ if (OperatingSystem.IsWindows())
+ {
+ DotNetInstallPath = P.Combine(Environment.GetEnvironmentVariable("ProgramFiles"), "dotnet");
+ }
+ else if (OperatingSystem.IsLinux())
+ {
+ DotNetInstallPath = "/usr/share/dotnet";
+ }
+ else if (OperatingSystem.IsMacOS())
+ {
+ DotNetInstallPath = "/usr/local/share/dotnet";
+ }
+ }
+
+ DotNetCliPath = P.Combine(DotNetInstallPath, "dotnet");
+
+ var proc = Pr.Start(new PSI()
+ {
+ FileName = DotNetCliPath,
+ Arguments = "--version",
+ RedirectStandardOutput = true,
+ });
+
+ proc.WaitForExit();
+
+ DotNetCliFeatureBand = proc.StandardOutput.ReadToEnd().Trim();
+ DotNetCliFeatureBand = DotNetCliFeatureBand.Substring(0, DotNetCliFeatureBand.Length - 2) + "00";
+
+ DotNetInstalledWorkloadsMetadataPath = P.Combine(DotNetInstallPath, "metadata", "workloads", DotNetCliFeatureBand, "InstalledWorkloads");
+ DotNetInstallerTypeMetadataPath = P.Combine(DotNetInstallPath, "metadata", "workloads", DotNetCliFeatureBand, "InstallerType");
+ DotNetManifestPath = P.Combine(DotNetInstallPath, "sdk-manifests", DotNetCliFeatureBand);
+ DotNetPacksPath = P.Combine(DotNetInstallPath, "packs");
+ DotNetTemplatePacksPath = P.Combine(DotNetInstallPath, "template-packs");
+ }
+
+ public static void RegisterInstalledWorkload(string workloadName)
+ {
+ D.CreateDirectory(DotNetInstalledWorkloadsMetadataPath);
+ F.WriteAllText(P.Combine(DotNetInstalledWorkloadsMetadataPath, workloadName), string.Empty);
+ if (F.Exists(P.Combine(DotNetInstallerTypeMetadataPath, "msi")))
+ {
+ //HKLM:\SOFTWARE\Microsoft\dotnet\InstalledWorkloads\Standalone\x64\6.0.300\gtk
+
+ // TODO: Check for other Windows architectures (x86 and arm64)
+ var archString = RI.OSArchitecture.ToString().ToLower();
+
+ var hklm = R.LocalMachine;
+ var software = hklm.CreateSubKey("SOFTWARE");
+ var microsoft = software.CreateSubKey("Microsoft");
+ var dotnet = microsoft.CreateSubKey("dotnet");
+ var installedWorkloads = dotnet.CreateSubKey("InstalledWorkloads");
+ var standalone = installedWorkloads.CreateSubKey("Standalone");
+ var arch = standalone.CreateSubKey(archString);
+ var version = arch.CreateSubKey(DotNetCliFeatureBand);
+ var workload = version.CreateSubKey(workloadName);
+
+ workload.Close();
+ version.Close();
+ arch.Close();
+ standalone.Close();
+ installedWorkloads.Close();
+ dotnet.Close();
+ microsoft.Close();
+ software.Close();
+ hklm.Close();
+ }
+ }
+
+ public static void UnregisterInstalledWorkload(string workloadName)
+ {
+ F.Delete(P.Combine(DotNetInstalledWorkloadsMetadataPath, workloadName));
+ if (F.Exists(P.Combine(DotNetInstallerTypeMetadataPath, "msi")))
+ {
+ var archString = RI.OSArchitecture.ToString().ToLower();
+
+ var hklm = R.LocalMachine;
+ var software = hklm.CreateSubKey("SOFTWARE");
+ var microsoft = software.CreateSubKey("Microsoft");
+ var dotnet = microsoft.CreateSubKey("dotnet");
+ var installedWorkloads = dotnet.CreateSubKey("InstalledWorkloads");
+ var standalone = installedWorkloads.CreateSubKey("Standalone");
+ var arch = standalone.CreateSubKey(archString);
+ var version = arch.CreateSubKey(DotNetCliFeatureBand);
+
+ version.DeleteSubKey(workloadName, false);
+
+ version.Close();
+ arch.Close();
+ standalone.Close();
+ installedWorkloads.Close();
+ dotnet.Close();
+ microsoft.Close();
+ software.Close();
+ hklm.Close();
+ }
+ }
+
+ public static void InstallManifests(string manifestName, string manifestPackPath)
+ {
+ var targetDirectory = P.Combine(DotNetManifestPath, manifestName);
+ var tempDirectory = P.Combine(targetDirectory, "temp");
+
+ // Delete existing installations to avoid conflict.
+ if (D.Exists(targetDirectory))
+ {
+ D.Delete(targetDirectory, true);
+ }
+
+ // Also creates the target
+ D.CreateDirectory(tempDirectory);
+
+ Z.ExtractToDirectory(manifestPackPath, tempDirectory);
+ var tempDataDirectory = P.Combine(tempDirectory, "data");
+
+ foreach (var filePath in D.GetFiles(tempDataDirectory))
+ {
+ var targetFilePath = P.Combine(targetDirectory, P.GetFileName(filePath));
+ F.Copy(filePath, targetFilePath, true);
+ }
+
+ D.Delete(tempDirectory, true);
+ }
+
+ public static void UninstallManifests(string manifestName)
+ {
+ var targetDirectory = P.Combine(DotNetManifestPath, manifestName);
+ if (D.Exists(targetDirectory))
+ {
+ D.Delete(targetDirectory, true);
+ }
+ }
+
+ public static void InstallPack(string name, string version, string packPath)
+ {
+ var targetDirectory = P.Combine(DotNetPacksPath, name, version);
+
+ if (D.Exists(targetDirectory))
+ {
+ D.Delete(targetDirectory, true);
+ }
+
+ D.CreateDirectory(targetDirectory);
+
+ Z.ExtractToDirectory(packPath, targetDirectory);
+ }
+
+ public static void UninstallPack(string name, string version)
+ {
+ var packInstallDirectory = P.Combine(DotNetPacksPath, name);
+
+ var targetDirectory = P.Combine(packInstallDirectory, version);
+ if (D.Exists(targetDirectory))
+ {
+ D.Delete(targetDirectory, true);
+ }
+
+ // Clean up the template if no other verions exist.
+ try
+ {
+ D.Delete(packInstallDirectory, false);
+ }
+ catch (System.IO.IOException)
+ {
+ // Silently fail. Mostly because the directory is not empty (there are other verions installed).
+ }
+ }
+
+ public static void InstallTemplatePack(string packName, string packPath)
+ {
+ D.CreateDirectory(DotNetTemplatePacksPath);
+ var targetPath = P.Combine(DotNetTemplatePacksPath, packName);
+ F.Copy(packPath, targetPath, true);
+ }
+
+ public static void UninstallTemplatePack(string packName)
+ {
+ var targetPath = P.Combine(DotNetTemplatePacksPath, packName);
+ if (F.Exists(targetPath))
+ {
+ F.Delete(targetPath);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Source/Directory.Build.props b/Source/Directory.Build.props
new file mode 100644
index 000000000..fa2214edd
--- /dev/null
+++ b/Source/Directory.Build.props
@@ -0,0 +1,12 @@
+
+
+ <_GtkSharpNetVersion>6.0
+ <_GtkSharpSourceDirectory>$(MSBuildThisFileDirectory)
+ <_GtkSharpBuildOutputDirectory>$(MSBuildThisFileDirectory)..\BuildOutput\
+
+
+
+ https://github.com/GtkSharp/GtkSharp
+ https://github.com/GtkSharp/GtkSharp
+
+
\ No newline at end of file
diff --git a/Source/Libs/CairoSharp/Context.cs b/Source/Libs/CairoSharp/Context.cs
index a30c67c3a..cded41d1a 100644
--- a/Source/Libs/CairoSharp/Context.cs
+++ b/Source/Libs/CairoSharp/Context.cs
@@ -737,13 +737,13 @@ public void TransformPoint (ref double x, ref double y)
[Obsolete("Use UserToDeviceDistance instead")]
public void TransformDistance (ref double dx, ref double dy)
{
- UserToDevice (ref dx, ref dy);
+ UserToDeviceDistance (ref dx, ref dy);
}
[Obsolete("Use DeviceToUser instead")]
public void InverseTransformPoint (ref double x, ref double y)
{
- UserToDevice (ref x, ref y);
+ DeviceToUser (ref x, ref y);
}
[Obsolete("Use DeviceToUserDistance instead")]
diff --git a/Source/Libs/Directory.Build.props b/Source/Libs/Directory.Build.props
index 4a9335642..c3762d1ca 100644
--- a/Source/Libs/Directory.Build.props
+++ b/Source/Libs/Directory.Build.props
@@ -1,9 +1,15 @@
+
+
- net6.0;netstandard2.0
+ net$(_GtkSharpNetVersion);netstandard2.0
true
- https://github.com/GtkSharp/GtkSharp
- https://github.com/GtkSharp/GtkSharp
- ..\..\..\BuildOutput\$(Configuration)
+ $(_GtkSharpBuildOutputDirectory)\$(Configuration)
+
+ True
+ $(MSBuildThisFileDirectory)\GtkSharp.snk
\ No newline at end of file
diff --git a/Source/Libs/GLibSharp/GType.cs b/Source/Libs/GLibSharp/GType.cs
index 8fceea7c7..67107f424 100644
--- a/Source/Libs/GLibSharp/GType.cs
+++ b/Source/Libs/GLibSharp/GType.cs
@@ -251,15 +251,15 @@ public static Type LookupType (IntPtr typeid)
// in a patch from bug #400595, and a desire to keep memory usage low
// by avoiding a complete loading of all dependent assemblies.
string ns = type_name.Substring (0, type_name.LastIndexOf ('.'));
- string asm_name = ns.ToLower ().Replace ('.', '-') + "-sharp";
+ string asm_name = ns.Replace (".", "") + "Sharp";
foreach (Assembly asm in assemblies) {
foreach (AssemblyName ref_name in asm.GetReferencedAssemblies ()) {
if (ref_name.Name != asm_name)
continue;
try {
- string asm_dir = Path.GetDirectoryName (asm.Location);
+ string asm_dir = Path.GetDirectoryName (asm.Location); // will be null or empty for single file publish
Assembly ref_asm;
- if (File.Exists (Path.Combine (asm_dir, ref_name.Name + ".dll")))
+ if (!string.IsNullOrEmpty (asm_dir) && File.Exists (Path.Combine (asm_dir, ref_name.Name + ".dll")))
ref_asm = Assembly.LoadFrom (Path.Combine (asm_dir, ref_name.Name + ".dll"));
else
ref_asm = Assembly.Load (ref_name);
diff --git a/Source/Libs/GLibSharp/IOChannel.cs b/Source/Libs/GLibSharp/IOChannel.cs
index b6e7b949f..554a1c244 100644
--- a/Source/Libs/GLibSharp/IOChannel.cs
+++ b/Source/Libs/GLibSharp/IOChannel.cs
@@ -185,14 +185,12 @@ public void Dispose ()
public uint AddWatch (int priority, IOCondition condition, IOFunc func)
{
- IOFuncWrapper func_wrapper = null;
- IntPtr user_data = IntPtr.Zero;
- DestroyNotify notify = null;
- if (func != null) {
- func_wrapper = new IOFuncWrapper (func);
- user_data = (IntPtr) GCHandle.Alloc (func_wrapper);
- notify = DestroyHelper.NotifyHandler;
- }
+ if (func == null)
+ return 0;
+
+ IOFuncWrapper func_wrapper = new IOFuncWrapper (func);
+ IntPtr user_data = (IntPtr) GCHandle.Alloc (func_wrapper);
+ DestroyNotify notify = DestroyHelper.NotifyHandler;
return g_io_add_watch_full (Handle, priority, (int) condition, func_wrapper.NativeDelegate, user_data, notify);
}
diff --git a/Source/Libs/GLibSharp/KeyFile.cs b/Source/Libs/GLibSharp/KeyFile.cs
index ea8f3dda0..515991b34 100644
--- a/Source/Libs/GLibSharp/KeyFile.cs
+++ b/Source/Libs/GLibSharp/KeyFile.cs
@@ -41,7 +41,7 @@ public enum KeyFileFlags {
KeepTranslations = 1 << 1,
}
- public class KeyFile {
+ public class KeyFile : IDisposable {
IntPtr handle;
bool owned;
@@ -65,10 +65,23 @@ public bool Handler ()
{
if (!owned)
return;
+
+ if (handle == IntPtr.Zero)
+ return;
+
FinalizerInfo info = new FinalizerInfo (Handle);
Timeout.Add (50, new TimeoutHandler (info.Handler));
}
+ public void Dispose ()
+ {
+ if (owned && handle != IntPtr.Zero)
+ g_key_file_free (handle);
+
+ handle = IntPtr.Zero;
+ GC.SuppressFinalize (this);
+ }
+
public KeyFile (IntPtr handle) : this (handle, false) {}
public KeyFile (IntPtr handle, bool owned)
@@ -183,6 +196,30 @@ public int GetInteger (string group_name, string key)
return ret;
}
+ public long GetInt64 (string group_name, string key)
+ {
+ IntPtr error;
+ IntPtr native_group_name = Marshaller.StringToPtrGStrdup (group_name);
+ IntPtr native_key = Marshaller.StringToPtrGStrdup (key);
+ long ret = g_key_file_get_int64 (Handle, native_group_name, native_key, out error);
+ Marshaller.Free (native_group_name);
+ Marshaller.Free (native_key);
+ if (error != IntPtr.Zero) throw new GException (error);
+ return ret;
+ }
+
+ public ulong GetUInt64 (string group_name, string key)
+ {
+ IntPtr error;
+ IntPtr native_group_name = Marshaller.StringToPtrGStrdup (group_name);
+ IntPtr native_key = Marshaller.StringToPtrGStrdup (key);
+ ulong ret = g_key_file_get_uint64 (Handle, native_group_name, native_key, out error);
+ Marshaller.Free (native_group_name);
+ Marshaller.Free (native_key);
+ if (error != IntPtr.Zero) throw new GException (error);
+ return ret;
+ }
+
public int[] GetIntegerList (string group_name, string key)
{
IntPtr native_group_name = Marshaller.StringToPtrGStrdup (group_name);
@@ -445,6 +482,24 @@ public void SetInteger (string group_name, string key, int value)
Marshaller.Free (native_key);
}
+ public void SetInt64 (string group_name, string key, long value)
+ {
+ IntPtr native_group_name = Marshaller.StringToPtrGStrdup (group_name);
+ IntPtr native_key = Marshaller.StringToPtrGStrdup (key);
+ g_key_file_set_int64 (Handle, native_group_name, native_key, value);
+ Marshaller.Free (native_group_name);
+ Marshaller.Free (native_key);
+ }
+
+ public void SetUInt64 (string group_name, string key, ulong value)
+ {
+ IntPtr native_group_name = Marshaller.StringToPtrGStrdup (group_name);
+ IntPtr native_key = Marshaller.StringToPtrGStrdup (key);
+ g_key_file_set_uint64 (Handle, native_group_name, native_key, value);
+ Marshaller.Free (native_group_name);
+ Marshaller.Free (native_key);
+ }
+
public void SetIntegerList (string group_name, string key, int[] list)
{
if (list == null)
@@ -540,125 +595,135 @@ public byte[] ToData ()
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate void d_g_key_file_free(IntPtr raw);
- static d_g_key_file_free g_key_file_free = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_key_file_free"));
+ static d_g_key_file_free g_key_file_free = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_free"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate bool d_g_key_file_get_boolean(IntPtr raw, IntPtr group_name, IntPtr key, out IntPtr error);
- static d_g_key_file_get_boolean g_key_file_get_boolean = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_key_file_get_boolean"));
+ static d_g_key_file_get_boolean g_key_file_get_boolean = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_get_boolean"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate IntPtr d_g_key_file_get_boolean_list(IntPtr raw, IntPtr group_name, IntPtr key, out UIntPtr length, out IntPtr error);
- static d_g_key_file_get_boolean_list g_key_file_get_boolean_list = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_key_file_get_boolean_list"));
+ static d_g_key_file_get_boolean_list g_key_file_get_boolean_list = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_get_boolean_list"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate IntPtr d_g_key_file_get_comment(IntPtr raw, IntPtr group_name, IntPtr key, out IntPtr error);
- static d_g_key_file_get_comment g_key_file_get_comment = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_key_file_get_comment"));
+ static d_g_key_file_get_comment g_key_file_get_comment = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_get_comment"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate double d_g_key_file_get_double(IntPtr raw, IntPtr group_name, IntPtr key, out IntPtr error);
- static d_g_key_file_get_double g_key_file_get_double = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_key_file_get_double"));
+ static d_g_key_file_get_double g_key_file_get_double = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_get_double"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate IntPtr d_g_key_file_get_double_list(IntPtr raw, IntPtr group_name, IntPtr key, out UIntPtr length, out IntPtr error);
- static d_g_key_file_get_double_list g_key_file_get_double_list = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_key_file_get_double_list"));
+ static d_g_key_file_get_double_list g_key_file_get_double_list = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_get_double_list"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate IntPtr d_g_key_file_get_groups(IntPtr raw, IntPtr dummy);
- static d_g_key_file_get_groups g_key_file_get_groups = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_key_file_get_groups"));
+ static d_g_key_file_get_groups g_key_file_get_groups = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_get_groups"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate int d_g_key_file_get_integer(IntPtr raw, IntPtr group_name, IntPtr key, out IntPtr error);
- static d_g_key_file_get_integer g_key_file_get_integer = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_key_file_get_integer"));
+ static d_g_key_file_get_integer g_key_file_get_integer = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_get_integer"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate IntPtr d_g_key_file_get_integer_list(IntPtr raw, IntPtr group_name, IntPtr key, out UIntPtr length, out IntPtr error);
- static d_g_key_file_get_integer_list g_key_file_get_integer_list = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_key_file_get_integer_list"));
+ static d_g_key_file_get_integer_list g_key_file_get_integer_list = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_get_integer_list"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate IntPtr d_g_key_file_get_keys(IntPtr raw, IntPtr group_name, IntPtr dummy, out IntPtr error);
- static d_g_key_file_get_keys g_key_file_get_keys = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_key_file_get_keys"));
+ static d_g_key_file_get_keys g_key_file_get_keys = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_get_keys"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate IntPtr d_g_key_file_get_locale_string(IntPtr raw, IntPtr group_name, IntPtr key, IntPtr locale, out IntPtr error);
- static d_g_key_file_get_locale_string g_key_file_get_locale_string = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_key_file_get_locale_string"));
+ static d_g_key_file_get_locale_string g_key_file_get_locale_string = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_get_locale_string"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate IntPtr d_g_key_file_get_locale_string_list(IntPtr raw, IntPtr group_name, IntPtr key, IntPtr locale, IntPtr dummy, out IntPtr error);
- static d_g_key_file_get_locale_string_list g_key_file_get_locale_string_list = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_key_file_get_locale_string_list"));
+ static d_g_key_file_get_locale_string_list g_key_file_get_locale_string_list = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_get_locale_string_list"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate IntPtr d_g_key_file_get_start_group(IntPtr raw);
- static d_g_key_file_get_start_group g_key_file_get_start_group = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_key_file_get_start_group"));
+ static d_g_key_file_get_start_group g_key_file_get_start_group = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_get_start_group"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate IntPtr d_g_key_file_get_string(IntPtr raw, IntPtr group_name, IntPtr key, out IntPtr error);
- static d_g_key_file_get_string g_key_file_get_string = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_key_file_get_string"));
+ static d_g_key_file_get_string g_key_file_get_string = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_get_string"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate IntPtr d_g_key_file_get_string_list(IntPtr raw, IntPtr group_name, IntPtr key, IntPtr dummy, out IntPtr error);
- static d_g_key_file_get_string_list g_key_file_get_string_list = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_key_file_get_string_list"));
+ static d_g_key_file_get_string_list g_key_file_get_string_list = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_get_string_list"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate IntPtr d_g_key_file_get_value(IntPtr raw, IntPtr group_name, IntPtr key, out IntPtr error);
- static d_g_key_file_get_value g_key_file_get_value = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_key_file_get_value"));
+ static d_g_key_file_get_value g_key_file_get_value = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_get_value"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate bool d_g_key_file_has_group(IntPtr raw, IntPtr group_name);
- static d_g_key_file_has_group g_key_file_has_group = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_key_file_has_group"));
+ static d_g_key_file_has_group g_key_file_has_group = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_has_group"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate bool d_g_key_file_has_key(IntPtr raw, IntPtr group_name, IntPtr key, out IntPtr error);
- static d_g_key_file_has_key g_key_file_has_key = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_key_file_has_key"));
+ static d_g_key_file_has_key g_key_file_has_key = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_has_key"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate bool d_g_key_file_load_from_data(IntPtr raw, byte[] data, UIntPtr length, int flags, out IntPtr error);
- static d_g_key_file_load_from_data g_key_file_load_from_data = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_key_file_load_from_data"));
+ static d_g_key_file_load_from_data g_key_file_load_from_data = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_load_from_data"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate bool d_g_key_file_load_from_data_dirs(IntPtr raw, IntPtr file, out IntPtr full_path, int flags, out IntPtr error);
- static d_g_key_file_load_from_data_dirs g_key_file_load_from_data_dirs = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_key_file_load_from_data_dirs"));
+ static d_g_key_file_load_from_data_dirs g_key_file_load_from_data_dirs = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_load_from_data_dirs"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate bool d_g_key_file_load_from_dirs(IntPtr raw, IntPtr file, IntPtr search_dirs, out IntPtr full_path, int flags, out IntPtr error);
- static d_g_key_file_load_from_dirs g_key_file_load_from_dirs = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_key_file_load_from_dirs"));
+ static d_g_key_file_load_from_dirs g_key_file_load_from_dirs = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_load_from_dirs"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate bool d_g_key_file_load_from_file(IntPtr raw, IntPtr file, int flags, out IntPtr error);
- static d_g_key_file_load_from_file g_key_file_load_from_file = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_key_file_load_from_file"));
+ static d_g_key_file_load_from_file g_key_file_load_from_file = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_load_from_file"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate IntPtr d_g_key_file_new();
- static d_g_key_file_new g_key_file_new = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_key_file_new"));
+ static d_g_key_file_new g_key_file_new = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_new"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate bool d_g_key_file_remove_comment(IntPtr raw, IntPtr group_name, IntPtr key, out IntPtr error);
- static d_g_key_file_remove_comment g_key_file_remove_comment = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_key_file_remove_comment"));
+ static d_g_key_file_remove_comment g_key_file_remove_comment = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_remove_comment"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate bool d_g_key_file_remove_group(IntPtr raw, IntPtr group_name, out IntPtr error);
- static d_g_key_file_remove_group g_key_file_remove_group = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_key_file_remove_group"));
+ static d_g_key_file_remove_group g_key_file_remove_group = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_remove_group"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate bool d_g_key_file_remove_key(IntPtr raw, IntPtr group_name, IntPtr key, out IntPtr error);
- static d_g_key_file_remove_key g_key_file_remove_key = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_key_file_remove_key"));
+ static d_g_key_file_remove_key g_key_file_remove_key = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_remove_key"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate void d_g_key_file_set_boolean(IntPtr raw, IntPtr group_name, IntPtr key, bool value);
- static d_g_key_file_set_boolean g_key_file_set_boolean = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_key_file_set_boolean"));
+ static d_g_key_file_set_boolean g_key_file_set_boolean = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_set_boolean"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate void d_g_key_file_set_boolean_list(IntPtr raw, IntPtr group_name, IntPtr key, bool[] list, UIntPtr n_list);
- static d_g_key_file_set_boolean_list g_key_file_set_boolean_list = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_key_file_set_boolean_list"));
+ static d_g_key_file_set_boolean_list g_key_file_set_boolean_list = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_set_boolean_list"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate bool d_g_key_file_set_comment(IntPtr raw, IntPtr group_name, IntPtr key, IntPtr comment, out IntPtr error);
- static d_g_key_file_set_comment g_key_file_set_comment = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_key_file_set_comment"));
+ static d_g_key_file_set_comment g_key_file_set_comment = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_set_comment"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate void d_g_key_file_set_double(IntPtr raw, IntPtr group_name, IntPtr key, double value);
- static d_g_key_file_set_double g_key_file_set_double = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_key_file_set_double"));
+ static d_g_key_file_set_double g_key_file_set_double = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_set_double"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate void d_g_key_file_set_double_list(IntPtr raw, IntPtr group_name, IntPtr key, double[] list, UIntPtr n_list);
- static d_g_key_file_set_double_list g_key_file_set_double_list = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_key_file_set_double_list"));
+ static d_g_key_file_set_double_list g_key_file_set_double_list = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_set_double_list"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate void d_g_key_file_set_integer(IntPtr raw, IntPtr group_name, IntPtr key, int value);
- static d_g_key_file_set_integer g_key_file_set_integer = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_key_file_set_integer"));
+ static d_g_key_file_set_integer g_key_file_set_integer = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_set_integer"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate void d_g_key_file_set_integer_list(IntPtr raw, IntPtr group_name, IntPtr key, int[] list, UIntPtr n_list);
- static d_g_key_file_set_integer_list g_key_file_set_integer_list = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_key_file_set_integer_list"));
+ static d_g_key_file_set_integer_list g_key_file_set_integer_list = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_set_integer_list"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate void d_g_key_file_set_list_separator(IntPtr raw, byte separator);
- static d_g_key_file_set_list_separator g_key_file_set_list_separator = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_key_file_set_list_separator"));
+ static d_g_key_file_set_list_separator g_key_file_set_list_separator = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_set_list_separator"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate void d_g_key_file_set_locale_string(IntPtr raw, IntPtr group_name, IntPtr key, IntPtr locale, IntPtr value);
- static d_g_key_file_set_locale_string g_key_file_set_locale_string = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_key_file_set_locale_string"));
+ static d_g_key_file_set_locale_string g_key_file_set_locale_string = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_set_locale_string"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate void d_g_key_file_set_locale_string_list(IntPtr raw, IntPtr group_name, IntPtr key, IntPtr locale, IntPtr list, UIntPtr length);
- static d_g_key_file_set_locale_string_list g_key_file_set_locale_string_list = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_key_file_set_locale_string_list"));
+ static d_g_key_file_set_locale_string_list g_key_file_set_locale_string_list = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_set_locale_string_list"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate void d_g_key_file_set_string(IntPtr raw, IntPtr group_name, IntPtr key, IntPtr value);
- static d_g_key_file_set_string g_key_file_set_string = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_key_file_set_string"));
+ static d_g_key_file_set_string g_key_file_set_string = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_set_string"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate void d_g_key_file_set_string_list(IntPtr raw, IntPtr group_name, IntPtr key, IntPtr list, UIntPtr n_list);
- static d_g_key_file_set_string_list g_key_file_set_string_list = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_key_file_set_string_list"));
+ static d_g_key_file_set_string_list g_key_file_set_string_list = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_set_string_list"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate void d_g_key_file_set_value(IntPtr raw, IntPtr group_name, IntPtr key, IntPtr value);
- static d_g_key_file_set_value g_key_file_set_value = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_key_file_set_value"));
+ static d_g_key_file_set_value g_key_file_set_value = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_set_value"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate IntPtr d_g_key_file_to_data(IntPtr raw, out UIntPtr length, IntPtr dummy);
- static d_g_key_file_to_data g_key_file_to_data = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_key_file_to_data"));
-
+ static d_g_key_file_to_data g_key_file_to_data = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_to_data"));
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ delegate long d_g_key_file_get_int64(IntPtr raw, IntPtr group_name, IntPtr key, out IntPtr error);
+ static d_g_key_file_get_int64 g_key_file_get_int64 = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_get_int64"));
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ delegate ulong d_g_key_file_get_uint64(IntPtr raw, IntPtr group_name, IntPtr key, out IntPtr error);
+ static d_g_key_file_get_uint64 g_key_file_get_uint64 = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_get_uint64"));
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ delegate void d_g_key_file_set_int64(IntPtr raw, IntPtr group_name, IntPtr key, long value);
+ static d_g_key_file_set_int64 g_key_file_set_int64 = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_set_int64"));
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ delegate void d_g_key_file_set_uint64(IntPtr raw, IntPtr group_name, IntPtr key, ulong value);
+ static d_g_key_file_set_uint64 g_key_file_set_uint64 = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_key_file_set_uint64"));
}
}
-
diff --git a/Source/Libs/GLibSharp/Marshaller.cs b/Source/Libs/GLibSharp/Marshaller.cs
index 449e5b7f3..bb70434da 100644
--- a/Source/Libs/GLibSharp/Marshaller.cs
+++ b/Source/Libs/GLibSharp/Marshaller.cs
@@ -48,15 +48,14 @@ public static void Free (IntPtr[] ptrs)
g_free (ptrs [i]);
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- delegate IntPtr d_g_filename_to_utf8(IntPtr mem, int len, IntPtr read, out IntPtr written, out IntPtr error);
+ delegate IntPtr d_g_filename_to_utf8(IntPtr mem, IntPtr len, IntPtr read, out IntPtr written, out IntPtr error);
static d_g_filename_to_utf8 g_filename_to_utf8 = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_filename_to_utf8"));
public static string FilenamePtrToString (IntPtr ptr)
{
if (ptr == IntPtr.Zero) return null;
- IntPtr dummy, error;
- IntPtr utf8 = g_filename_to_utf8 (ptr, -1, IntPtr.Zero, out dummy, out error);
+ IntPtr utf8 = g_filename_to_utf8 (ptr, (IntPtr)(-1), IntPtr.Zero, out _, out var error);
if (error != IntPtr.Zero)
throw new GLib.GException (error);
@@ -117,7 +116,7 @@ public static string PtrToStringGFree (IntPtr ptr)
return ret;
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- delegate IntPtr d_g_filename_from_utf8(IntPtr mem, int len, IntPtr read, out IntPtr written, out IntPtr error);
+ delegate IntPtr d_g_filename_from_utf8(IntPtr mem, IntPtr len, IntPtr read, out IntPtr written, out IntPtr error);
static d_g_filename_from_utf8 g_filename_from_utf8 = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_filename_from_utf8"));
public static IntPtr StringToFilenamePtr (string str)
@@ -125,9 +124,8 @@ public static IntPtr StringToFilenamePtr (string str)
if (str == null)
return IntPtr.Zero;
- IntPtr dummy, error;
IntPtr utf8 = StringToPtrGStrdup (str);
- IntPtr result = g_filename_from_utf8 (utf8, -1, IntPtr.Zero, out dummy, out error);
+ IntPtr result = g_filename_from_utf8 (utf8, (IntPtr)(-1), IntPtr.Zero, out _, out var error);
g_free (utf8);
if (error != IntPtr.Zero)
diff --git a/Source/Libs/GdkSharp/EventSelection.cs b/Source/Libs/GdkSharp/EventSelection.cs
index 7be982522..97cd0d30e 100644
--- a/Source/Libs/GdkSharp/EventSelection.cs
+++ b/Source/Libs/GdkSharp/EventSelection.cs
@@ -75,7 +75,6 @@ struct NativeStruct {
get { return GLib.Opaque.GetOpaque (Native.target, typeof (Atom), false) as Atom; }
set {
NativeStruct native = Native;
- native.target = value.Handle;
native.target = value == null ? IntPtr.Zero : value.Handle;
Marshal.StructureToPtr (native, Handle, false);
}
diff --git a/Source/Libs/GdkSharp/GdkSharp.metadata b/Source/Libs/GdkSharp/GdkSharp.metadata
index cf9a428eb..97ce0e6d1 100644
--- a/Source/Libs/GdkSharp/GdkSharp.metadata
+++ b/Source/Libs/GdkSharp/GdkSharp.metadata
@@ -16,7 +16,6 @@
out
1
out
- 1
EventHelper
const-gchar*
1
@@ -100,6 +99,7 @@
1
true
1
+ true
1
1
1
diff --git a/Source/Libs/GioSharp/GioSharp.metadata b/Source/Libs/GioSharp/GioSharp.metadata
index a7d1b8cbc..65fe8b1ea 100644
--- a/Source/Libs/GioSharp/GioSharp.metadata
+++ b/Source/Libs/GioSharp/GioSharp.metadata
@@ -14,6 +14,8 @@
GetDescription
GetIcon
GetMimeType
+ 1
+ n_data
Guess
GuessForTree
IsA
diff --git a/Source/Libs/GtkSharp.snk b/Source/Libs/GtkSharp.snk
new file mode 100644
index 000000000..54d626f05
Binary files /dev/null and b/Source/Libs/GtkSharp.snk differ
diff --git a/Source/Libs/GtkSharp/Box.cs b/Source/Libs/GtkSharp/Box.cs
new file mode 100644
index 000000000..da8891b44
--- /dev/null
+++ b/Source/Libs/GtkSharp/Box.cs
@@ -0,0 +1,30 @@
+// Gtk.Box.cs - Gtk Box class customizations
+//
+// Author: Marcel Tiede
+//
+// Copyright (C) 2019 Marcel Tiede
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of version 2 of the Lesser GNU General
+// Public License as published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this program; if not, write to the
+// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.
+
+namespace Gtk {
+
+ using System;
+ using System.Runtime.InteropServices;
+
+ public partial class Box {
+
+ protected Box() : base() { }
+ }
+}
diff --git a/Source/Libs/GtkSharp/Builder.cs b/Source/Libs/GtkSharp/Builder.cs
index 75ff7279f..2d6c6daf8 100644
--- a/Source/Libs/GtkSharp/Builder.cs
+++ b/Source/Libs/GtkSharp/Builder.cs
@@ -33,90 +33,6 @@ namespace Gtk {
using System.Text;
public partial class Builder {
-
- [System.Serializable]
- public class HandlerNotFoundException : SystemException
- {
- string handler_name;
- string signal_name;
- System.Reflection.EventInfo evnt;
- Type delegate_type;
-
- public HandlerNotFoundException (string handler_name, string signal_name,
- System.Reflection.EventInfo evnt, Type delegate_type)
- : this (handler_name, signal_name, evnt, delegate_type, null)
- {
- }
-
- public HandlerNotFoundException (string handler_name, string signal_name,
- System.Reflection.EventInfo evnt, Type delegate_type, Exception inner)
- : base ("No handler " + handler_name + " found for signal " + signal_name,
- inner)
- {
- this.handler_name = handler_name;
- this.signal_name = signal_name;
- this.evnt = evnt;
- this.delegate_type = delegate_type;
- }
-
- public HandlerNotFoundException (string message, string handler_name, string signal_name,
- System.Reflection.EventInfo evnt, Type delegate_type)
- : base ((message != null) ? message : "No handler " + handler_name + " found for signal " + signal_name,
- null)
- {
- this.handler_name = handler_name;
- this.signal_name = signal_name;
- this.evnt = evnt;
- this.delegate_type = delegate_type;
- }
-
- protected HandlerNotFoundException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
- : base (info, context)
- {
- handler_name = info.GetString ("HandlerName");
- signal_name = info.GetString ("SignalName");
- evnt = info.GetValue ("Event", typeof (System.Reflection.EventInfo)) as System.Reflection.EventInfo;
- delegate_type = info.GetValue ("DelegateType", typeof (Type)) as Type;
- }
-
- public string HandlerName
- {
- get {
- return handler_name;
- }
- }
-
- public string SignalName
- {
- get {
- return signal_name;
- }
- }
-
- public System.Reflection.EventInfo Event
- {
- get {
- return evnt;
- }
- }
-
- public Type DelegateType
- {
- get {
- return delegate_type;
- }
- }
-
- public override void GetObjectData (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
- {
- base.GetObjectData (info, context);
- info.AddValue ("HandlerName", handler_name);
- info.AddValue ("SignalName", signal_name);
- info.AddValue ("Event", evnt);
- info.AddValue ("DelegateType", delegate_type);
- }
- }
-
[AttributeUsage (AttributeTargets.Field)]
public class ObjectAttribute : Attribute
@@ -207,170 +123,24 @@ public Builder (Assembly assembly, string resource_name, string translation_doma
public void Autoconnect (object handler)
{
- BindFields (handler);
- (new SignalConnector (this, handler)).ConnectSignals ();
+ Autoconnect (handler, false);
}
-
+
+ public void Autoconnect (object handler, bool throwOnUnknownObject)
+ {
+ BindFields (handler, handler.GetType (), throwOnUnknownObject);
+ new SignalConnector (handler).ConnectSignals (this);
+ }
+
public void Autoconnect (Type handler_class)
{
- BindFields (handler_class);
- (new SignalConnector (this, handler_class)).ConnectSignals ();
+ Autoconnect (handler_class, false);
}
- class SignalConnector
+ public void Autoconnect (Type handler_class, bool throwOnUnknownObject)
{
- Builder builder;
- Type handler_type;
- object handler;
-
- public SignalConnector (Builder builder, object handler)
- {
- this.builder = builder;
- this.handler = handler;
- handler_type = handler.GetType ();
- }
-
- public SignalConnector (Builder builder, Type handler_type)
- {
- this.builder = builder;
- this.handler = null;
- this.handler_type = handler_type;
- }
-
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- delegate void d_gtk_builder_connect_signals_full(IntPtr raw, GtkSharp.BuilderConnectFuncNative func, IntPtr user_data);
- static d_gtk_builder_connect_signals_full gtk_builder_connect_signals_full = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_builder_connect_signals_full"));
-
- public void ConnectSignals() {
- GtkSharp.BuilderConnectFuncWrapper func_wrapper = new GtkSharp.BuilderConnectFuncWrapper (new BuilderConnectFunc (ConnectFunc));
- gtk_builder_connect_signals_full(builder.Handle, func_wrapper.NativeDelegate, IntPtr.Zero);
- }
-
- public void ConnectFunc (Builder builder, GLib.Object objekt, string signal_name, string handler_name, GLib.Object connect_object, GLib.ConnectFlags flags)
- {
- /* search for the event to connect */
- System.Reflection.MemberInfo[] evnts = objekt.GetType ().
- FindMembers (System.Reflection.MemberTypes.Event,
- System.Reflection.BindingFlags.Instance
- | System.Reflection.BindingFlags.Static
- | System.Reflection.BindingFlags.Public
- | System.Reflection.BindingFlags.NonPublic,
- new System.Reflection.MemberFilter (SignalFilter), signal_name);
- foreach (System.Reflection.EventInfo ei in evnts) {
- bool connected = false;
- System.Reflection.MethodInfo add = ei.GetAddMethod ();
- System.Reflection.ParameterInfo[] addpi = add.GetParameters ();
- if (addpi.Length == 1) { /* this should be always true, unless there's something broken */
- Type delegate_type = addpi[0].ParameterType;
-
- /* look for an instance method */
- if (connect_object != null || handler != null)
- try {
- Delegate d = Delegate.CreateDelegate (delegate_type, connect_object != null ? connect_object : handler, handler_name);
- add.Invoke (objekt, new object[] { d } );
- connected = true;
- } catch (ArgumentException) { /* ignore if there is not such instance method */
- }
-
- /* look for a static method if no instance method has been found */
- if (!connected && handler_type != null)
- try {
- Delegate d = Delegate.CreateDelegate (delegate_type, handler_type, handler_name);
- add.Invoke (objekt, new object[] { d } );
- connected = true;
- } catch (ArgumentException) { /* ignore if there is not such static method */
- }
-
- if (!connected) {
- string msg = ExplainError (ei.Name, delegate_type, handler_type, handler_name);
- throw new HandlerNotFoundException (msg, handler_name, signal_name, ei, delegate_type);
- }
- }
- }
- }
-
- static bool SignalFilter (System.Reflection.MemberInfo m, object filterCriteria)
- {
- string signame = (filterCriteria as string);
- object[] attrs = m.GetCustomAttributes (typeof (GLib.SignalAttribute), false);
- if (attrs.Length > 0)
- {
- foreach (GLib.SignalAttribute a in attrs)
- {
- if (signame == a.CName)
- {
- return true;
- }
- }
- return false;
- }
- else
- {
- /* this tries to match the names when no attibutes are present.
- It is only a fallback. */
- signame = signame.ToLower ().Replace ("_", "");
- string evname = m.Name.ToLower ();
- return signame == evname;
- }
- }
-
- static string GetSignature (System.Reflection.MethodInfo method)
- {
- if (method == null)
- return null;
-
- System.Reflection.ParameterInfo [] parameters = method.GetParameters ();
- System.Text.StringBuilder sb = new System.Text.StringBuilder ();
- sb.Append ('(');
- foreach (System.Reflection.ParameterInfo info in parameters) {
- sb.Append (info.ParameterType.ToString ());
- sb.Append (',');
- }
- if (sb.Length != 0)
- sb.Length--;
-
- sb.Append (')');
- return sb.ToString ();
- }
-
- static string GetSignature (Type delegate_type)
- {
- System.Reflection.MethodInfo method = delegate_type.GetMethod ("Invoke");
- return GetSignature (method);
- }
-
- const System.Reflection.BindingFlags flags = System.Reflection.BindingFlags.NonPublic |
- System.Reflection.BindingFlags.Public |
- System.Reflection.BindingFlags.Static |
- System.Reflection.BindingFlags.Instance;
- static string GetSignature (Type klass, string method_name)
- {
- try {
- System.Reflection.MethodInfo method = klass.GetMethod (method_name, flags);
- return GetSignature (method);
- } catch {
- // May be more than one method with that name and none matches
- return null;
- }
- }
-
-
- static string ExplainError (string event_name, Type deleg, Type klass, string method)
- {
- if (deleg == null || klass == null || method == null)
- return null;
-
- System.Text.StringBuilder sb = new System.Text.StringBuilder ();
- string expected = GetSignature (deleg);
- string actual = GetSignature (klass, method);
- if (actual == null)
- return null;
- sb.AppendFormat ("The handler for the event {0} should take '{1}', " +
- "but the signature of the provided handler ('{2}') is '{3}'\n",
- event_name, expected, method, actual);
- return sb.ToString ();
- }
-
+ BindFields (null, handler_class, throwOnUnknownObject);
+ new SignalConnector (handler_class).ConnectSignals (this);
}
void AddFromStream (Stream stream)
@@ -390,17 +160,7 @@ void AddFromStream (Stream stream)
AddFromString (text);
}
- void BindFields (object target)
- {
- BindFields (target, target.GetType ());
- }
-
- void BindFields (Type type)
- {
- BindFields (null, type);
- }
-
- void BindFields (object target, Type type)
+ void BindFields (object target, Type type, bool throwOnUnknownObject)
{
System.Reflection.BindingFlags flags = System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.DeclaredOnly;
if (target != null)
@@ -421,11 +181,8 @@ void BindFields (object target, Type type)
// The widget to field binding must be 1:1, so only check
// the first attribute.
ObjectAttribute attr = (ObjectAttribute) attrs[0];
- GLib.Object gobject;
- if (attr.Specified)
- gobject = GetObject (attr.Name);
- else
- gobject = GetObject (field.Name);
+ string name = attr.Specified ? attr.Name : field.Name;
+ GLib.Object gobject = GetObject (name);
if (gobject != null)
try {
@@ -434,6 +191,8 @@ void BindFields (object target, Type type)
Console.WriteLine ("Unable to set value for field " + field.Name);
throw e;
}
+ else if (throwOnUnknownObject)
+ throw new Exception ("Unknown object '" + name + "' to connect in type '" + type + "'");
}
type = type.BaseType;
}
@@ -441,4 +200,3 @@ void BindFields (object target, Type type)
}
}
}
-
diff --git a/Source/Libs/GtkSharp/ChildAttribute.cs b/Source/Libs/GtkSharp/ChildAttribute.cs
new file mode 100644
index 000000000..ec46deaa5
--- /dev/null
+++ b/Source/Libs/GtkSharp/ChildAttribute.cs
@@ -0,0 +1,38 @@
+// ChildAttribute.cs - Child attribute
+//
+// Author:
+// Marcel Tiede
+//
+// Copyright (c) 2019 Marcel Tiede
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of version 2 of the Lesser GNU General
+// Public License as published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this program; if not, write to the
+// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.
+
+namespace Gtk
+{
+ using System;
+
+ [AttributeUsage(AttributeTargets.Field)]
+ public class ChildAttribute : Attribute
+ {
+ public string Name { get; }
+ public bool Internal { get; }
+
+ public ChildAttribute(string name = null, bool @internal = false)
+ {
+ this.Name = name;
+ this.Internal = @internal;
+ }
+ }
+}
diff --git a/Source/Libs/GtkSharp/Container.cs b/Source/Libs/GtkSharp/Container.cs
index c812abe8f..c4c632f39 100644
--- a/Source/Libs/GtkSharp/Container.cs
+++ b/Source/Libs/GtkSharp/Container.cs
@@ -80,7 +80,7 @@ public IEnumerator GetEnumerator()
class ChildAccumulator
{
- public ArrayList Children = new ArrayList();
+ public System.Collections.Generic.List Children = new System.Collections.Generic.List();
public void Add(Gtk.Widget widget)
{
@@ -97,12 +97,12 @@ public IEnumerable AllChildren
return acc.Children;
}
}
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- delegate bool d_gtk_container_get_focus_chain(IntPtr raw, out IntPtr list_ptr);
- static d_gtk_container_get_focus_chain gtk_container_get_focus_chain = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_container_get_focus_chain"));
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- delegate void d_gtk_container_set_focus_chain(IntPtr raw, IntPtr list_ptr);
- static d_gtk_container_set_focus_chain gtk_container_set_focus_chain = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_container_set_focus_chain"));
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ delegate bool d_gtk_container_get_focus_chain(IntPtr raw, out IntPtr list_ptr);
+ static d_gtk_container_get_focus_chain gtk_container_get_focus_chain = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_container_get_focus_chain"));
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ delegate void d_gtk_container_set_focus_chain(IntPtr raw, IntPtr list_ptr);
+ static d_gtk_container_set_focus_chain gtk_container_set_focus_chain = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_container_set_focus_chain"));
public Widget[] FocusChain
{
diff --git a/Source/Libs/GtkSharp/CssNameAttribute.cs b/Source/Libs/GtkSharp/CssNameAttribute.cs
new file mode 100644
index 000000000..6fd8b57ee
--- /dev/null
+++ b/Source/Libs/GtkSharp/CssNameAttribute.cs
@@ -0,0 +1,15 @@
+namespace Gtk {
+
+ using System;
+
+ [AttributeUsage(AttributeTargets.Class)]
+ public sealed class CssNameAttribute : Attribute {
+
+ public CssNameAttribute (string name)
+ {
+ Name = name;
+ }
+
+ public string Name { get; private set; }
+ }
+}
diff --git a/Source/Libs/GtkSharp/GtkSharp-api.xml b/Source/Libs/GtkSharp/GtkSharp-api.xml
index 6e44325e5..c8cbd04a3 100644
--- a/Source/Libs/GtkSharp/GtkSharp-api.xml
+++ b/Source/Libs/GtkSharp/GtkSharp-api.xml
@@ -13638,7 +13638,7 @@
-
+
@@ -19833,8 +19833,8 @@