extensions-tool/create: Add --settings-schema flag
Like with the gettext domain, the GSettings schema ID can be picked up from the metadata, so allow setting it via an optional CLI flag. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2889>
This commit is contained in:
parent
8b9d8d7bb8
commit
a9740d1a79
@ -131,6 +131,9 @@ Creates a new extension from a template.
|
|||||||
*--gettext-domain*='DOMAIN':::
|
*--gettext-domain*='DOMAIN':::
|
||||||
Set the gettext domain used by the extension
|
Set the gettext domain used by the extension
|
||||||
|
|
||||||
|
*--settings-schema*='SCHEMA':::
|
||||||
|
Set the GSettings schema used by the extension
|
||||||
|
|
||||||
*--template*='TEMPLATE':::
|
*--template*='TEMPLATE':::
|
||||||
Use 'TEMPLATE' as base for the new extension
|
Use 'TEMPLATE' as base for the new extension
|
||||||
|
|
||||||
|
@ -136,6 +136,7 @@ create_metadata (GFile *target_dir,
|
|||||||
const char *name,
|
const char *name,
|
||||||
const char *description,
|
const char *description,
|
||||||
const char *gettext_domain,
|
const char *gettext_domain,
|
||||||
|
const char *settings_schema,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
g_autofree char *uuid_escaped = NULL;
|
g_autofree char *uuid_escaped = NULL;
|
||||||
@ -162,6 +163,9 @@ create_metadata (GFile *target_dir,
|
|||||||
if (gettext_domain)
|
if (gettext_domain)
|
||||||
g_string_append_printf (json, " \"gettext-domain\": \"%s\",\n", gettext_domain);
|
g_string_append_printf (json, " \"gettext-domain\": \"%s\",\n", gettext_domain);
|
||||||
|
|
||||||
|
if (settings_schema)
|
||||||
|
g_string_append_printf (json, " \"settings-schema\": \"%s\",\n", settings_schema);
|
||||||
|
|
||||||
g_string_append_printf (json, " \"shell-version\": [\n");
|
g_string_append_printf (json, " \"shell-version\": [\n");
|
||||||
g_string_append_printf (json, " \"%s\"\n", version);
|
g_string_append_printf (json, " \"%s\"\n", version);
|
||||||
g_string_append_printf (json, " ]\n}\n");
|
g_string_append_printf (json, " ]\n}\n");
|
||||||
@ -241,6 +245,7 @@ create_extension (const char *uuid,
|
|||||||
const char *name,
|
const char *name,
|
||||||
const char *description,
|
const char *description,
|
||||||
const char *gettext_domain,
|
const char *gettext_domain,
|
||||||
|
const char *settings_schema,
|
||||||
const char *template)
|
const char *template)
|
||||||
{
|
{
|
||||||
g_autoptr (GFile) dir = NULL;
|
g_autoptr (GFile) dir = NULL;
|
||||||
@ -261,7 +266,7 @@ create_extension (const char *uuid,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!create_metadata (dir, uuid, name, description, gettext_domain, &error))
|
if (!create_metadata (dir, uuid, name, description, gettext_domain, settings_schema, &error))
|
||||||
{
|
{
|
||||||
g_printerr ("%s\n", error->message);
|
g_printerr ("%s\n", error->message);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -432,6 +437,7 @@ handle_create (int argc, char *argv[], gboolean do_help)
|
|||||||
g_autofree char *description = NULL;
|
g_autofree char *description = NULL;
|
||||||
g_autofree char *uuid = NULL;
|
g_autofree char *uuid = NULL;
|
||||||
g_autofree char *gettext_domain = NULL;
|
g_autofree char *gettext_domain = NULL;
|
||||||
|
g_autofree char *settings_schema = NULL;
|
||||||
g_autofree char *template = NULL;
|
g_autofree char *template = NULL;
|
||||||
gboolean interactive = FALSE;
|
gboolean interactive = FALSE;
|
||||||
gboolean list_templates = FALSE;
|
gboolean list_templates = FALSE;
|
||||||
@ -452,6 +458,10 @@ handle_create (int argc, char *argv[], gboolean do_help)
|
|||||||
.arg_description = _("DOMAIN"),
|
.arg_description = _("DOMAIN"),
|
||||||
.arg = G_OPTION_ARG_STRING, .arg_data = &gettext_domain,
|
.arg = G_OPTION_ARG_STRING, .arg_data = &gettext_domain,
|
||||||
.description = _("The gettext domain used by the extension") },
|
.description = _("The gettext domain used by the extension") },
|
||||||
|
{ .long_name = "settings-schema",
|
||||||
|
.arg_description = _("SCHEMA"),
|
||||||
|
.arg = G_OPTION_ARG_STRING, .arg_data = &settings_schema,
|
||||||
|
.description = _("The GSettings schema used by the extension") },
|
||||||
{ .long_name = "template",
|
{ .long_name = "template",
|
||||||
.arg = G_OPTION_ARG_STRING, .arg_data = &template,
|
.arg = G_OPTION_ARG_STRING, .arg_data = &template,
|
||||||
.arg_description = _("TEMPLATE"),
|
.arg_description = _("TEMPLATE"),
|
||||||
@ -516,5 +526,5 @@ handle_create (int argc, char *argv[], gboolean do_help)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return create_extension (uuid, name, description, gettext_domain, template) ? 0 : 2;
|
return create_extension (uuid, name, description, gettext_domain, settings_schema, template) ? 0 : 2;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user