[gnome-builder/ebassi/gnome-app-template: 2/3] meson-templates: Use C99 compound literals




commit 7c8655738a9ee6794465abf5c0be4a65ed83c778
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]