[gnome-builder/ebassi/gnome-app-template: 3/4] meson-templates: Use C99 compound literals
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/ebassi/gnome-app-template: 3/4] meson-templates: Use C99 compound literals
- Date: Tue, 8 Feb 2022 23:53:00 +0000 (UTC)
commit 15957abcc484cb478bad42ad470b472c4658933a
Author: Emmanuele Bassi <ebassi gnome org>
Date: Tue Feb 8 21:22:39 2022 +0000
meson-templates: Use C99 compound literals
Instead of using an ancillary variable, we can pass the NULL terminated
array of strings as a compound literal directly to
gtk_application_set_accels_for_action(), similarly to what we do in
other languages.
src/plugins/meson-templates/resources/src/application.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/plugins/meson-templates/resources/src/application.c
b/src/plugins/meson-templates/resources/src/application.c
index a270897c6..033a685ed 100644
--- a/src/plugins/meson-templates/resources/src/application.c
+++ b/src/plugins/meson-templates/resources/src/application.c
@@ -100,6 +100,10 @@ static void
g_signal_connect (about_action, "activate", G_CALLBACK ({{prefix_}}_application_show_about), self);
g_action_map_add_action (G_ACTION_MAP (self), G_ACTION (about_action));
- const char *accels[] = {"<primary>q", NULL};
- gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.quit", accels);
+ gtk_application_set_accels_for_action (GTK_APPLICATION (self),
+ "app.quit",
+ (const char *[]) {
+ "<Control>q",
+ NULL,
+ });
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]