Add base gtk# md addin (#8)

* Base Gtk# MD Addin

* Fix tabs
This commit is contained in:
Harry 2017-09-23 16:38:43 +02:00 committed by Thibault Saunier
parent d1457f6e03
commit 5f3d138d1a
25 changed files with 962 additions and 0 deletions

306
.gitignore vendored
View file

@ -1 +1,307 @@
build/
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
**/Properties/launchSettings.json
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Typescript v1 declaration files
typings/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
# CodeRush
.cr/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/

View file

@ -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\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

View file

@ -0,0 +1,12 @@
using Mono.Addins;
namespace MonoDevelop.GtkSharp.Addin
{
public class CheckMissing : ConditionType
{
public override bool Evaluate(NodeElement conditionNode)
{
return AddinManager.GetExtensionNode("/MonoDevelop/Ide/ProjectTemplateCategories/crossplat/app") == null;
}
}
}

View file

@ -0,0 +1,50 @@
using System;
using System.Diagnostics;
using System.IO;
using Microsoft.Win32;
using MonoDevelop.Ide.Desktop;
namespace MonoDevelop.GtkSharp.Addin
{
public class GladeDesktopApplication : DesktopApplication
{
private static readonly string s_unixgladeapp = "-c '" + File.ReadAllText("glade.sh") + "'";
private readonly string _filename;
public GladeDesktopApplication(string filename) : base("GladeApp", "Glade", true)
{
_filename = filename;
}
public override void Launch(params string[] files)
{
try
{
var process = new Process();
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)
{
process.StartInfo.FileName = Path.Combine(location.ToString(), "bin", "glade.exe");
process.StartInfo.Arguments = _filename;
}
}
else
{
process.StartInfo.FileName = "bash";
process.StartInfo.Arguments = s_unixgladeapp.Replace("$@", _filename);
}
if (!string.IsNullOrEmpty(process.StartInfo.FileName))
process.Start();
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
}
}

View file

@ -0,0 +1,22 @@
using MonoDevelop.Core;
using MonoDevelop.Ide.Desktop;
using MonoDevelop.Ide.Gui;
using MonoDevelop.Projects;
namespace MonoDevelop.GtkSharp.Addin
{
public class GladeDisplayBinding : IExternalDisplayBinding
{
public bool CanUseAsDefault => true;
public bool CanHandle(FilePath fileName, string mimeType, Project ownerProject)
{
return fileName.Extension == ".glade";
}
public DesktopApplication GetApplication(FilePath fileName, string mimeType, Project ownerProject)
{
return new GladeDesktopApplication(fileName.FullPath);
}
}
}

View file

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{52AC8491-F6B7-4631-92BA-D5E95A091B74}</ProjectGuid>
<ProjectTypeGuids>{86F6BF2A-E449-4B3E-813B-9ACC37E5545F};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<RootNamespace>MonoDevelop.GtkSharp.Addin</RootNamespace>
<AssemblyName>MonoDevelop.GtkSharp.Addin</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\AddinInfo.cs" />
<Compile Include="CheckMissing.cs" />
<Compile Include="GladeDisplayBindings.cs" />
<Compile Include="GladeDesktopApplication.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Properties\Manifest.addin.xml" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="Templates\Projects\GtkSharpProject.CS.xpt.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Templates\Projects\Data\Program.cs">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Templates\Projects\Data\MainWindow.glade">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Templates\Projects\Data\MainWindow.cs">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Templates\File\Window.CS.xft.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Templates\File\Data\Window.glade">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Templates\File\Data\Window.cs">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Templates\File\Data\Dialog.glade">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Templates\File\Data\Dialog.cs">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Templates\File\Dialog.CS.xft.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Templates\File\Data\Widget.glade">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Templates\File\Data\Widget.cs">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Templates\File\Widget.CS.xft.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Templates\Projects\GtkSharpProject.FS.xpt.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="glade.sh">
<LogicalName>glade.sh</LogicalName>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="Templates\" />
<Folder Include="Templates\Projects\" />
<Folder Include="Templates\Projects\Data\" />
<Folder Include="Templates\File\" />
<Folder Include="Templates\File\Data\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\MonoDevelop.Addins.0.3.3\build\net40\MonoDevelop.Addins.targets" Condition="Exists('..\packages\MonoDevelop.Addins.0.3.3\build\net40\MonoDevelop.Addins.targets')" />
</Project>

