Change actions naming scheme

Use _ instead of capital letters in words for actions names. This will make some other stuff much easier.
This commit is contained in:
Rafał Dzięgiel
2021-04-22 14:29:40 +02:00
parent c9b2f25192
commit 084f78a851
3 changed files with 10 additions and 10 deletions

View File

@@ -1,11 +1,11 @@
const Dialogs = imports.src.dialogs;
var actions = {
openLocal: {
open_local: {
run: (window) => new Dialogs.FileChooser(window),
accels: ['<Ctrl>O'],
},
openUri: {
open_uri: {
run: (window) => new Dialogs.UriDialog(window),
accels: ['<Ctrl>U'],
},
@@ -14,5 +14,5 @@ var actions = {
},
about: {
run: (window) => new Dialogs.AboutDialog(window),
},
}
};

View File

@@ -1,8 +1,8 @@
const { Gio, GLib, GObject, Gtk } = imports.gi;
const Debug = imports.src.debug;
const FileOps = imports.src.fileOps;
const Menu = imports.src.menu;
const Misc = imports.src.misc;
const { actions } = imports.src.actions;
const { debug } = Debug;
const { settings } = Misc;
@@ -35,15 +35,15 @@ class ClapperAppBase extends Gtk.Application
if(!settings.get_boolean('render-shadows'))
window.add_css_class('gpufriendly');
for(let name in Menu.actions) {
for(let name in actions) {
const simpleAction = new Gio.SimpleAction({ name });
simpleAction.connect(
'activate', () => Menu.actions[name].run(this.active_window)
'activate', () => actions[name].run(this.active_window)
);
this.add_action(simpleAction);
if(Menu.actions[name].accels)
this.set_accels_for_action(`app.${name}`, Menu.actions[name].accels);
if(actions[name].accels)
this.set_accels_for_action(`app.${name}`, actions[name].accels);
}
}