[gnome-builder] autotools-templates: Add a GNOME application template



commit 82c47cda95fc48c4b15037db9600048939ecd335
Author: Matthew Leeds <mleeds redhat com>
Date:   Mon Aug 1 11:53:19 2016 -0400

    autotools-templates: Add a GNOME application template
    
    This commit adds a template for GNOME applications. It's similar to the
    Empty Project template but it comes with a main function that creates an
    empty window, and it includes a flatpak manifest. Hopefully it will help
    newcomers get started on their first project.
    
    In the future we should probably add internationalization, gtk-doc, and
    GSettings code to the template, possibly as optional components.
    
    The flatpak manifest works when used with flatpak-builder but building
    the template in a flatpak runtime from within Builder doesn't seem to
    work yet.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=769564

 .../icons/hicolor/98x98/patterns/pattern-gnome.svg |   41 +++++++++++++++
 data/icons/hicolor/icons.gresource.xml             |    1 +
 .../autotools_templates/__init__.py                |   52 +++++++++++++++++++-
 .../resources/ManifestTemplate.flatpak.json        |   36 ++++++++++++++
 .../autotools_templates/resources/configure.ac     |    2 +-
 .../resources/src/Makefile.gnome-app               |   17 ++++++
 .../autotools_templates/resources/src/main.c       |   33 ++++++++++++
 .../autotools_templates/resources/src/main.cpp     |   21 ++++++++
 .../autotools_templates/resources/src/main.vala    |   21 ++++++++
 plugins/create-project/gbp-create-project-widget.c |    4 ++
 10 files changed, 225 insertions(+), 3 deletions(-)
---
diff --git a/data/icons/hicolor/98x98/patterns/pattern-gnome.svg 
b/data/icons/hicolor/98x98/patterns/pattern-gnome.svg
new file mode 100644
index 0000000..c69b6c8
--- /dev/null
+++ b/data/icons/hicolor/98x98/patterns/pattern-gnome.svg
@@ -0,0 +1,41 @@
+<?xml version='1.0' encoding='UTF-8' standalone='no'?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg xmlns:cc='http://creativecommons.org/ns#' xmlns:dc='http://purl.org/dc/elements/1.1/' 
sodipodi:docname='pattern-gnome.svg' height='98.464043' id='svg7384' 
xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' 
xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' 
xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns:svg='http://www.w3.org/2000/svg' 
version='1.1' inkscape:version='0.91 r13725' width='98' xmlns='http://www.w3.org/2000/svg'>
+  <metadata id='metadata90'>
+    <rdf:RDF>
+      <cc:Work rdf:about=''>
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type rdf:resource='http://purl.org/dc/dcmitype/StillImage'/>
+        <dc:title>Gnome Symbolic Icon Theme</dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <sodipodi:namedview inkscape:bbox-nodes='true' inkscape:bbox-paths='true' bordercolor='#666666' 
borderlayer='true' borderopacity='1' inkscape:current-layer='layer3' inkscape:cx='-191.87672' 
inkscape:cy='-60.498321' gridtolerance='10' inkscape:guide-bbox='true' guidetolerance='10' id='namedview88' 
inkscape:object-nodes='false' inkscape:object-paths='false' objecttolerance='10' pagecolor='#8ce0f0' 
inkscape:pageopacity='1' inkscape:pageshadow='2' showborder='false' showgrid='false' showguides='true' 
inkscape:showpageshadow='false' inkscape:snap-bbox='true' inkscape:snap-bbox-midpoints='false' 
inkscape:snap-global='true' inkscape:snap-grids='true' inkscape:snap-nodes='false' 
inkscape:snap-others='false' inkscape:snap-to-guides='true' inkscape:window-height='1009' 
inkscape:window-maximized='1' inkscape:window-width='1920' inkscape:window-x='0' inkscape:window-y='34' 
inkscape:zoom='1.4142136'>
+    <inkscape:grid empspacing='2' enabled='true' id='grid4866' originx='-500.00437' originy='0.041632664' 
snapvisiblegridlinesonly='true' spacingx='1px' spacingy='1px' type='xygrid' visible='true'/>
+  </sodipodi:namedview>
+  <title id='title9167'>Gnome Symbolic Icon Theme</title>
+  <defs id='defs7386'/>
+  <g inkscape:groupmode='layer' id='layer3' inkscape:label='patterns' 
transform='translate(-500.00437,82.42241)'>
+    <rect height='95' id='rect7610-2' rx='3.8039246' ry='3.8039246' 
style='color:#000000;display:inline;overflow:visible;visibility:visible;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#729fcf;stroke-width:3;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker:none;enable-background:new'
 width='95' x='501.50436' y='-80.458366'/>
