From 6fd9796e3addc655a36dde3aa29683bebf6f8a4c Mon Sep 17 00:00:00 2001 From: Michael Becker Date: Mon, 6 Jun 2016 12:51:35 -0400 Subject: [PATCH] Register new instance of GtkApplication with gtk_application_new --- .../GTK/UniversalEditor.Engines.GTK/GtkApplication.cs | 8 ++++++++ .../UniversalEditor.Engines.GTK/Internal/GTK/Constants.cs | 5 +++++ .../UniversalEditor.Engines.GTK/Internal/GTK/Methods.cs | 5 +++++ 3 files changed, 18 insertions(+) diff --git a/CSharp/Engines/GTK/UniversalEditor.Engines.GTK/GtkApplication.cs b/CSharp/Engines/GTK/UniversalEditor.Engines.GTK/GtkApplication.cs index 72354203..cca593c2 100644 --- a/CSharp/Engines/GTK/UniversalEditor.Engines.GTK/GtkApplication.cs +++ b/CSharp/Engines/GTK/UniversalEditor.Engines.GTK/GtkApplication.cs @@ -4,9 +4,17 @@ namespace UniversalEditor.Engines.GTK { public static class GtkApplication { + private static IntPtr mvarHandle = IntPtr.Zero; + public static bool Initialize(ref int argc, ref string[] argv) { bool check = Internal.GTK.Methods.gtk_init_check (ref argc, ref argv); + if (!check) + return check; + + mvarHandle = Internal.GTK.Methods.gtk_application_new ("net.alcetech.UniversalEditor", Internal.GTK.Constants.GApplicationFlags.None); + + return check; } public static void Run() diff --git a/CSharp/Engines/GTK/UniversalEditor.Engines.GTK/Internal/GTK/Constants.cs b/CSharp/Engines/GTK/UniversalEditor.Engines.GTK/Internal/GTK/Constants.cs index 47d2d7ff..0ebc47b6 100644 --- a/CSharp/Engines/GTK/UniversalEditor.Engines.GTK/Internal/GTK/Constants.cs +++ b/CSharp/Engines/GTK/UniversalEditor.Engines.GTK/Internal/GTK/Constants.cs @@ -4,6 +4,11 @@ namespace UniversalEditor.Engines.GTK.Internal.GTK { internal static class Constants { + public enum GApplicationFlags + { + None = 0 + } + public enum GtkWindowType { TopLevel = 0, diff --git a/CSharp/Engines/GTK/UniversalEditor.Engines.GTK/Internal/GTK/Methods.cs b/CSharp/Engines/GTK/UniversalEditor.Engines.GTK/Internal/GTK/Methods.cs index 97ecabc7..9d14486f 100644 --- a/CSharp/Engines/GTK/UniversalEditor.Engines.GTK/Internal/GTK/Methods.cs +++ b/CSharp/Engines/GTK/UniversalEditor.Engines.GTK/Internal/GTK/Methods.cs @@ -31,6 +31,11 @@ namespace UniversalEditor.Engines.GTK.Internal.GTK [DllImport(LIBRARY_FILENAME)] public static extern void gtk_window_set_title(IntPtr window, string title); + #region Application + [DllImport(LIBRARY_FILENAME)] + public static extern IntPtr gtk_application_new(string application_id, Constants.GApplicationFlags flags); + #endregion + #region Widget [DllImport(LIBRARY_FILENAME)] public static extern void gtk_widget_set_size_request(IntPtr widget, uint width, uint height);