Commit 12f3dc7c authored by Christian Hergert's avatar Christian Hergert

meson-templates: use gresources for template files

This moves the template files for the meson-templates plugin
into a .gresources which can be loaded by the plugin layer.
parent b8bfcc54
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/builder/plugins/meson_templates">
<file compressed="true">resources/src/window.ui</file>
<file compressed="true">resources/src/window.js</file>
<file compressed="true">resources/src/meson-py.build</file>
<file compressed="true">resources/src/window.h</file>
<file compressed="true">resources/src/hello.js.in</file>
<file compressed="true">resources/src/hello.gresource.xml</file>
<file compressed="true">resources/src/hello-version.h.in</file>
<file compressed="true">resources/src/meson-clib.build</file>
<file compressed="true">resources/src/meson-js.build</file>
<file compressed="true">resources/src/hello.h</file>
<file compressed="true">resources/src/__init__.py</file>
<file compressed="true">resources/src/meson-c-vala.build</file>
<file compressed="true">resources/src/meson-empty.build</file>
<file compressed="true">resources/src/gi_composites.py</file>
<file compressed="true">resources/src/main.js</file>
<file compressed="true">resources/src/main.c</file>
<file compressed="true">resources/src/window.py</file>
<file compressed="true">resources/src/window.c</file>
<file compressed="true">resources/src/hello.src.gresource.xml</file>
<file compressed="true">resources/src/window.vala</file>
<file compressed="true">resources/src/main.vala</file>
<file compressed="true">resources/src/hello.py.in</file>
<file compressed="true">resources/src/main.py</file>
<file compressed="true">resources/build-aux/meson/postinstall.py</file>
<file compressed="true">resources/meson.build</file>
<file compressed="true">resources/flatpak.json</file>
<file compressed="true">resources/data/meson.build</file>
<file compressed="true">resources/data/hello.gschema.xml</file>
<file compressed="true">resources/data/hello.desktop.in</file>
<file compressed="true">resources/data/hello.appdata.xml.in</file>
<file compressed="true">resources/po/meson.build</file>
<file compressed="true">resources/po/POTFILES</file>
<file compressed="true">resources/po/LINGUAS</file>
</gresource>
</gresources>
if get_option('with_meson_templates')
meson_template_datadir = join_paths(plugindatadir, 'meson_templates')
devhelp_resources = gnome.compile_resources(
'meson_templates',
'meson-templates.gresource.xml',
gresource_bundle: true,
install: true,
install_dir: plugindir,
)
meson_template_dir = join_paths(plugindir, 'meson_templates')
install_data('meson_templates/__init__.py', install_dir: meson_template_dir)
install_subdir('meson_templates/resources', install_dir: meson_template_datadir)
configure_file(
input: 'meson-templates.plugin',
......
......@@ -35,14 +35,6 @@ from gi.repository import (
_ = Ide.gettext
def get_module_data_path(name):
engine = Peas.Engine.get_default()
plugin = engine.get_plugin_info('meson_templates')
data_dir = plugin.get_data_dir()
return path.join(data_dir, name)
class LibraryTemplateProvider(GObject.Object, Ide.TemplateProvider):
def do_get_project_templates(self):
return [GnomeProjectTemplate(), LibraryProjectTemplate(), EmptyProjectTemplate()]
......@@ -208,8 +200,8 @@ class MesonTemplate(Ide.TemplateBase, Ide.ProjectTemplate):
if src.startswith('resource://'):
self.add_resource(src[11:], destination, scope, modes.get(src, 0))
else:
path = get_module_data_path(src)
self.add_path(path, destination, scope, modes.get(src, 0))
path = os.path.join('/org/gnome/builder/plugins/meson_templates', src)
self.add_resource(path, destination, scope, modes.get(src, 0))
self.expand_all_async(cancellable, self.expand_all_cb, task)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment