From fc51fd857ceb820568a5771e3a1baa0304cc5596 Mon Sep 17 00:00:00 2001 From: Rafostar <40623528+Rafostar@users.noreply.github.com> Date: Mon, 3 May 2021 19:21:35 +0200 Subject: [PATCH] Fix missing actions shortcuts in main menu Actions were loaded too early, causing GTK to not recognize them and show their keyboard shortcuts next to main menu items --- src/appBase.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/appBase.js b/src/appBase.js index aaede1e8..52fef493 100644 --- a/src/appBase.js +++ b/src/appBase.js @@ -34,18 +34,6 @@ class ClapperAppBase extends Gtk.Application if(!settings.get_boolean('render-shadows')) window.add_css_class('gpufriendly'); - - for(let name in Actions.actions) { - const simpleAction = new Gio.SimpleAction({ name }); - simpleAction.connect('activate', (action) => - Actions.handleAction(action, this.active_window) - ); - this.add_action(simpleAction); - - const accels = Actions.actions[name]; - if(accels) - this.set_accels_for_action(`app.${name}`, accels); - } } vfunc_activate() @@ -92,6 +80,18 @@ class ClapperAppBase extends Gtk.Application _onFirstActivate() { + for(let name in Actions.actions) { + const simpleAction = new Gio.SimpleAction({ name }); + simpleAction.connect('activate', (action) => + Actions.handleAction(action, this.active_window) + ); + this.add_action(simpleAction); + + const accels = Actions.actions[name]; + if(accels) + this.set_accels_for_action(`app.${name}`, accels); + } + const gtkSettings = Gtk.Settings.get_default(); settings.bind( 'dark-theme', gtkSettings,