Connect template to the build system
This commit is contained in:
parent
1a416f3305
commit
4379eecdf3
11 changed files with 146 additions and 11 deletions
|
@ -1,19 +1,19 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<package>
|
<package>
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>Gtk.Template.CSharp</id>
|
<id>GtkSharp.Template.CSharp</id>
|
||||||
<version>3.0.0</version>
|
<version>3.0.0</version>
|
||||||
<title>Gtk template for CSharp</title>
|
<title>Gtk template for CSharp</title>
|
||||||
<summary>A simple C# template for your .Net Core Gtk Application.</summary>
|
<summary>A simple C# template for your .Net Core Gtk Application.</summary>
|
||||||
<description>A simple C# template for your .Net Core Gtk Application.</description>
|
<description>A simple C# template for your .Net Core Gtk Application.</description>
|
||||||
<authors>GLibSharp Team</authors>
|
<authors>cra0zy</authors>
|
||||||
<owners>GLibSharp Team</owners>
|
<owners>cra0zy</owners>
|
||||||
<projectUrl>https://github.com/GLibSharp/GtkSharp</projectUrl>
|
<projectUrl>https://github.com/cra0zy/GtkSharp</projectUrl>
|
||||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||||
<releaseNotes></releaseNotes>
|
<releaseNotes></releaseNotes>
|
||||||
<tags>gtk app dotnet new template</tags>
|
<tags>gtk gtksharp gtk-sharp app dotnet new template</tags>
|
||||||
<packageTypes>
|
<packageTypes>
|
||||||
<packageType name="Template" />
|
<packageType name="Template" />
|
||||||
</packageTypes>
|
</packageTypes>
|
||||||
</metadata>
|
</metadata>
|
||||||
</package>
|
</package>
|
|
@ -1,10 +1,12 @@
|
||||||
{
|
{
|
||||||
"$schema": "http://json.schemastore.org/template",
|
"$schema": "http://json.schemastore.org/template",
|
||||||
"author": "GLibSharp Team",
|
"author": "cra0zy",
|
||||||
"classifications": [ "Console" ],
|
"classifications": [
|
||||||
|
"Console"
|
||||||
|
],
|
||||||
"name": "Gtk Application",
|
"name": "Gtk Application",
|
||||||
"identity": "Gtk.Template.CSharp",
|
"identity": "GtkSharp.Template.CSharp",
|
||||||
"groupIdentity": "Gtk.Template",
|
"groupIdentity": "GtkSharp.Template",
|
||||||
"shortName": "gtkapp",
|
"shortName": "gtkapp",
|
||||||
"tags": {
|
"tags": {
|
||||||
"language": "C#",
|
"language": "C#",
|
||||||
|
@ -12,4 +14,4 @@
|
||||||
},
|
},
|
||||||
"sourceName": "GtkNamespace",
|
"sourceName": "GtkNamespace",
|
||||||
"preferNameDirectory": true
|
"preferNameDirectory": true
|
||||||
}
|
}
|
37
Source/Templates/NetCore/test/MainWindow.cs
Executable file
37
Source/Templates/NetCore/test/MainWindow.cs
Executable file
|
@ -0,0 +1,37 @@
|
||||||
|
using System;
|
||||||
|
using Gtk;
|
||||||
|
using UI = Gtk.Builder.ObjectAttribute;
|
||||||
|
|
||||||
|
namespace test
|
||||||
|
{
|
||||||
|
class MainWindow : Window
|
||||||
|
{
|
||||||
|
#pragma warning disable 0649
|
||||||
|
[UI] private Label _label1;
|
||||||
|
[UI] private Button _button1;
|
||||||
|
#pragma warning restore 0649
|
||||||
|
|
||||||
|
private int _counter;
|
||||||
|
|
||||||
|
public MainWindow() : this(new Builder("MainWindow.glade")) { }
|
||||||
|
|
||||||
|
private MainWindow(Builder builder) : base(builder.GetObject("MainWindow").Handle)
|
||||||
|
{
|
||||||
|
builder.Autoconnect(this);
|
||||||
|
|
||||||
|
DeleteEvent += OnDeleteEvent;
|
||||||
|
_button1.Clicked += Button1_Clicked;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDeleteEvent(object sender, DeleteEventArgs a)
|
||||||
|
{
|
||||||
|
Application.Quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Button1_Clicked(object sender, EventArgs a)
|
||||||
|
{
|
||||||
|
_counter++;
|
||||||
|
_label1.Text = "Hello World! This button has been clicked " + _counter + " time(s).";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
46
Source/Templates/NetCore/test/MainWindow.glade
Executable file
46
Source/Templates/NetCore/test/MainWindow.glade
Executable file
|
@ -0,0 +1,46 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<interface>
|
||||||
|
<requires lib="gtk+" version="3.18"/>
|
||||||
|
<object class="GtkWindow" id="MainWindow">
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="title" translatable="yes">Example Window</property>
|
||||||
|
<property name="default_width">480</property>
|
||||||
|
<property name="default_height">240</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="margin_left">4</property>
|
||||||
|
<property name="margin_right">4</property>
|
||||||
|
<property name="margin_top">4</property>
|
||||||
|
<property name="margin_bottom">4</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="_label1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Hello World!</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="_button1">
|
||||||
|
<property name="label" translatable="yes">Click me!</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</interface>
|
23
Source/Templates/NetCore/test/Program.cs
Executable file
23
Source/Templates/NetCore/test/Program.cs
Executable file
|
@ -0,0 +1,23 @@
|
||||||
|
using System;
|
||||||
|
using Gtk;
|
||||||
|
|
||||||
|
namespace test
|
||||||
|
{
|
||||||
|
class Program
|
||||||
|
{
|
||||||
|
[STAThread]
|
||||||
|
public static void Main(string[] args)
|
||||||
|
{
|
||||||
|
Application.Init();
|
||||||
|
|
||||||
|
var app = new Application("org.test.test", GLib.ApplicationFlags.None);
|
||||||
|
app.Register(GLib.Cancellable.Current);
|
||||||
|
|
||||||
|
var win = new MainWindow();
|
||||||
|
app.AddWindow(win);
|
||||||
|
|
||||||
|
win.Show();
|
||||||
|
Application.Run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
14
Source/Templates/NetCore/test/test.csproj
Executable file
14
Source/Templates/NetCore/test/test.csproj
Executable file
|
@ -0,0 +1,14 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="MainWindow.glade">
|
||||||
|
<LogicalName>MainWindow.glade</LogicalName>
|
||||||
|
</EmbeddedResource>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="GtkSharp" Version="3.2.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
13
build.cake
13
build.cake
|
@ -106,6 +106,19 @@ Task("PackageNuGet")
|
||||||
DotNetCorePack(gassembly.Csproj, settings);
|
DotNetCorePack(gassembly.Csproj, settings);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Task("PackageTemplates")
|
||||||
|
.IsDependentOn("Init")
|
||||||
|
.Does(() =>
|
||||||
|
{
|
||||||
|
var settings = new NuGetPackSettings
|
||||||
|
{
|
||||||
|
BasePath = "Source/Templates/NetCore/GtkSharp.Template.CSharp",
|
||||||
|
OutputDirectory = "BuildOutput/NugetPackages"
|
||||||
|
};
|
||||||
|
|
||||||
|
NuGetPack("Source/Templates/NetCore/GtkSharp.Template.CSharp/GtkSharp.Template.CSharp.nuspec", settings);
|
||||||
|
});
|
||||||
|
|
||||||
// TASK TARGETS
|
// TASK TARGETS
|
||||||
|
|
||||||
Task("Default")
|
Task("Default")
|
||||||
|
|
Loading…
Reference in a new issue