Commit 14c5b77f478a6905d501442517117c0cd20b2c64

Thomas de Grivel 2024-12-18T18:39:42

application set accel for action

diff --git a/gtk4/application.c b/gtk4/application.c
index 6c33382..fd10482 100644
--- a/gtk4/application.c
+++ b/gtk4/application.c
@@ -38,18 +38,17 @@ s32 kc3_gtk4_application_run (GtkApplication **app)
                            g_kc3_env->argv);
 }
 
-/*
-void kc3_gtk4_application_set_app_menu (GtkApplication **app,
-                                        GMenuModel **menu)
+void kc3_gtk4_application_set_accel_for_action (GtkApplication **app,
+                                                const s_str *action,
+                                                const s_str *accel)
 {
-  assert(app);
-  assert(*app);
-  assert(menu);
-  assert(*menu);
-  gtk_application_set_app_menu(GTK_APPLICATION(*app),
-                               G_MENU_MODEL(*menu));
+  gtk_application_set_accels_for_action(GTK_APPLICATION(*app),
+                                        action->ptr.pchar,
+                                        (const char *[]) {
+                                          accel->ptr.pchar,
+                                          NULL
+                                        });
 }
-*/
 
 void kc3_gtk4_application_set_menubar (GtkApplication **app,
                                        GMenuModel **menu)
diff --git a/gtk4/application.h b/gtk4/application.h
index 6bdcc88..f408587 100644
--- a/gtk4/application.h
+++ b/gtk4/application.h
@@ -24,8 +24,9 @@ GtkApplication ** kc3_gtk4_application_new (GtkApplication **dest,
 
 /* Operators. */
 s32  kc3_gtk4_application_run (GtkApplication **app);
-void kc3_gtk4_application_set_app_menu (GtkApplication **app,
-                                        GMenuModel **menu);
+void kc3_gtk4_application_set_accel_for_action (GtkApplication **app,
+                                                const s_str *action,
+                                                const s_str *accel);
 void kc3_gtk4_application_set_menubar (GtkApplication **app,
                                        GMenuModel **menu);
 
diff --git a/lib/kc3/0.1/gtk4/application.kc3 b/lib/kc3/0.1/gtk4/application.kc3
index 12f9cea..23e7b12 100644
--- a/lib/kc3/0.1/gtk4/application.kc3
+++ b/lib/kc3/0.1/gtk4/application.kc3
@@ -7,6 +7,10 @@ defmodule Gtk4.Application do
 
   def run = cfn S32 "kc3_gtk4_application_run" (Ptr)
 
+  # set_accels_for_action(app, detailed_action, accel)
+  def set_accel_for_action = cfn Void
+    "kc3_gtk4_application_set_accel_for_action" (Ptr, Str, Str)
+
   # set_menubar(app, menu)
   def set_menubar = cfn Void "kc3_gtk4_application_set_menubar" (Ptr,
     Ptr)