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>
This commit is contained in:
parent
177175ca6a
commit
a3dc9817f2
@ -58,9 +58,11 @@ class Application extends Adw.Application {
|
|||||||
vfunc_startup() {
|
vfunc_startup() {
|
||||||
super.vfunc_startup();
|
super.vfunc_startup();
|
||||||
|
|
||||||
const action = new Gio.SimpleAction({ name: 'quit' });
|
this.add_action_entries(
|
||||||
action.connect('activate', () => this._window.close());
|
[{
|
||||||
this.add_action(action);
|
name: 'quit',
|
||||||
|
activate: () => this._window.close(),
|
||||||
|
}]);
|
||||||
|
|
||||||
this.set_accels_for_action('app.quit', ['<Primary>q']);
|
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._exporter = new Shew.WindowExporter({ window: this });
|
||||||
this._exportedHandle = '';
|
this._exportedHandle = '';
|
||||||
|
|
||||||
let action;
|
this.add_action_entries(
|
||||||
action = new Gio.SimpleAction({ name: 'show-about' });
|
[{
|
||||||
action.connect('activate', this._showAbout.bind(this));
|
name: 'show-about',
|
||||||
this.add_action(action);
|
activate: () => this._showAbout(),
|
||||||
|
}, {
|
||||||
action = new Gio.SimpleAction({ name: 'logout' });
|
name: 'logout',
|
||||||
action.connect('activate', this._logout.bind(this));
|
activate: () => this._logout(),
|
||||||
this.add_action(action);
|
}, {
|
||||||
|
name: 'user-extensions-enabled',
|
||||||
action = new Gio.SimpleAction({
|
state: 'false',
|
||||||
name: 'user-extensions-enabled',
|
change_state: (a, state) => {
|
||||||
state: new GLib.Variant('b', false),
|
this._shellProxy.UserExtensionsEnabled = state.get_boolean();
|
||||||
});
|
},
|
||||||
action.connect('activate', toggleState);
|
}]);
|
||||||
action.connect('change-state', (a, state) => {
|
|
||||||
this._shellProxy.UserExtensionsEnabled = state.get_boolean();
|
|
||||||
});
|
|
||||||
this.add_action(action);
|
|
||||||
|
|
||||||
this._searchTerms = [];
|
this._searchTerms = [];
|
||||||
this._searchEntry.connect('search-changed', () => {
|
this._searchEntry.connect('search-changed', () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user