[gnome-builder/wip/gtk4-port: 1019/1774] libide/core: add strv initializer
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port: 1019/1774] libide/core: add strv initializer
- Date: Mon, 11 Jul 2022 22:31:31 +0000 (UTC)
commit db8717cf5e0367d54bd96bd77a33cc9ff7f6b776
Author: Christian Hergert <chergert redhat com>
Date: Sat May 14 15:42:37 2022 -0700
libide/core: add strv initializer
And use it from various places we do them inline now for css-classes.
src/libide/core/ide-macros.h | 2 ++
src/libide/greeter/ide-greeter-row.c | 2 +-
src/plugins/buildui/gbp-buildui-targets-dialog.c | 4 ++--
src/plugins/git/gbp-git-preferences-addin.c | 2 +-
4 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/libide/core/ide-macros.h b/src/libide/core/ide-macros.h
index 6d85f5d0f..0a456b060 100644
--- a/src/libide/core/ide-macros.h
+++ b/src/libide/core/ide-macros.h
@@ -270,6 +270,8 @@ ide_object_array_unref (IdeObjectArray *ar)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (IdeObjectArray, g_ptr_array_unref)
+#define IDE_STRV_INIT(...) ((const char * const[]) { __VA_ARGS__, NULL})
+
G_END_DECLS
#endif /* __GI_SCANNER__ */
diff --git a/src/libide/greeter/ide-greeter-row.c b/src/libide/greeter/ide-greeter-row.c
index ee45b39e0..640c54ac2 100644
--- a/src/libide/greeter/ide-greeter-row.c
+++ b/src/libide/greeter/ide-greeter-row.c
@@ -312,7 +312,7 @@ ide_greeter_row_set_project_info (IdeGreeterRow *self,
tag = g_object_new (GTK_TYPE_LABEL,
"label", key,
"css-name", "button",
- "css-classes", (const char * const []) { "pill", "small", NULL },
+ "css-classes", IDE_STRV_INIT ("pill", "small"),
NULL);
gtk_box_append (priv->tags, GTK_WIDGET (tag));
}
diff --git a/src/plugins/buildui/gbp-buildui-targets-dialog.c
b/src/plugins/buildui/gbp-buildui-targets-dialog.c
index 1e99a5870..24a33836e 100644
--- a/src/plugins/buildui/gbp-buildui-targets-dialog.c
+++ b/src/plugins/buildui/gbp-buildui-targets-dialog.c
@@ -68,7 +68,7 @@ create_target_row (gpointer item,
check = g_object_new (GTK_TYPE_CHECK_BUTTON,
"action-name", "build-manager.default-build-target",
- "css-classes", (const char * const[]) { "checkimage", NULL },
+ "css-classes", IDE_STRV_INIT ("checkimage"),
"action-target", namev,
"valign", GTK_ALIGN_CENTER,
"can-focus", FALSE,
@@ -106,7 +106,7 @@ create_target_row (gpointer item,
g_object_new (GTK_TYPE_LABEL,
"label", pill_label,
"css-name", "button",
- "css-classes", (const char * const []) { "pill", "small", NULL
},
+ "css-classes", IDE_STRV_INIT ("pill", "small"),
"valign", GTK_ALIGN_CENTER,
NULL));
adw_action_row_add_suffix (row, check);
diff --git a/src/plugins/git/gbp-git-preferences-addin.c b/src/plugins/git/gbp-git-preferences-addin.c
index b5e2da369..9fc4f0f03 100644
--- a/src/plugins/git/gbp-git-preferences-addin.c
+++ b/src/plugins/git/gbp-git-preferences-addin.c
@@ -168,7 +168,7 @@ create_entry_row (const char *page_name,
title = _("The Git configuration options above effect global defaults.");
label = g_object_new (GTK_TYPE_LABEL,
- "css-classes", (const char * const[]) { "caption", "dim-label", NULL },
+ "css-classes", IDE_STRV_INIT ("caption", "dim-label"),
"xalign", .0f,
"margin-top", 15,
"single-line-mode", TRUE,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]