+    <rect height='98' id='rect7630-9' 
style='color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.99999976;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;paint-order:normal;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate'
 width='98' x='500.00436' y='-82.422409'/>
+    <rect height='32' id='rect42957-1' inkscape:label='a' 
style='color:#bebebe;display:inline;overflow:visible;visibility:visible;fill:none;stroke:none;stroke-width:1;marker:none'
 width='32' x='533.25439' y='-48.734909'/>
+    <g id='g3771' style='fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-miterlimit:4' 
transform='matrix(0.42486067,0,0,0.42486067,525.13637,-66.422416)'>
+      <g id='g3773' style='fill:#000000;fill-opacity:1'>
+        <path inkscape:connector-curvature='0' d='M 86.068,0 C 61.466,0 56.851,35.041 70.691,35.041 
84.529,35.041 110.671,0 86.068,0 Z' id='path3775' style='fill:#000000;fill-opacity:1'/>
+        <path inkscape:connector-curvature='0' d='M 45.217,30.699 C 52.586,31.149 60.671,2.577 46.821,4.374 
32.976,6.171 37.845,30.249 45.217,30.699 Z' id='path3777' style='fill:#000000;fill-opacity:1'/>
+        <path inkscape:connector-curvature='0' d='M 11.445,48.453 C 16.686,46.146 12.12,23.581 3.208,29.735 
-5.7,35.89 6.204,50.759 11.445,48.453 Z' id='path3779' style='fill:#000000;fill-opacity:1'/>
+        <path inkscape:connector-curvature='0' d='M 26.212,36.642 C 32.451,35.37 32.793,9.778 21.667,14.369 
10.539,18.961 19.978,37.916 26.212,36.642 l 0,0 z' id='path3781' style='fill:#000000;fill-opacity:1'/>
+        <path inkscape:connector-curvature='0' d='m 58.791,93.913 c 1.107,8.454 -6.202,12.629 -13.36,7.179 C 
22.644,83.743 83.16,75.088 79.171,51.386 75.86,31.712 15.495,37.769 8.621,68.553 3.968,89.374 27.774,118.26 
52.614,118.26 c 12.22,0 26.315,-11.034 28.952,-25.012 C 83.58,82.589 57.867,86.86 58.791,93.913 l 0,0 z' 
id='path3783' style='fill:#000000;fill-opacity:1'/>
+      </g>
+    </g>
+    <g id='g3956' transform='matrix(0.16008135,0,0,0.16008135,635.7135,-92.450831)'>
+      <path inkscape:connector-curvature='0' d='m -565.99523,509.46063 c -8.08731,0.21792 -14.47394,3.12448 
-19.17071,8.69866 -4.86385,5.80101 -7.31024,13.81651 -7.31024,24.03862 0,10.19394 2.44651,18.18745 
7.31024,23.98846 4.88761,5.801 11.59815,8.69866 20.15764,8.69866 8.5831,0 15.3105,-2.89766 20.17436,-8.69866 
4.86373,-5.80101 7.29358,-13.79452 7.29353,-23.98846 -5e-5,-10.22211 -2.4298,-18.23761 -7.29353,-24.03862 
-4.86386,-5.80075 -11.59131,-8.69866 -20.17436,-8.69866 -0.33434,0 -0.6582,-0.009 -0.98693,0 z m 
0.60221,11.77669 c 0.12927,-0.003 0.25357,0 0.38472,0 4.21998,0 7.48996,1.8261 9.8028,5.48697 2.31266,3.66086 
3.47944,8.82788 3.47949,15.47362 0,6.61757 -1.16692,11.74604 -3.47949,15.40691 -2.31274,3.66086 
-5.58286,5.50352 -9.8028,5.50352 -4.19632,0 -7.43983,-1.84266 -9.75257,-5.50352 -2.31274,-3.66087 
-3.47944,-8.78934 -3.47949,-15.40691 0,-6.64574 1.16684,-11.81276 3.47949,-15.47362 2.24035,-3.54647 
5.35963,-5.37604 9.36785,-5.48697 z' id='path3787' style='font-st
 
