[gnome-builder] podman: use "Toolbox" grouping for toolbox containers
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] podman: use "Toolbox" grouping for toolbox containers
- Date: Fri, 19 Mar 2021 16:58:20 +0000 (UTC)
commit ad457717ea9ed88c2d1d5bea800eb726a563cc3f
Author: Christian Hergert <chergert redhat com>
Date: Fri Mar 19 09:57:58 2021 -0700
podman: use "Toolbox" grouping for toolbox containers
If the container is known to be a toolbox, then group it separately from
that of Podman.
src/plugins/podman/gbp-podman-runtime.c | 32 +++++++++++++++++++++++++++++---
1 file changed, 29 insertions(+), 3 deletions(-)
---
diff --git a/src/plugins/podman/gbp-podman-runtime.c b/src/plugins/podman/gbp-podman-runtime.c
index 856ca13cd..60fa318f8 100644
--- a/src/plugins/podman/gbp-podman-runtime.c
+++ b/src/plugins/podman/gbp-podman-runtime.c
@@ -139,6 +139,9 @@ gbp_podman_runtime_new (JsonObject *object)
const gchar *names;
JsonArray *names_arr;
JsonNode *names_node;
+ JsonNode *labels_node;
+ gboolean is_toolbox = FALSE;
+ const gchar *category;
g_return_val_if_fail (object != NULL, NULL);
@@ -158,16 +161,39 @@ gbp_podman_runtime_new (JsonObject *object)
names = json_node_get_string (names_node);
}
+ if (json_object_has_member (object, "Labels") &&
+ (labels_node = json_object_get_member (object, "Labels")) &&
+ JSON_NODE_HOLDS_OBJECT (labels_node))
+ {
+ JsonObject *labels = json_node_get_object (labels_node);
+
+ /* Check if this is a toolbox container */
+ if (json_object_has_member (labels, "com.github.debarshiray.toolbox") ||
+ json_object_has_member (labels, "com.github.containers.toolbox"))
+ is_toolbox = TRUE;
+ }
+
full_id = g_strdup_printf ("podman:%s", id);
- name = g_strdup_printf ("%s %s", _("Podman"), names);
+
+ if (is_toolbox)
+ {
+ name = g_strdup_printf ("Toolbox %s", names);
+ /* translators: this is a path to browse to the runtime, likely only "containers" should be translated
*/
+ category = _("Containers/Toolbox");
+ }
+ else
+ {
+ name = g_strdup_printf ("Podman %s", names);
+ /* translators: this is a path to browse to the runtime, likely only "containers" should be translated
*/
+ category = _("Containers/Podman");
+ }
g_return_val_if_fail (id != NULL, NULL);
g_return_val_if_fail (names != NULL, NULL);
self = g_object_new (GBP_TYPE_PODMAN_RUNTIME,
"id", full_id,
- /* translators: this is a path to browse to the runtime, likely only "containers"
should be translated */
- "category", _("Containers/Podman"),
+ "category", category,
"display-name", names,
NULL);
self->object = json_object_ref (object);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]