From 1159af4adf1fd167328659f18c01a4b4c9d894f2 Mon Sep 17 00:00:00 2001
From: badcel <1218031+badcel@users.noreply.github.com>
Date: Sat, 21 Mar 2026 23:33:40 +0100
Subject: [PATCH 1/3] Add blueprint support
---
.../Compiler/Blueprint.Build.props | 19 ++++++
.../Compiler/Blueprint.Build.targets | 60 +++++++++++++++++++
.../Compiler/Ui.Build.props | 14 +++++
.../GirCore.Gtk-4.0.Integration.props | 4 ++
.../GirCore.Gtk-4.0.Integration.targets | 3 +
.../Gtk-4.0.Integration.csproj | 8 +++
src/GirCore.slnx | 2 +
src/Samples/Directory.Build.props | 2 +
src/Samples/Directory.Build.targets | 3 +
.../CompositeTemplate.csproj | 9 +--
.../CompositeBoxWidget.blp | 13 ++++
.../CompositeBoxWidget.cs | 14 +++++
.../CompositeTemplateBlueprint.csproj | 17 ++++++
.../CompositeTemplateBlueprint/Program.cs | 12 ++++
14 files changed, 173 insertions(+), 7 deletions(-)
create mode 100644 src/Extensions/Gtk-4.0.Integration/Compiler/Blueprint.Build.props
create mode 100644 src/Extensions/Gtk-4.0.Integration/Compiler/Blueprint.Build.targets
create mode 100644 src/Extensions/Gtk-4.0.Integration/Compiler/Ui.Build.props
create mode 100644 src/Extensions/Gtk-4.0.Integration/GirCore.Gtk-4.0.Integration.props
create mode 100644 src/Extensions/Gtk-4.0.Integration/GirCore.Gtk-4.0.Integration.targets
create mode 100644 src/Samples/Directory.Build.targets
create mode 100644 src/Samples/Gtk-4.0/CompositeTemplateBlueprint/CompositeBoxWidget.blp
create mode 100644 src/Samples/Gtk-4.0/CompositeTemplateBlueprint/CompositeBoxWidget.cs
create mode 100644 src/Samples/Gtk-4.0/CompositeTemplateBlueprint/CompositeTemplateBlueprint.csproj
create mode 100644 src/Samples/Gtk-4.0/CompositeTemplateBlueprint/Program.cs
diff --git a/src/Extensions/Gtk-4.0.Integration/Compiler/Blueprint.Build.props b/src/Extensions/Gtk-4.0.Integration/Compiler/Blueprint.Build.props
new file mode 100644
index 000000000..3ec21dad0
--- /dev/null
+++ b/src/Extensions/Gtk-4.0.Integration/Compiler/Blueprint.Build.props
@@ -0,0 +1,19 @@
+
+
+ blueprint-compiler
+
+
+
+
+ %(Filename).blp.ui
+ $(IntermediateOutputPath)%(Filename).blp.ui
+
+
+
+
+
+
+ %(Filename)%(Extension)
+
+
+
\ No newline at end of file
diff --git a/src/Extensions/Gtk-4.0.Integration/Compiler/Blueprint.Build.targets b/src/Extensions/Gtk-4.0.Integration/Compiler/Blueprint.Build.targets
new file mode 100644
index 000000000..b1c31dd9c
--- /dev/null
+++ b/src/Extensions/Gtk-4.0.Integration/Compiler/Blueprint.Build.targets
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <_BlueprintFilesToCompile Include="@(BlueprintEmbeddedResource)" />
+
+
+
+
+
+
+
+ <_BlueprintOutputFiles Include="$(IntermediateOutputPath)*.ui" />
+
+
+
+
\ No newline at end of file
diff --git a/src/Extensions/Gtk-4.0.Integration/Compiler/Ui.Build.props b/src/Extensions/Gtk-4.0.Integration/Compiler/Ui.Build.props
new file mode 100644
index 000000000..079580668
--- /dev/null
+++ b/src/Extensions/Gtk-4.0.Integration/Compiler/Ui.Build.props
@@ -0,0 +1,14 @@
+
+
+
+ %(Filename).ui
+
+
+
+
+
+
+ %(Filename)%(Extension)
+
+
+
\ No newline at end of file
diff --git a/src/Extensions/Gtk-4.0.Integration/GirCore.Gtk-4.0.Integration.props b/src/Extensions/Gtk-4.0.Integration/GirCore.Gtk-4.0.Integration.props
new file mode 100644
index 000000000..268c3d677
--- /dev/null
+++ b/src/Extensions/Gtk-4.0.Integration/GirCore.Gtk-4.0.Integration.props
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/src/Extensions/Gtk-4.0.Integration/GirCore.Gtk-4.0.Integration.targets b/src/Extensions/Gtk-4.0.Integration/GirCore.Gtk-4.0.Integration.targets
new file mode 100644
index 000000000..9732f0f21
--- /dev/null
+++ b/src/Extensions/Gtk-4.0.Integration/GirCore.Gtk-4.0.Integration.targets
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/src/Extensions/Gtk-4.0.Integration/Gtk-4.0.Integration.csproj b/src/Extensions/Gtk-4.0.Integration/Gtk-4.0.Integration.csproj
index 8ce9abbdf..4cfc239e6 100644
--- a/src/Extensions/Gtk-4.0.Integration/Gtk-4.0.Integration.csproj
+++ b/src/Extensions/Gtk-4.0.Integration/Gtk-4.0.Integration.csproj
@@ -4,4 +4,12 @@
Gtk.Integration
Source Generator to make it easy to integrate C# with Gtk.
+
+
+
+
+
+
+
+
diff --git a/src/GirCore.slnx b/src/GirCore.slnx
index a38bd5896..a4b1546d6 100644
--- a/src/GirCore.slnx
+++ b/src/GirCore.slnx
@@ -51,6 +51,7 @@
+
@@ -68,6 +69,7 @@
+
diff --git a/src/Samples/Directory.Build.props b/src/Samples/Directory.Build.props
index a2119370e..670f0f0b1 100644
--- a/src/Samples/Directory.Build.props
+++ b/src/Samples/Directory.Build.props
@@ -1,4 +1,6 @@
+
+
false
diff --git a/src/Samples/Directory.Build.targets b/src/Samples/Directory.Build.targets
new file mode 100644
index 000000000..9f7788869
--- /dev/null
+++ b/src/Samples/Directory.Build.targets
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/src/Samples/Gtk-4.0/CompositeTemplate/CompositeTemplate.csproj b/src/Samples/Gtk-4.0/CompositeTemplate/CompositeTemplate.csproj
index bbc449251..75b79a47c 100644
--- a/src/Samples/Gtk-4.0/CompositeTemplate/CompositeTemplate.csproj
+++ b/src/Samples/Gtk-4.0/CompositeTemplate/CompositeTemplate.csproj
@@ -4,6 +4,8 @@
+
+
@@ -12,12 +14,5 @@
enable
true
-
-
-
-
- %(Filename)%(Extension)
-
-
diff --git a/src/Samples/Gtk-4.0/CompositeTemplateBlueprint/CompositeBoxWidget.blp b/src/Samples/Gtk-4.0/CompositeTemplateBlueprint/CompositeBoxWidget.blp
new file mode 100644
index 000000000..9311ddcf7
--- /dev/null
+++ b/src/Samples/Gtk-4.0/CompositeTemplateBlueprint/CompositeBoxWidget.blp
@@ -0,0 +1,13 @@
+using Gtk 4.0;
+
+template $CompositeBoxWidget: Box {
+ orientation: vertical;
+
+ Label {
+ label: "Welcome to CompositeTemplates!";
+ }
+
+ Label my_label {
+ label: "Nothing to see here.";
+ }
+}
\ No newline at end of file
diff --git a/src/Samples/Gtk-4.0/CompositeTemplateBlueprint/CompositeBoxWidget.cs b/src/Samples/Gtk-4.0/CompositeTemplateBlueprint/CompositeBoxWidget.cs
new file mode 100644
index 000000000..fbb318f9c
--- /dev/null
+++ b/src/Samples/Gtk-4.0/CompositeTemplateBlueprint/CompositeBoxWidget.cs
@@ -0,0 +1,14 @@
+namespace CompositeTemplate;
+
+[GObject.Subclass(qualifiedName: nameof(CompositeBoxWidget))]
+[Gtk.Template("CompositeBoxWidget.blp.ui")]
+public partial class CompositeBoxWidget
+{
+ [Gtk.Connect("my_label")]
+ private Gtk.Label _label;
+
+ partial void Initialize()
+ {
+ _label.Label_ = "With support for connected members!";
+ }
+}
diff --git a/src/Samples/Gtk-4.0/CompositeTemplateBlueprint/CompositeTemplateBlueprint.csproj b/src/Samples/Gtk-4.0/CompositeTemplateBlueprint/CompositeTemplateBlueprint.csproj
new file mode 100644
index 000000000..733f186a2
--- /dev/null
+++ b/src/Samples/Gtk-4.0/CompositeTemplateBlueprint/CompositeTemplateBlueprint.csproj
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+ Exe
+ net8.0
+ enable
+ true
+
+
diff --git a/src/Samples/Gtk-4.0/CompositeTemplateBlueprint/Program.cs b/src/Samples/Gtk-4.0/CompositeTemplateBlueprint/Program.cs
new file mode 100644
index 000000000..95b385364
--- /dev/null
+++ b/src/Samples/Gtk-4.0/CompositeTemplateBlueprint/Program.cs
@@ -0,0 +1,12 @@
+using CompositeTemplate;
+
+var application = Gtk.Application.New("org.gir.core", Gio.ApplicationFlags.FlagsNone);
+application.OnActivate += (sender, args) =>
+{
+ var window = Gtk.ApplicationWindow.New((Gtk.Application) sender);
+ window.Title = "Gtk4 Window";
+ window.SetDefaultSize(300, 300);
+ window.Child = CompositeBoxWidget.NewWithProperties([]);
+ window.Show();
+};
+return application.RunWithSynchronizationContext(null);
From 75037396aefdf0c83444d4dfb0fe71297eb2db76 Mon Sep 17 00:00:00 2001
From: badcel <1218031+badcel@users.noreply.github.com>
Date: Sun, 22 Mar 2026 08:00:40 +0100
Subject: [PATCH 2/3] Update
---
.../Compiler/Blueprint.Build.targets | 14 +++++++-------
.../Compiler/Template.Build.props | 14 ++++++++++++++
.../Gtk-4.0.Integration/Compiler/Ui.Build.props | 14 --------------
.../GirCore.Gtk-4.0.Integration.props | 2 +-
.../Gtk-4.0.Integration/Gtk-4.0.Integration.csproj | 2 +-
5 files changed, 23 insertions(+), 23 deletions(-)
create mode 100644 src/Extensions/Gtk-4.0.Integration/Compiler/Template.Build.props
delete mode 100644 src/Extensions/Gtk-4.0.Integration/Compiler/Ui.Build.props
diff --git a/src/Extensions/Gtk-4.0.Integration/Compiler/Blueprint.Build.targets b/src/Extensions/Gtk-4.0.Integration/Compiler/Blueprint.Build.targets
index b1c31dd9c..684d0bb54 100644
--- a/src/Extensions/Gtk-4.0.Integration/Compiler/Blueprint.Build.targets
+++ b/src/Extensions/Gtk-4.0.Integration/Compiler/Blueprint.Build.targets
@@ -39,16 +39,16 @@
-
+
<_BlueprintFilesToCompile Include="@(BlueprintEmbeddedResource)" />
-
-
+
+
+
diff --git a/src/Extensions/Gtk-4.0.Integration/Compiler/Template.Build.props b/src/Extensions/Gtk-4.0.Integration/Compiler/Template.Build.props
new file mode 100644
index 000000000..a6272180b
--- /dev/null
+++ b/src/Extensions/Gtk-4.0.Integration/Compiler/Template.Build.props
@@ -0,0 +1,14 @@
+
+
+
+ %(Filename).ui
+
+
+
+
+
+
+ %(Filename)%(Extension)
+
+
+
\ No newline at end of file
diff --git a/src/Extensions/Gtk-4.0.Integration/Compiler/Ui.Build.props b/src/Extensions/Gtk-4.0.Integration/Compiler/Ui.Build.props
deleted file mode 100644
index 079580668..000000000
--- a/src/Extensions/Gtk-4.0.Integration/Compiler/Ui.Build.props
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
- %(Filename).ui
-
-
-
-
-
-
- %(Filename)%(Extension)
-
-
-
\ No newline at end of file
diff --git a/src/Extensions/Gtk-4.0.Integration/GirCore.Gtk-4.0.Integration.props b/src/Extensions/Gtk-4.0.Integration/GirCore.Gtk-4.0.Integration.props
index 268c3d677..6692122fd 100644
--- a/src/Extensions/Gtk-4.0.Integration/GirCore.Gtk-4.0.Integration.props
+++ b/src/Extensions/Gtk-4.0.Integration/GirCore.Gtk-4.0.Integration.props
@@ -1,4 +1,4 @@
-
+
\ No newline at end of file
diff --git a/src/Extensions/Gtk-4.0.Integration/Gtk-4.0.Integration.csproj b/src/Extensions/Gtk-4.0.Integration/Gtk-4.0.Integration.csproj
index 4cfc239e6..c9cd545f2 100644
--- a/src/Extensions/Gtk-4.0.Integration/Gtk-4.0.Integration.csproj
+++ b/src/Extensions/Gtk-4.0.Integration/Gtk-4.0.Integration.csproj
@@ -10,6 +10,6 @@
-
+
From 2ed0af18c36acf659d0470fa95c831724f84d50d Mon Sep 17 00:00:00 2001
From: badcel <1218031+badcel@users.noreply.github.com>
Date: Sun, 22 Mar 2026 08:01:33 +0100
Subject: [PATCH 3/3] debug
---
src/Samples/Gtk-4.0/CompositeTemplate/Program.cs | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/Samples/Gtk-4.0/CompositeTemplate/Program.cs b/src/Samples/Gtk-4.0/CompositeTemplate/Program.cs
index 95b385364..a25adc79d 100644
--- a/src/Samples/Gtk-4.0/CompositeTemplate/Program.cs
+++ b/src/Samples/Gtk-4.0/CompositeTemplate/Program.cs
@@ -1,8 +1,15 @@
+using System;
+using System.Reflection;
using CompositeTemplate;
var application = Gtk.Application.New("org.gir.core", Gio.ApplicationFlags.FlagsNone);
application.OnActivate += (sender, args) =>
{
+ Console.WriteLine("Resources:");
+ var names = Assembly.GetExecutingAssembly().GetManifestResourceNames();
+ foreach (var name in names)
+ Console.WriteLine(name);
+
var window = Gtk.ApplicationWindow.New((Gtk.Application) sender);
window.Title = "Gtk4 Window";
window.SetDefaultSize(300, 300);