yle:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:148.699646px;line-height:125%;font-family:&apos;Bitstream
 Vera 
Sans&apos;;text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1'/>
+      <path inkscape:connector-curvature='0' d='m -657.35432,568.97161 c -7.12362,5.98235 -17.72219,5.91366 
-22.13752,5.91366 -8.8932,0 -15.93855,-2.92879 -21.13613,-8.78612 -5.19765,-5.88525 -7.7964,-13.85456 
-7.7964,-23.90791 0,-10.16578 2.64646,-18.16325 7.93945,-23.99241 5.293,-5.82892 12.54098,-8.74363 
21.74413,-8.74363 3.55245,0 6.94991,0.39433 10.19254,1.18273 3.26638,0.78841 6.34203,1.95706 9.22697,3.50595 
l -3.70487,10.9527 c -1.62185,-0.88773 -3.4788,-1.76286 -5.20022,-2.37807 -2.93262,-0.98557 -5.87712,-1.47823 
-8.83351,-1.47823 -5.48379,0 -9.71581,1.81623 -12.69601,5.44892 -2.95649,3.60454 -4.4347,8.7718 
-4.4347,15.50204 0,6.67415 1.4305,11.82733 4.29167,15.46003 2.86099,3.6327 7.16068,5.44892 12.19522,5.44892 
5.11476,0 8.28269,-1.28922 9.97226,-2.64762 l 0,-10.91144 -11.08087,0 0,-10.89809 21.45799,0' id='path3789' 
style='font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:148.699646px;line-height:125%;font-family:&apos;Bitstream
  Vera 
Sans&apos;;text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1'/>
+      <path inkscape:connector-curvature='0' d='m -528.50252,510.59568 17.5241,0 12.15952,39.37066 
12.23105,-39.37066 14.81181,0 6.69132,63.06461 -13.01787,0 -4.0148,-39.4349 -12.30257,39.62391 -8.72628,0 
-12.30263,-40.9623 -4.01479,40.77329 -13.05365,0 6.69132,-63.06461' id='path3793' 
style='font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:148.699646px;line-height:125%;font-family:&apos;Bitstream
 Vera 
Sans&apos;;text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1'/>
+      <path inkscape:connector-curvature='0' d='m -455.68828,510.59568 37.15811,0 0,12.29183 -23.38928,0 
0,13.08097 17.97969,0 0,10.95369 -17.97969,0 0,14.44629 24.17608,0 0,12.29183 -37.94491,0 0,-63.06461' 
id='path3795' 
style='font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:148.699646px;line-height:125%;font-family:&apos;Bitstream
 Vera 
Sans&apos;;text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1'/>
+      <path inkscape:connector-curvature='0' d='m -647.94283,510.59568 8.6869,0 27.44915,37.90083 
0,-37.90083 11.71533,0 0,63.06461 -8.6869,0 -27.4491,-37.90083 0,37.90083 -11.71538,0 0,-63.06461' 
id='path3791' 
style='font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:148.699646px;line-height:125%;font-family:&apos;Bitstream
 Vera 
Sans&apos;;text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1'/>
+    </g>
+    <text id='text3797' xml:space='preserve' 
style='font-style:normal;font-weight:normal;font-size:3.77335668px;font-family:&apos;Bitstream Vera 
Sans&apos;;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1'
 x='570.47583' y='-8.2047768'><tspan id='tspan3799' style='letter-spacing:1.36017227' x='570.47583' 
y='-8.2047768'><tspan id='tspan3801' style='letter-spacing:0.0310309'>TM</tspan></tspan></text>
+  </g>
+</svg>
diff --git a/data/icons/hicolor/icons.gresource.xml b/data/icons/hicolor/icons.gresource.xml
index 97df7f4..5ddb90c 100644
--- a/data/icons/hicolor/icons.gresource.xml
+++ b/data/icons/hicolor/icons.gresource.xml
@@ -37,6 +37,7 @@
     <file compressed="true" alias="scalable/actions/pattern-grid.svg">98x98/patterns/pattern-grid.svg</file>
     <file compressed="true" 
