[gnome-builder/wip/gtk4-port] libide/projects: add properties to IdeProjectTemplate
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port] libide/projects: add properties to IdeProjectTemplate
- Date: Tue, 7 Jun 2022 19:48:11 +0000 (UTC)
commit 58535212ec32b8d4050dae0d2001a7311160b8b1
Author: Christian Hergert <chergert redhat com>
Date: Tue Jun 7 12:46:33 2022 -0700
libide/projects: add properties to IdeProjectTemplate
There isn't much of a need for the IdeProjectTemplate to have been an
interface, and now that it's an object we can push all of these properties
into the base object to simplify plugins a bit more.
src/libide/projects/ide-project-template.c | 187 +++++++++++++++------
src/libide/projects/ide-project-template.h | 56 +++---
src/libide/projects/ide-template-input.c | 39 ++---
.../create-project/gbp-create-project-widget.c | 2 +-
src/plugins/make/gbp-make-template.c | 44 -----
src/plugins/meson-templates/meson_templates.py | 92 ++++------
6 files changed, 211 insertions(+), 209 deletions(-)
---
diff --git a/src/libide/projects/ide-project-template.c b/src/libide/projects/ide-project-template.c
index b76a12300..3b94240b4 100644
--- a/src/libide/projects/ide-project-template.c
+++ b/src/libide/projects/ide-project-template.c
@@ -24,13 +24,24 @@
#include "ide-project-template.h"
-G_DEFINE_TYPE (IdeProjectTemplate, ide_project_template, IDE_TYPE_TEMPLATE_BASE)
+typedef struct
+{
+ char *id;
+ char *name;
+ char *description;
+ char **languages;
+ int priority;
+} IdeProjectTemplatePrivate;
+
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (IdeProjectTemplate, ide_project_template, IDE_TYPE_TEMPLATE_BASE)
enum {
PROP_0,
PROP_DESCRIPTION,
PROP_ID,
PROP_NAME,
+ PROP_LANGUAGES,
+ PROP_PRIORITY,
N_PROPS
};
@@ -100,6 +111,20 @@ ide_project_template_real_validate_app_id (IdeProjectTemplate *self,
return n_dots >= 2;
}
+static void
+ide_project_template_dispose (GObject *object)
+{
+ IdeProjectTemplate *self = (IdeProjectTemplate *)object;
+ IdeProjectTemplatePrivate *priv = ide_project_template_get_instance_private (self);
+
+ g_clear_pointer (&priv->id, g_free);
+ g_clear_pointer (&priv->name, g_free);
+ g_clear_pointer (&priv->description, g_free);
+ g_clear_pointer (&priv->languages, g_strfreev);
+
+ G_OBJECT_CLASS (ide_project_template_parent_class)->dispose (object);
+}
+
static void
ide_project_template_get_property (GObject *object,
guint prop_id,
@@ -111,15 +136,59 @@ ide_project_template_get_property (GObject *object,
switch (prop_id)
{
case PROP_DESCRIPTION:
- g_value_take_string (value, ide_project_template_get_description (self));
+ g_value_set_string (value, ide_project_template_get_description (self));
+ break;
+
+ case PROP_ID:
+ g_value_set_string (value, ide_project_template_get_id (self));
+ break;
+
+ case PROP_NAME:
+ g_value_set_string (value, ide_project_template_get_name (self));
+ break;
+
+ case PROP_LANGUAGES:
+ g_value_set_boxed (value, ide_project_template_get_languages (self));
+ break;
+
+ case PROP_PRIORITY:
+ g_value_set_int (value, ide_project_template_get_priority (self));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+static void
+ide_project_template_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ IdeProjectTemplate *self = IDE_PROJECT_TEMPLATE (object);
+ IdeProjectTemplatePrivate *priv = ide_project_template_get_instance_private (self);
+
+ switch (prop_id)
+ {
+ case PROP_DESCRIPTION:
+ priv->description = g_value_dup_string (value);
break;
case PROP_ID:
- g_value_take_string (value, ide_project_template_get_id (self));
+ priv->id = g_value_dup_string (value);
break;
case PROP_NAME:
- g_value_take_string (value, ide_project_template_get_name (self));
+ priv->name = g_value_dup_string (value);
+ break;
+
+ case PROP_LANGUAGES:
+ priv->languages = g_value_dup_boxed (value);
+ break;
+
+ case PROP_PRIORITY:
+ priv->priority = g_value_get_int (value);
break;
default:
@@ -132,22 +201,44 @@ ide_project_template_class_init (IdeProjectTemplateClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ object_class->dispose = ide_project_template_dispose;
object_class->get_property = ide_project_template_get_property;
+ object_class->set_property = ide_project_template_set_property;
klass->validate_name = ide_project_template_real_validate_name;
klass->validate_app_id = ide_project_template_real_validate_app_id;
properties [PROP_ID] =
g_param_spec_string ("id", NULL, NULL, NULL,
- (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+ (G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS));
properties [PROP_NAME] =
g_param_spec_string ("name", NULL, NULL, NULL,
- (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+ (G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS));
properties [PROP_DESCRIPTION] =
g_param_spec_string ("description", NULL, NULL, NULL,
- (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+ (G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS));
+
+ properties [PROP_LANGUAGES] =
+ g_param_spec_boxed ("languages", NULL, NULL,
+ G_TYPE_STRV,
+ (G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS));
+
+ properties [PROP_PRIORITY] =
+ g_param_spec_int ("priority", NULL, NULL,
+ G_MININT, G_MAXINT, 0,
+ (G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS));
g_object_class_install_properties (object_class, N_PROPS, properties);
}
@@ -157,28 +248,34 @@ ide_project_template_init (IdeProjectTemplate *self)
{
}
-gchar *
+const char *
ide_project_template_get_id (IdeProjectTemplate *self)
{
+ IdeProjectTemplatePrivate *priv = ide_project_template_get_instance_private (self);
+
g_return_val_if_fail (IDE_IS_PROJECT_TEMPLATE (self), NULL);
- return IDE_PROJECT_TEMPLATE_GET_CLASS (self)->get_id (self);
+ return priv->id;
}
-gchar *
+const char *
ide_project_template_get_name (IdeProjectTemplate *self)
{
+ IdeProjectTemplatePrivate *priv = ide_project_template_get_instance_private (self);
+
g_return_val_if_fail (IDE_IS_PROJECT_TEMPLATE (self), NULL);
- return IDE_PROJECT_TEMPLATE_GET_CLASS (self)->get_name (self);
+ return priv->name;
}
-gchar *
+const char *
ide_project_template_get_description (IdeProjectTemplate *self)
{
+ IdeProjectTemplatePrivate *priv = ide_project_template_get_instance_private (self);
+
g_return_val_if_fail (IDE_IS_PROJECT_TEMPLATE (self), NULL);
- return IDE_PROJECT_TEMPLATE_GET_CLASS (self)->get_description (self);
+ return priv->description;
}
/**
@@ -188,23 +285,26 @@ ide_project_template_get_description (IdeProjectTemplate *self)
* Gets the list of languages that this template can support when generating
* the project.
*
- * Returns: (transfer full): A newly allocated, NULL terminated list of
- * supported languages.
+ * Returns: (transfer none) (nullable): an array of language names
*/
-gchar **
+const char * const *
ide_project_template_get_languages (IdeProjectTemplate *self)
{
+ IdeProjectTemplatePrivate *priv = ide_project_template_get_instance_private (self);
+
g_return_val_if_fail (IDE_IS_PROJECT_TEMPLATE (self), NULL);
- return IDE_PROJECT_TEMPLATE_GET_CLASS (self)->get_languages (self);
+ return (const char * const *)priv->languages;
}
-gchar *
-ide_project_template_get_icon_name (IdeProjectTemplate *self)
+int
+ide_project_template_get_priority (IdeProjectTemplate *self)
{
- g_return_val_if_fail (IDE_IS_PROJECT_TEMPLATE (self), NULL);
+ IdeProjectTemplatePrivate *priv = ide_project_template_get_instance_private (self);
+
+ g_return_val_if_fail (IDE_IS_PROJECT_TEMPLATE (self), 0);
- return IDE_PROJECT_TEMPLATE_GET_CLASS (self)->get_icon_name (self);
+ return priv->priority;
}
/**
@@ -250,45 +350,30 @@ ide_project_template_expand_finish (IdeProjectTemplate *self,
return IDE_PROJECT_TEMPLATE_GET_CLASS (self)->expand_finish (self, result, error);
}
-/**
- * ide_project_template_get_priority:
- * @self: a #IdeProjectTemplate
- *
- * Gets the priority of the template. This can be used to sort the templates
- * in the "new project" view.
- *
- * Returns: the priority of the template
- */
-gint
-ide_project_template_get_priority (IdeProjectTemplate *self)
-{
- g_return_val_if_fail (IDE_IS_PROJECT_TEMPLATE (self), 0);
-
- if (IDE_PROJECT_TEMPLATE_GET_CLASS (self)->get_priority)
- return IDE_PROJECT_TEMPLATE_GET_CLASS (self)->get_priority (self);
-
- return 0;
-}
-
-gint
+int
ide_project_template_compare (IdeProjectTemplate *a,
IdeProjectTemplate *b)
{
- gint ret;
+ const char *a_name;
+ const char *b_name;
+ int prio_a;
+ int prio_b;
g_return_val_if_fail (IDE_IS_PROJECT_TEMPLATE (a), 0);
g_return_val_if_fail (IDE_IS_PROJECT_TEMPLATE (b), 0);
- ret = ide_project_template_get_priority (a) - ide_project_template_get_priority (b);
+ prio_a = ide_project_template_get_priority (a);
+ prio_b = ide_project_template_get_priority (b);
- if (ret == 0)
- {
- g_autofree gchar *a_name = ide_project_template_get_name (a);
- g_autofree gchar *b_name = ide_project_template_get_name (b);
- ret = g_utf8_collate (a_name, b_name);
- }
+ if (prio_a < prio_b)
+ return -1;
+ else if (prio_a > prio_b)
+ return 1;
+
+ a_name = ide_project_template_get_name (a);
+ b_name = ide_project_template_get_name (b);
- return ret;
+ return g_utf8_collate (a_name, b_name);
}
gboolean
diff --git a/src/libide/projects/ide-project-template.h b/src/libide/projects/ide-project-template.h
index f2b4f5f7c..a1f8d596a 100644
--- a/src/libide/projects/ide-project-template.h
+++ b/src/libide/projects/ide-project-template.h
@@ -43,11 +43,10 @@ struct _IdeProjectTemplateClass
{
IdeTemplateBaseClass parent_instance;
- gchar *(*get_id) (IdeProjectTemplate *self);
- gchar *(*get_name) (IdeProjectTemplate *self);
- gchar *(*get_description) (IdeProjectTemplate *self);
- gchar **(*get_languages) (IdeProjectTemplate *self);
- gchar *(*get_icon_name) (IdeProjectTemplate *self);
+ gboolean (*validate_name) (IdeProjectTemplate *self,
+ const char *name);
+ gboolean (*validate_app_id) (IdeProjectTemplate *self,
+ const char *app_id);
void (*expand_async) (IdeProjectTemplate *self,
IdeTemplateInput *input,
TmplScope *scope,
@@ -57,44 +56,37 @@ struct _IdeProjectTemplateClass
gboolean (*expand_finish) (IdeProjectTemplate *self,
GAsyncResult *result,
GError **error);
- gint (*get_priority) (IdeProjectTemplate *self);
- gboolean (*validate_name) (IdeProjectTemplate *self,
- const char *name);
- gboolean (*validate_app_id) (IdeProjectTemplate *self,
- const char *app_id);
};
IDE_AVAILABLE_IN_ALL
-gchar *ide_project_template_get_id (IdeProjectTemplate *self);
-IDE_AVAILABLE_IN_ALL
-gint ide_project_template_get_priority (IdeProjectTemplate *self);
+const char *ide_project_template_get_id (IdeProjectTemplate *self);
IDE_AVAILABLE_IN_ALL
-gchar *ide_project_template_get_name (IdeProjectTemplate *self);
+int ide_project_template_get_priority (IdeProjectTemplate *self);
IDE_AVAILABLE_IN_ALL
-gchar *ide_project_template_get_description (IdeProjectTemplate *self);
+const char *ide_project_template_get_name (IdeProjectTemplate *self);
IDE_AVAILABLE_IN_ALL
-gchar **ide_project_template_get_languages (IdeProjectTemplate *self);
+const char *ide_project_template_get_description (IdeProjectTemplate *self);
IDE_AVAILABLE_IN_ALL
-gchar *ide_project_template_get_icon_name (IdeProjectTemplate *self);
+const char * const *ide_project_template_get_languages (IdeProjectTemplate *self);
IDE_AVAILABLE_IN_ALL
-void ide_project_template_expand_async (IdeProjectTemplate *self,
- IdeTemplateInput *input,
- TmplScope *scope,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
+void ide_project_template_expand_async (IdeProjectTemplate *self,
+ IdeTemplateInput *input,
+ TmplScope *scope,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
IDE_AVAILABLE_IN_ALL
-gboolean ide_project_template_expand_finish (IdeProjectTemplate *self,
- GAsyncResult *result,
- GError **error);
+gboolean ide_project_template_expand_finish (IdeProjectTemplate *self,
+ GAsyncResult *result,
+ GError **error);
IDE_AVAILABLE_IN_ALL
-gint ide_project_template_compare (IdeProjectTemplate *a,
- IdeProjectTemplate *b);
+int ide_project_template_compare (IdeProjectTemplate *a,
+ IdeProjectTemplate *b);
IDE_AVAILABLE_IN_ALL
-gboolean ide_project_template_validate_name (IdeProjectTemplate *self,
- const char *name);
+gboolean ide_project_template_validate_name (IdeProjectTemplate *self,
+ const char *name);
IDE_AVAILABLE_IN_ALL
-gboolean ide_project_template_validate_app_id (IdeProjectTemplate *self,
- const char *app_id);
+gboolean ide_project_template_validate_app_id (IdeProjectTemplate *self,
+ const char *app_id);
G_END_DECLS
diff --git a/src/libide/projects/ide-template-input.c b/src/libide/projects/ide-template-input.c
index edb2e7b96..786ca22c4 100644
--- a/src/libide/projects/ide-template-input.c
+++ b/src/libide/projects/ide-template-input.c
@@ -97,7 +97,7 @@ static const struct {
{ "No License", NULL, NULL },
};
-static char *
+static const char *
get_template_name (IdeTemplateInput *self)
{
guint n_items;
@@ -109,7 +109,7 @@ get_template_name (IdeTemplateInput *self)
for (guint i = 0; i < n_items; i++)
{
g_autoptr(IdeProjectTemplate) template = g_list_model_get_item (G_LIST_MODEL (self->templates), i);
- g_autofree char *id = ide_project_template_get_id (template);
+ const char *id = ide_project_template_get_id (template);
if (g_strcmp0 (id, self->template) == 0)
return ide_project_template_get_name (template);
@@ -154,7 +154,7 @@ ide_template_input_set_templates (IdeTemplateInput *self,
for (guint i = 0; i < templates->len; i++)
{
IdeProjectTemplate *template = g_ptr_array_index (templates, i);
- g_auto(GStrv) langs = ide_project_template_get_languages (template);
+ const char * const *langs = ide_project_template_get_languages (template);
g_list_store_append (self->templates, template);
@@ -170,7 +170,7 @@ ide_template_input_set_templates (IdeTemplateInput *self,
if (templates->len > 0)
{
- g_autofree char *id = ide_project_template_get_id (g_ptr_array_index (templates, 0));
+ const char *id = ide_project_template_get_id (g_ptr_array_index (templates, 0));
ide_template_input_set_template (self, id);
}
@@ -193,14 +193,15 @@ template_filter_func (gpointer item,
{
IdeProjectTemplate *template = item;
const char *language = user_data;
- g_auto(GStrv) languages = NULL;
+ const char * const *languages;
g_assert (IDE_IS_PROJECT_TEMPLATE (template));
g_assert (language != NULL);
- languages = ide_project_template_get_languages (template);
+ if ((languages = ide_project_template_get_languages (template)))
+ return g_strv_contains (languages, language);
- return g_strv_contains ((const char * const *)languages, language);
+ return FALSE;
}
static void
@@ -306,7 +307,7 @@ ide_template_input_get_property (GObject *object,
break;
case PROP_TEMPLATE_NAME:
- g_value_take_string (value, get_template_name (self));
+ g_value_set_string (value, get_template_name (self));
break;
case PROP_TEMPLATES_MODEL:
@@ -585,7 +586,7 @@ ide_template_input_set_directory (IdeTemplateInput *self,
static void
auto_select_template (IdeTemplateInput *self)
{
- g_autofree char *first_id = NULL;
+ const char *first_id = NULL;
GListModel *model;
guint n_items;
@@ -597,13 +598,13 @@ auto_select_template (IdeTemplateInput *self)
for (guint i = 0; i < n_items; i++)
{
g_autoptr(IdeProjectTemplate) template = g_list_model_get_item (model, i);
- g_autofree char *id = ide_project_template_get_id (template);
+ const char *id = ide_project_template_get_id (template);
if (ide_str_equal0 (id, self->template))
return;
if (first_id == NULL)
- first_id = g_steal_pointer (&id);
+ first_id = id;
}
if (first_id != NULL)
@@ -726,7 +727,7 @@ scope_take_string (TmplScope *scope,
g_free (value);
}
-static gchar *
+static char *
capitalize (const gchar *input)
{
gunichar c;
@@ -806,7 +807,7 @@ camelize (const char *input)
return g_string_free (str, FALSE);
}
-static gchar *
+static char *
functify (const gchar *input)
{
gunichar last = 0;
@@ -1051,7 +1052,7 @@ find_template (IdeTemplateInput *self,
for (guint i = 0; i < n_items; i++)
{
g_autoptr(IdeProjectTemplate) template = g_list_model_get_item (model, i);
- g_autofree char *id = ide_project_template_get_id (template);
+ const char *id = ide_project_template_get_id (template);
if (ide_str_equal0 (template_id, id))
return g_steal_pointer (&template);
@@ -1066,7 +1067,7 @@ ide_template_input_validate (IdeTemplateInput *self)
IdeTemplateInputValidation flags = 0;
IdeProjectTemplate *template;
g_autoptr(GFile) dest = NULL;
- g_auto(GStrv) languages = NULL;
+ const char * const *languages;
g_return_val_if_fail (IDE_IS_TEMPLATE_INPUT (self), 0);
@@ -1087,10 +1088,10 @@ ide_template_input_validate (IdeTemplateInput *self)
g_file_query_exists (dest, NULL))
flags |= IDE_TEMPLATE_INPUT_INVAL_LOCATION;
- if (self->language == NULL ||
- self->template == NULL ||
- !(languages = ide_project_template_get_languages (template)) ||
- !g_strv_contains ((const char * const *)languages, self->language))
+ if (template != NULL && /* ignore if template is not set*/
+ (self->language == NULL ||
+ !(languages = ide_project_template_get_languages (template)) ||
+ !g_strv_contains (languages, self->language)))
flags |= IDE_TEMPLATE_INPUT_INVAL_LANGUAGE;
return flags;
diff --git a/src/plugins/create-project/gbp-create-project-widget.c
b/src/plugins/create-project/gbp-create-project-widget.c
index 2a4e97ad0..d587e5293 100644
--- a/src/plugins/create-project/gbp-create-project-widget.c
+++ b/src/plugins/create-project/gbp-create-project-widget.c
@@ -77,7 +77,7 @@ template_changed_cb (GbpCreateProjectWidget *self,
AdwComboRow *row)
{
IdeProjectTemplate *template;
- g_autofree char *id = NULL;
+ const char *id;
g_assert (GBP_IS_CREATE_PROJECT_WIDGET (self));
g_assert (ADW_IS_COMBO_ROW (row));
diff --git a/src/plugins/make/gbp-make-template.c b/src/plugins/make/gbp-make-template.c
index 8267587ec..da8cd90a9 100644
--- a/src/plugins/make/gbp-make-template.c
+++ b/src/plugins/make/gbp-make-template.c
@@ -31,53 +31,9 @@ struct _GbpMakeTemplate
G_DEFINE_FINAL_TYPE (GbpMakeTemplate, gbp_make_template, IDE_TYPE_PROJECT_TEMPLATE)
-enum {
- PROP_0,
- N_PROPS
-};
-
-static GParamSpec *properties [N_PROPS];
-
-static void
-gbp_make_template_finalize (GObject *object)
-{
- G_OBJECT_CLASS (gbp_make_template_parent_class)->finalize (object);
-}
-
-static void
-gbp_make_template_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- switch (prop_id)
- {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- }
-}
-
-static void
-gbp_make_template_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- switch (prop_id)
- {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- }
-}
-
static void
gbp_make_template_class_init (GbpMakeTemplateClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = gbp_make_template_finalize;
- object_class->get_property = gbp_make_template_get_property;
- object_class->set_property = gbp_make_template_set_property;
}
static void
diff --git a/src/plugins/meson-templates/meson_templates.py b/src/plugins/meson-templates/meson_templates.py
index 2c0280598..7c9dc9a2e 100644
--- a/src/plugins/meson-templates/meson_templates.py
+++ b/src/plugins/meson-templates/meson_templates.py
@@ -42,32 +42,6 @@ class LibraryTemplateProvider(GObject.Object, Ide.TemplateProvider):
EmptyProjectTemplate()]
class MesonTemplate(Ide.ProjectTemplate):
- def __init__(self, id, name, icon_name, description, languages, priority):
- super().__init__()
- self.id = id
- self.name = name
- self.icon_name = icon_name
- self.description = description
- self.languages = languages
- self.priority = priority
-
- def do_get_id(self):
- return self.id
-
- def do_get_name(self):
- return self.name
-
- def do_get_icon_name(self):
- return self.icon_name
-
- def do_get_description(self):
- return self.description
-
- def do_get_languages(self):
- return self.languages
-
- def do_get_priority(self):
- return self.priority
def do_validate_name(self, name):
# meson reserves the name 'test'
@@ -163,12 +137,11 @@ class MesonTemplate(Ide.ProjectTemplate):
class GnomeProjectTemplate(MesonTemplate):
def __init__(self):
super().__init__(
- 'gnome-app',
- _('GTK Application (Legacy)'),
- 'pattern-legacy',
- _('Create a GTK application with GTK 3'),
- ['C', 'C++', 'C♯', 'Python', 'JavaScript', 'Vala', 'Rust'],
- 0
+ id='gnome-app',
+ name=_('GTK Application (Legacy)'),
+ description=_('Create a GTK application with GTK 3'),
+ languages=['C', 'C++', 'C♯', 'Python', 'JavaScript', 'Vala', 'Rust'],
+ priority=0
)
def prepare_files(self, files, language):
@@ -240,12 +213,11 @@ class GnomeProjectTemplate(MesonTemplate):
class GnomeGTK4ProjectTemplate(MesonTemplate):
def __init__(self):
super().__init__(
- 'gnome-app-gtk4',
- _('GTK Application'),
- 'pattern-gtk',
- _('Create a GTK application with GTK 4'),
- ['C', 'JavaScript', 'Rust', 'Python', 'Vala'],
- 0
+ id='gnome-app-gtk4',
+ name=_('GTK Application'),
+ description=_('Create a GTK application with GTK 4'),
+ languages=['C', 'JavaScript', 'Rust', 'Python', 'Vala'],
+ priority=0
)
def prepare_files(self, files, language):
@@ -322,12 +294,11 @@ class GnomeGTK4ProjectTemplate(MesonTemplate):
class GnomeAdwaitaProjectTemplate(MesonTemplate):
def __init__(self):
super().__init__(
- 'gnome-app-adwaita',
- _('GNOME Application'),
- 'pattern-gnome',
- _('Create a GNOME application with libadwaita'),
- ['C', 'JavaScript', 'Rust', 'Python', 'Vala'],
- 0
+ id='gnome-app-adwaita',
+ name=_('GNOME Application'),
+ description=_('Create a GNOME application with libadwaita'),
+ languages=['C', 'JavaScript', 'Rust', 'Python', 'Vala'],
+ priority=0
)
def prepare_files(self, files, language):
@@ -404,12 +375,11 @@ class GnomeAdwaitaProjectTemplate(MesonTemplate):
class LibraryProjectTemplate(MesonTemplate):
def __init__(self):
super().__init__(
- 'shared-library',
- _("Shared Library"),
- 'pattern-library',
- _("Create a new project with a shared library"),
- ['C'],
- 100
+ id='shared-library',
+ name=_("Shared Library"),
+ description=_("Create a new project with a shared library"),
+ languages=['C'],
+ priority=100
)
def prepare_files(self, files, language):
@@ -423,12 +393,11 @@ class LibraryProjectTemplate(MesonTemplate):
class EmptyProjectTemplate(MesonTemplate):
def __init__(self):
super().__init__(
- 'empty',
- _('Empty Project'),
- 'pattern-cli',
- _('Create a new empty project'),
- ['C', 'C++', 'C♯', 'JavaScript', 'Python', 'Vala', 'Rust'],
- 200
+ id='empty',
+ name=_('Empty Project'),
+ description=_('Create a new empty project'),
+ languages=['C', 'C++', 'C♯', 'JavaScript', 'Python', 'Vala', 'Rust'],
+ priority=200
)
def prepare_files(self, files, language):
@@ -442,12 +411,11 @@ class EmptyProjectTemplate(MesonTemplate):
class CLIProjectTemplate(MesonTemplate):
def __init__(self):
super().__init__(
- 'cli',
- _('Command Line Tool'),
- 'pattern-cli',
- _('Create a new command line project'),
- ['C', 'C++', 'Vala', 'Rust', 'Python'],
- 200
+ id='cli',
+ name=_('Command Line Tool'),
+ description=_('Create a new command line project'),
+ languages=['C', 'C++', 'Vala', 'Rust', 'Python'],
+ priority=200
)
def prepare_files(self, files, language):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]