View file

@ -0,0 +1,10 @@
using Mono.Addins;
using Mono.Addins.Description;
[assembly: Addin("MonoDevelop.GtkSharp.Addin", Version="1.0")]
[assembly: AddinName("Gtk# Addin")]
[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")]

View file

@ -0,0 +1,26 @@
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("MonoDevelop.GtkSharp.Addin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("${AuthorCopyright}")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]

View file

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<ExtensionModel>
<Dependencies>
<Addin id="MonoDevelop.Ide" version="7.1"/>
<Addin id="MonoDevelop.Core" version="7.1"/>
</Dependencies>
<Runtime>
<Import file="glade.sh" />
<!-- Project Templates -->
<Import file="Templates/Projects/Data/MainWindow.cs" />
<Import file="Templates/Projects/Data/MainWindow.glade" />
<Import file="Templates/Projects/Data/Program.cs" />
<Import file="Templates/Projects/GtkSharpProject.CS.xpt.xml" />
<Import file="Templates/Projects/GtkSharpProject.FS.xpt.xml" />
<!-- File Templates -->
<Import file="Templates/File/Data/Dialog.cs" />
<Import file="Templates/File/Data/Dialog.glade" />
<Import file="Templates/File/Data/Widget.cs" />
<Import file="Templates/File/Data/Widget.glade" />
<Import file="Templates/File/Data/Window.cs" />
<Import file="Templates/File/Data/Window.glade" />
<Import file="Templates/File/Dialog.CS.xft.xml" />
<Import file="Templates/File/Widget.CS.xft.xml" />
<Import file="Templates/File/Window.CS.xft.xml" />
</Runtime>
<ConditionType id="CheckMissing" type="MonoDevelop.GtkSharp.Addin.CheckMissing" />
<Extension path="/MonoDevelop/Ide/ProjectTemplateCategories/multiplat">
<Condition id="CheckMissing">
<Category id="app" name="App" insertbefore="library" />
</Condition>
</Extension>
<Extension path="/MonoDevelop/Ide/ProjectTemplateCategories/multiplat/app">
<Category id="gtk" name="Gtk#" />
</Extension>
<Extension path="/MonoDevelop/Ide/ProjectTemplates">
<ProjectTemplate id="gtk-cs-project" file="Templates/Projects/GtkSharpProject.CS.xpt.xml" />
<!-- TODO: Implement fsharp template -->
<!--ProjectTemplate id="gtk-fs-project" file="Templates/Projects/GtkSharpProject.FS.xpt.xml" /-->
</Extension>
<Extension path="/MonoDevelop/Ide/FileTemplates">
<FileTemplate id="gtk.cs.dialog" file="Templates/File/Dialog.CS.xft.xml" />
<FileTemplate id="gtk.cs.widget" file="Templates/File/Widget.CS.xft.xml" />
<FileTemplate id="gtk.cs.window" file="Templates/File/Window.CS.xft.xml" />
</Extension>
<Extension path="/MonoDevelop/Ide/DisplayBindings">
<DisplayBinding id="GladeApp" insertbefore="DefaultDisplayBinding" class="MonoDevelop.GtkSharp.Addin.GladeDisplayBinding" />
</Extension>
</ExtensionModel>

View file

@ -0,0 +1,23 @@
using System;
using Gtk;
using UI = Gtk.Builder.ObjectAttribute;
namespace ${Namespace}
{
class ${EscapedIdentifier} : Dialog
{
public MyDialog() : this(new Builder("${Namespace}.${EscapedIdentifier}.glade")) { }
private MyDialog(Builder builder) : base(builder.GetObject("${EscapedIdentifier}").Handle)
{
DefaultResponse = ResponseType.Cancel;
Response += OnResponse;
}
private void OnResponse(object o, ResponseArgs args)
{
Hide();
}
}
}

View file

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="3.18"/>
<object class="GtkDialog" id="${EscapedIdentifier}">
<property name="can_focus">False</property>
<property name="default_width">320</property>
<property name="default_height">260</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkBox">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<placeholder/>
</child>
<child>
<object class="GtkButton" id="button1">
<property name="label">gtk-close</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
<action-widgets>
<action-widget response="-7">button1</action-widget>
</action-widgets>
</object>
</interface>

View file

@ -0,0 +1,16 @@
using System;
using Gtk;
using UI = Gtk.Builder.ObjectAttribute;
namespace ${Namespace}
{
public class ${EscapedIdentifier} : Box
{
public ${EscapedIdentifier}() : this(new Builder("${Namespace}.${EscapedIdentifier}.glade")) { }
private ${EscapedIdentifier}(Builder builder) : base(builder.GetObject("${EscapedIdentifier}").Handle)
{
}
}
}

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="3.18"/>
<object class="GtkBox" id="${EscapedIdentifier}">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
</object>
</interface>

View file

@ -0,0 +1,23 @@
using System;
using Gtk;
using UI = Gtk.Builder.ObjectAttribute;
namespace ${Namespace}
{
class ${EscapedIdentifier} : Window
{
public ${EscapedIdentifier}() : this(new Builder("${Namespace}.${EscapedIdentifier}.glade")) { }
private ${EscapedIdentifier}(Builder builder) : base(builder.GetObject("${EscapedIdentifier}").Handle)
{
builder.Autoconnect(this);
DeleteEvent += OnDeleteEvent;
}
private void OnDeleteEvent(object sender, DeleteEventArgs a)
{
Application.Quit();
}
}
}

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="3.18"/>
<object class="GtkWindow" id="${EscapedIdentifier}">
<property name="can_focus">False</property>
<property name="title" translatable="yes">${Name}</property>
<child>
<placeholder/>
</child>
</object>
</interface>

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<Template>
<TemplateConfiguration>
<_Name>Dialog</_Name>
<Icon>md-gui-file</Icon>
<_Category>Gtk#</_Category>
<LanguageName>C#</LanguageName>
<DefaultFilename>MyDialog</DefaultFilename>
<_Description>Creates a new Gtk# dialog.</_Description>
</TemplateConfiguration>
<TemplateFiles>
<File name="${Name}.glade" src="Data/Dialog.glade" BuildAction="EmbeddedResource" SuppressAutoOpen="True" />
<File name="${Name}.cs" src="Data/Dialog.cs" DependsOn="${Name}.glade" />
</TemplateFiles>
</Template>

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<Template>
<TemplateConfiguration>
<_Name>Widget</_Name>
<Icon>md-gui-file</Icon>
<_Category>Gtk#</_Category>
<LanguageName>C#</LanguageName>
<DefaultFilename>MyWidget</DefaultFilename>
<_Description>Creates a new Gtk# custom widget.</_Description>
</TemplateConfiguration>
<TemplateFiles>
<File name="${Name}.glade" src="Data/Widget.glade" BuildAction="EmbeddedResource" SuppressAutoOpen="True" />
<File name="${Name}.cs" src="Data/Widget.cs" DependsOn="${Name}.glade" />
</TemplateFiles>
</Template>

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<Template>
<TemplateConfiguration>
<_Name>Window</_Name>
<Icon>md-gui-file</Icon>
<_Category>Gtk#</_Category>
<LanguageName>C#</LanguageName>
<DefaultFilename>MyWindow</DefaultFilename>
<_Description>Creates a new Gtk# window.</_Description>
</TemplateConfiguration>
<TemplateFiles>
<File name="${Name}.glade" src="Data/Window.glade" BuildAction="EmbeddedResource" SuppressAutoOpen="True" />
<File name="${Name}.cs" src="Data/Window.cs" DependsOn="${Name}.glade" />
</TemplateFiles>
</Template>

View file

@ -0,0 +1,37 @@
using System;
using Gtk;
using UI = Gtk.Builder.ObjectAttribute;
namespace ${Namespace}
{
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("${Namespace}.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).";
}
}
}

View 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>

View file

@ -0,0 +1,23 @@
using System;
using Gtk;
namespace ${Namespace}
{
class Program
{
[STAThread]
public static void Main(string[] args)
{
Application.Init();
var app = new Application("org.gnome.example", GLib.ApplicationFlags.None);
app.Register(GLib.Cancellable.Current);
var win = new MainWindow();
app.AddWindow(win);
win.Show();
Application.Run();
}
}
}

View file

@ -0,0 +1,35 @@
<?xml version="1.0"?>
<Template>
<TemplateConfiguration>
<_Name>Gtk# Application</_Name>
<Icon>md-gui-project</Icon>
<_Category>multiplat/app/gtk</_Category>
<LanguageName>C#</LanguageName>
<Image id="md-gui-project" />
<_Description>Creates a new Gtk# multiplatform application.</_Description>
<GroupId>gtk-project</GroupId>
</TemplateConfiguration>
<Actions>
<Open filename="MainWindow.cs" />
</Actions>
<Combine name="${ProjectName}" directory=".">
<Options>
<StartupProject>${ProjectName}</StartupProject>
</Options>
<Project name="${ProjectName}" directory=".">
<Options Target = "WinExe"/>
<References>
<Reference type="Gac" refto="System" />
</References>
<Packages>
<package id="gtk-sharp3" />
</Packages>
<Files>
<File name="Program.cs" src="Data/Program.cs" />
<File name="MainWindow.glade" src="Data/MainWindow.glade" BuildAction="EmbeddedResource" ResourceId="MainWindow.glade" />
<File name="MainWindow.cs" src="Data/MainWindow.cs" DependsOn="MainWindow.glade" />
<FileTemplateReference TemplateID="CSharpAssemblyInfo" name="AssemblyInfo.cs" />
</Files>
</Project>
</Combine>
</Template>

View file

@ -0,0 +1,32 @@
<?xml version="1.0"?>
<Template>
<TemplateConfiguration>
<_Name>Gtk# Application</_Name>
<Icon>md-gui-project</Icon>
<_Category>multiplat/app/gtk</_Category>
<LanguageName>F#</LanguageName>
<Image id="md-gui-project" />
<_Description>Creates a new Gtk# multiplatform application.</_Description>
<GroupId>gtk-project</GroupId>
</TemplateConfiguration>
<Actions>
<Open filename="MainWindow.cs" />
</Actions>
<Combine name="${ProjectName}" directory=".">
<Options>
<StartupProject>${ProjectName}</StartupProject>
</Options>
<Project name="${ProjectName}" directory=".">
<Options Target = "WinExe"/>
<References>
<Reference type="Gac" refto="System" />
</References>
<Packages>
<package id="gtk-sharp3" />
</Packages>
<Files>
<FileTemplateReference TemplateID="FSharpAssemblyInfo" name="AssemblyInfo.cs" />
</Files>
</Project>
</Combine>
</Template>

View file

@ -0,0 +1,6 @@
#!/bin/bash
if [ -x "$(which glade)" ]; then
glade "$@"
elif [ -x "$(which flatpak)" ] && [ ! -z "$(flatpak list | grep org.gnome.Glade)" ]; then
flatpak run org.gnome.Glade "$@"
fi

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MonoDevelop.Addins" version="0.3.3" targetFramework="net45" />
</packages>