alias="scalable/actions/pattern-legacy.svg">98x98/patterns/pattern-legacy.svg</file>
     <file compressed="true" 
alias="scalable/actions/pattern-library.svg">98x98/patterns/pattern-library.svg</file>
+    <file compressed="true" 
alias="scalable/actions/pattern-gnome.svg">98x98/patterns/pattern-gnome.svg</file>
 
     <file>256x256/actions/builder-vcs-git.png</file>
     <file>48x48/actions/builder-vcs-git.png</file>
diff --git a/plugins/autotools-templates/autotools_templates/__init__.py 
b/plugins/autotools-templates/autotools_templates/__init__.py
index 7a8186d..2c2bbfa 100644
--- a/plugins/autotools-templates/autotools_templates/__init__.py
+++ b/plugins/autotools-templates/autotools_templates/__init__.py
@@ -43,7 +43,7 @@ def get_module_data_path(name):
 
 class LibraryTemplateProvider(GObject.Object, Ide.TemplateProvider):
     def do_get_project_templates(self):
-        return [LibraryProjectTemplate(), EmptyProjectTemplate()]
+        return [LibraryProjectTemplate(), EmptyProjectTemplate(), GnomeProjectTemplate()]
 
 class AutotoolsTemplateLocator(Template.TemplateLocator):
     license = None
@@ -115,6 +115,10 @@ class AutotoolsTemplate(Ide.TemplateBase, Ide.ProjectTemplate):
                                          self.language))
             return
 
+        self.versioning = ''
+        if 'versioning' in params:
+            self.versioning = params['versioning'].get_string()
+
         if 'author' in params:
             author_name = params['author'].get_string()
         else:
@@ -129,6 +133,7 @@ class AutotoolsTemplate(Ide.TemplateBase, Ide.ProjectTemplate):
         prefix = name if not name.endswith('-glib') else name[:-5]
         PREFIX = prefix.upper().replace('-','_')
         prefix_ = prefix.lower().replace('-','_')
+        PreFix = ''.join([word.capitalize() for word in prefix.lower().split('-')])
 
         scope.get('name').assign_string(name)
         scope.get('name_').assign_string(name.lower().replace('-','_'))
@@ -136,10 +141,12 @@ class AutotoolsTemplate(Ide.TemplateBase, Ide.ProjectTemplate):
 
         scope.get('prefix').assign_string(prefix)
         scope.get('Prefix').assign_string(prefix.capitalize())
+        scope.get('PreFix').assign_string(PreFix)
         scope.get('prefix_').assign_string(prefix_)
         scope.get('PREFIX').assign_string(PREFIX)
 
-        scope.get('packages').assign_string("gio-2.0 >= 2.42")
+        scope.get('project_path').assign_string(directory.get_path())
+        scope.get('packages').assign_string(self.get_packages())
         scope.get('major_version').assign_string('0')
         scope.get('minor_version').assign_string('1')
         scope.get('micro_version').assign_string('0')
@@ -160,6 +167,7 @@ class AutotoolsTemplate(Ide.TemplateBase, Ide.ProjectTemplate):
         expands = {
             'name': name,
             'prefix': prefix,
+            'PreFix': PreFix,
         }
 
         files = {
@@ -243,6 +251,9 @@ class AutotoolsTemplate(Ide.TemplateBase, Ide.ProjectTemplate):
     def prepare_file_modes(self, modes):
         pass
 
+    def get_packages(self):
+        pass
+
 class LibraryProjectTemplate(AutotoolsTemplate):
     def __init__(self):
         super().__init__(
@@ -253,6 +264,9 @@ class LibraryProjectTemplate(AutotoolsTemplate):
             ['C', 'C++', 'Vala']
          )
 
+    def get_packages(self):
+        return "gio-2.0 >= 2.42"
+
     def prepare_files(self, files):
         files['resources/data/package.pc.in'] = 'data/%(name)s.pc.in'
 
@@ -277,6 +291,40 @@ class EmptyProjectTemplate(AutotoolsTemplate):
             ['C', 'C++', 'Vala']
          )
 
+    def get_packages(self):
+        return "gio-2.0 >= 2.42"
+
     def prepare_files(self, files):
         files['resources/src/Makefile.empty'] = 'src/Makefile.am'
 
