summaryrefslogtreecommitdiff
path: root/subprojects
diff options
context:
space:
mode:
authorFlorian Müllner <fmuellner@gnome.org>2022-07-06 14:16:38 +0200
committerFlorian Müllner <fmuellner@gnome.org>2022-08-01 13:03:32 +0200
commita3dc9817f2bf49ccfab6888bccdeaee0ccdaf6b2 (patch)
tree6b43c2bf6631b5e07a98d8774b08befe2b58337e /subprojects
parent177175ca6ad29bf24adb15060d99f0a66fb4d70a (diff)
downloadgnome-shell-a3dc9817f2bf49ccfab6888bccdeaee0ccdaf6b2.tar.gz
extensions-app: Use new add_action_entries() override
g_action_map_add_entries() is a C convenience API that isn't introspectable, but gjs recently added a JS override for it. Use it to save some boilerplate. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2371>
Diffstat (limited to 'subprojects')
-rw-r--r--subprojects/extensions-app/js/main.js40
1 files changed, 19 insertions, 21 deletions
diff --git a/subprojects/extensions-app/js/main.js b/subprojects/extensions-app/js/main.js
index 98922363d..2d8ff1111 100644
--- a/subprojects/extensions-app/js/main.js
+++ b/subprojects/extensions-app/js/main.js
@@ -58,9 +58,11 @@ class Application extends Adw.Application {
vfunc_startup() {
super.vfunc_startup();
- const action = new Gio.SimpleAction({ name: 'quit' });
- action.connect('activate', () => this._window.close());
- this.add_action(action);
+ this.add_action_entries(
+ [{
+ name: 'quit',
+ activate: () => this._window.close(),
+ }]);
this.set_accels_for_action('app.quit', ['<Primary>q']);
@@ -95,24 +97,20 @@ var ExtensionsWindow = GObject.registerClass({
this._exporter = new Shew.WindowExporter({ window: this });
this._exportedHandle = '';
- let action;
- action = new Gio.SimpleAction({ name: 'show-about' });
- action.connect('activate', this._showAbout.bind(this));
- this.add_action(action);
-
- action = new Gio.SimpleAction({ name: 'logout' });
- action.connect('activate', this._logout.bind(this));
- this.add_action(action);
-
- action = new Gio.SimpleAction({
- name: 'user-extensions-enabled',
- state: new GLib.Variant('b', false),
- });
- action.connect('activate', toggleState);
- action.connect('change-state', (a, state) => {
- this._shellProxy.UserExtensionsEnabled = state.get_boolean();
- });
- this.add_action(action);
+ this.add_action_entries(
+ [{
+ name: 'show-about',
+ activate: () => this._showAbout(),
+ }, {
+ name: 'logout',
+ activate: () => this._logout(),
+ }, {
+ name: 'user-extensions-enabled',
+ state: 'false',
+ change_state: (a, state) => {
+ this._shellProxy.UserExtensionsEnabled = state.get_boolean();
+ },
+ }]);
this._searchTerms = [];
this._searchEntry.connect('search-changed', () => {