cleanup: Fix some coding style issues

Fixes https://gitlab.gnome.org/GNOME/gnome-shell-extensions/issues/30
This commit is contained in:
Florian Müllner
2017-10-27 17:37:31 +02:00
parent 9d5b149428
commit d3bbeb1b0c
5 changed files with 14 additions and 15 deletions

View File

@@ -27,7 +27,7 @@ const AltTabSettingsWidget = new GObject.Class({
GTypeName: 'AltTabSettingsWidget',
Extends: Gtk.Grid,
_init : function(params) {
_init: function(params) {
this.parent(params);
this.margin = 24;
this.row_spacing = 6;

View File

@@ -20,7 +20,7 @@ function _showHello() {
let monitor = Main.layoutManager.primaryMonitor;
global.stage.add_actor(label);
label.set_position(Math.floor (monitor.width / 2 - label.width / 2), Math.floor(monitor.height / 2 - label.height / 2));
Mainloop.timeout_add(3000, function () { label.destroy(); });
Mainloop.timeout_add(3000, function() { label.destroy(); });
}
// Put your extension initialization code here

View File

@@ -290,11 +290,11 @@ var PlacesManager = new Lang.Class({
if (this._bookmarksFile) {
this._monitor = this._bookmarksFile.monitor_file(Gio.FileMonitorFlags.NONE, null);
this._monitor.connect('changed', Lang.bind(this, function () {
this._monitor.connect('changed', Lang.bind(this, function() {
if (this._bookmarkTimeoutId > 0)
return;
/* Defensive event compression */
this._bookmarkTimeoutId = Mainloop.timeout_add(100, Lang.bind(this, function () {
this._bookmarkTimeoutId = Mainloop.timeout_add(100, Lang.bind(this, function() {
this._bookmarkTimeoutId = 0;
this._reloadBookmarks();
return false;
@@ -333,7 +333,7 @@ var PlacesManager = new Lang.Class({
},
_updateSpecials: function() {
this._places.special.forEach(function (p) { p.destroy(); });
this._places.special.forEach(function(p) { p.destroy(); });
this._places.special = [];
let homePath = GLib.get_home_dir();
@@ -375,9 +375,9 @@ var PlacesManager = new Lang.Class({
let networkMounts = [];
let networkVolumes = [];
this._places.devices.forEach(function (p) { p.destroy(); });
this._places.devices.forEach(function(p) { p.destroy(); });
this._places.devices = [];
this._places.network.forEach(function (p) { p.destroy(); });
this._places.network.forEach(function(p) { p.destroy(); });
this._places.network = [];
/* Add standard places */
@@ -542,7 +542,7 @@ var PlacesManager = new Lang.Class({
this._places[kind].push(volItem);
},
get: function (kind) {
get: function(kind) {
return this._places[kind];
}
});

View File

@@ -573,7 +573,6 @@ const AppButton = new Lang.Class({
});
},
getWindowList: function() {
return this.app.get_windows().filter(Lang.bind(this, function(win) {
return this._isWindowVisible(win);
@@ -674,7 +673,7 @@ const WorkspaceIndicator = new Lang.Class({
Name: 'WindowList.WorkspaceIndicator',
Extends: PanelMenu.Button,
_init: function(){
_init: function() {
this.parent(0.0, _("Workspace Indicator"), true);
this.setMenu(new PopupMenu.PopupMenu(this.actor, 0.0, St.Side.BOTTOM));
this.actor.add_style_class_name('window-list-workspace-indicator');

View File

@@ -26,7 +26,7 @@ const WorkspaceIndicator = new Lang.Class({
Name: 'WorkspaceIndicator.WorkspaceIndicator',
Extends: PanelMenu.Button,
_init: function(){
_init: function() {
this.parent(0.0, _("Workspace Indicator"));
this._currentWorkspace = global.screen.get_active_workspace().index();
@@ -74,7 +74,7 @@ const WorkspaceIndicator = new Lang.Class({
this.statusLabel.set_text(this._labelText());
},
_labelText : function(workspaceIndex) {
_labelText: function(workspaceIndex) {
if(workspaceIndex == undefined) {
workspaceIndex = this._currentWorkspace;
return (workspaceIndex + 1).toString();
@@ -82,7 +82,7 @@ const WorkspaceIndicator = new Lang.Class({
return Meta.prefs_get_workspace_name(workspaceIndex);
},
_createWorkspacesSection : function() {
_createWorkspacesSection: function() {
this._workspaceSection.removeAll();
this.workspacesItems = [];
this._currentWorkspace = global.screen.get_active_workspace().index();
@@ -105,14 +105,14 @@ const WorkspaceIndicator = new Lang.Class({
this.statusLabel.set_text(this._labelText());
},
_activate : function (index) {
_activate: function(index) {
if(index >= 0 && index < global.screen.n_workspaces) {
let metaWorkspace = global.screen.get_workspace_by_index(index);
metaWorkspace.activate(global.get_current_time());
}
},
_onScrollEvent : function(actor, event) {
_onScrollEvent: function(actor, event) {
let direction = event.get_scroll_direction();
let diff = 0;
if (direction == Clutter.ScrollDirection.DOWN) {