+class GnomeProjectTemplate(AutotoolsTemplate):
+    def __init__(self):
+        super().__init__(
+            'gnome-app',
+            _("GNOME Application"),
+            'pattern-gnome',
+            _("Create a new flatpak-ready GNOME application"),
+            ['C', 'C++', 'Vala']
+         )
+
+    def get_packages(self):
+        if self.language == "c" or self.language == "vala":
+            return "gio-2.0 >= 2.42 gtk+-3.0 >= 3.20"
+        elif self.language == "c++":
+            return "giomm-2.4 >= 2.42 gtkmm-3.0 >= 3.20"
+        else:
+            return ""
+
+    def prepare_files(self, files):
+        files['resources/src/Makefile.gnome-app'] = 'src/Makefile.am'
+
+        if self.versioning == 'git':
+            files['resources/ManifestTemplate.flatpak.json'] = 'org.gnome.%(PreFix)s.flatpak.json'
+
+        if self.language == 'c':
+            files['resources/src/main.c'] = 'src/main.c'
+        elif self.language == 'c++':
+            files['resources/src/main.cpp'] = 'src/main.cpp'
+        elif self.language == 'vala':
+            files['resources/src/main.vala'] = 'src/main.vala'
+
diff --git a/plugins/autotools-templates/autotools_templates/resources/ManifestTemplate.flatpak.json 
b/plugins/autotools-templates/autotools_templates/resources/ManifestTemplate.flatpak.json
new file mode 100644
index 0000000..e03306b
--- /dev/null
+++ b/plugins/autotools-templates/autotools_templates/resources/ManifestTemplate.flatpak.json
@@ -0,0 +1,36 @@
+{
+    "app-id": "org.gnome.{{PreFix}}",
+    "runtime": "org.gnome.Platform",
+    "runtime-version": "3.20",
+    "sdk": "org.gnome.Sdk",
+    "command": "{{name}}",
+    "finish-args": [
+        "--share=ipc", "--socket=x11",
+        "--socket=wayland",
+        "--filesystem=xdg-run/dconf", "--filesystem=~/.config/dconf:ro",
+        "--talk-name=ca.desrt.dconf", "--env=DCONF_USER_CONFIG_DIR=.config/dconf"
+    ],
+    "build-options" : {
+        "cflags": "-O2 -g",
+        "cxxflags": "-O2 -g",
+        "env": {
+            "V": "1"
+        }
+    },
+    "cleanup": ["/include", "/lib/pkgconfig",
+                "/share/pkgconfig", "/share/aclocal",
+                "/man", "/share/man", "/share/gtk-doc",
+                "/share/vala",
+                "*.la", "*.a"],
+    "modules": [
+        {
+            "name": "{{name}}",
+            "sources": [
+                    {
+                        "type": "git",
+                        "url": "file://{{project_path}}"
+                    }
+            ]
+        }
+    ]
+}
diff --git a/plugins/autotools-templates/autotools_templates/resources/configure.ac 
b/plugins/autotools-templates/autotools_templates/resources/configure.ac
index 60fffa9..af75957 100644
--- a/plugins/autotools-templates/autotools_templates/resources/configure.ac
+++ b/plugins/autotools-templates/autotools_templates/resources/configure.ac
@@ -18,7 +18,7 @@ dnl Initialize autoconf
 dnl ***********************************************************************
 AC_INIT([{{name}}],[package_version],[bug_report_url])
 AC_CONFIG_HEADERS([config.h])
-{{if template != "empty"}}
+{{if template == "shared-library"}}
 AC_CONFIG_SRCDIR([data/{{name}}.pc.in])
 {{else}}
 AC_CONFIG_SRCDIR([NEWS])
diff --git a/plugins/autotools-templates/autotools_templates/resources/src/Makefile.gnome-app 
b/plugins/autotools-templates/autotools_templates/resources/src/Makefile.gnome-app
new file mode 100644
index 0000000..1805efb
--- /dev/null
+++ b/plugins/autotools-templates/autotools_templates/resources/src/Makefile.gnome-app
@@ -0,0 +1,17 @@
+bin_PROGRAMS = {{name}}
+
+{{if language == "c"}}
+{{prefix_}}_SOURCES = main.c
+{{prefix_}}_CFLAGS = $({{PREFIX}}_CFLAGS)
+{{else if language == "c++"}}
+{{prefix_}}_SOURCES = main.cpp
+{{prefix_}}_CPPFLAGS = $({{PREFIX}}_CFLAGS)
+{{else if language == "vala"}}
+{{prefix_}}_SOURCES = main.vala
+{{prefix_}}_CPPFLAGS = $({{PREFIX}}_CFLAGS)
+{{prefix_}}_VALAFLAGS = --pkg gtk+-3.0
+{{end}}
+
+{{prefix_}}_LDADD = $({{PREFIX}}_LIBS)
+
+-include $(top_srcdir)/git.mk
diff --git a/plugins/autotools-templates/autotools_templates/resources/src/main.c 
b/plugins/autotools-templates/autotools_templates/resources/src/main.c
new file mode 100644
index 0000000..2991275
--- /dev/null
+++ b/plugins/autotools-templates/autotools_templates/resources/src/main.c
@@ -0,0 +1,33 @@
+{{include "license.c"}}
+
+#include <gtk/gtk.h>
+
+static void
+activate (GtkApplication *app,
+          gpointer        user_data)
+{
+    GtkWidget *window;
+
+    window = gtk_application_window_new (app);
+    gtk_window_set_title (GTK_WINDOW (window), "{{name}}");
+    gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);
+
+    /* You can add GTK+ widgets to your window here.
+     * See https://developer.gnome.org/ for help.
+     */
+
+    gtk_widget_show (window);
+}
+
+int main(int   argc,
+         char *argv[])
+{
+    g_autoptr(GtkApplication) app = NULL;
+    int status;
+
+    app = gtk_application_new ("org.gnome.{{PreFix}}", G_APPLICATION_FLAGS_NONE);
+    g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
+    status = g_application_run (G_APPLICATION (app), argc, argv);
+
+    return status;
+}
diff --git a/plugins/autotools-templates/autotools_templates/resources/src/main.cpp 
b/plugins/autotools-templates/autotools_templates/resources/src/main.cpp
new file mode 100644
index 0000000..089e5f8
--- /dev/null
+++ b/plugins/autotools-templates/autotools_templates/resources/src/main.cpp
@@ -0,0 +1,21 @@
+{{include "license.cpp"}}
+
+#include <gtkmm.h>
+
+int main(int   argc,
+         char *argv[])
+{
+    auto app =
+      Gtk::Application::create(argc, argv,
+                               "org.gnome.{{PreFix}}");
+
+    Gtk::Window window;
+    window.set_title ("{{name}}");
+    window.set_default_size(200, 200);
+
+    /* You can add GTK+ widgets to your window here.
+     * See https://developer.gnome.org/ for help.
+     */
+
+    return app->run(window);
+}
diff --git a/plugins/autotools-templates/autotools_templates/resources/src/main.vala 
b/plugins/autotools-templates/autotools_templates/resources/src/main.vala
new file mode 100644
index 0000000..4ea0a72
--- /dev/null
+++ b/plugins/autotools-templates/autotools_templates/resources/src/main.vala
@@ -0,0 +1,21 @@
+{{include "license.vala"}}
+
+using Gtk;
+
+int main (string[] args) {
+    Gtk.init (ref args);
+
+    var window = new Window ();
+    window.title = "{{name}}";
+    window.set_default_size (200, 200);
+    window.destroy.connect (Gtk.main_quit);
+
+    /* You can add GTK+ widgets to your window here.
+     * See https://developer.gnome.org/ for help.
+     */
+
+    window.show_all ();
+
+    Gtk.main ();
+    return 0;
+}
diff --git a/plugins/create-project/gbp-create-project-widget.c 
b/plugins/create-project/gbp-create-project-widget.c
index efa345f..90ee109 100644
--- a/plugins/create-project/gbp-create-project-widget.c
+++ b/plugins/create-project/gbp-create-project-widget.c
@@ -605,6 +605,10 @@ gbp_create_project_widget_create_async (GbpCreateProjectWidget *self,
 
   if (gtk_switch_get_active (self->versioning_switch))
     {
+      g_hash_table_insert (params,
+                           g_strdup ("versioning"),
+                           g_variant_ref_sink (g_variant_new_string ("git")));
+
       engine = peas_engine_get_default ();
       plugin_info = peas_engine_get_plugin_info (engine, vcs_id);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]