[gnome-shell-extensions/wip/fmuellner/js-cleanup: 2/7] cleanup: Replace tabs with spaces



commit 967e86da2965e29074c3028faf924a0380eee345
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Oct 27 17:44:46 2017 +0200

    cleanup: Replace tabs with spaces
    
    https://bugzilla.gnome.org/show_bug.cgi?id=790301

 extensions/alternate-tab/prefs.js           |  10 +-
 extensions/auto-move-windows/extension.js   |  12 +-
 extensions/auto-move-windows/prefs.js       | 282 ++++++++++++++--------------
 extensions/drive-menu/extension.js          | 136 +++++++-------
 extensions/example/extension.js             |   4 +-
 extensions/example/prefs.js                 |  16 +-
 extensions/places-menu/extension.js         |  40 ++--
 extensions/workspace-indicator/extension.js | 126 ++++++-------
 8 files changed, 313 insertions(+), 313 deletions(-)
---
diff --git a/extensions/alternate-tab/prefs.js b/extensions/alternate-tab/prefs.js
index 2828c4f..b8c4200 100644
--- a/extensions/alternate-tab/prefs.js
+++ b/extensions/alternate-tab/prefs.js
@@ -31,7 +31,7 @@ const AltTabSettingsWidget = new GObject.Class({
         this.parent(params);
         this.margin = 24;
         this.row_spacing = 6;
-       this.orientation = Gtk.Orientation.VERTICAL;
+        this.orientation = Gtk.Orientation.VERTICAL;
 
         this._settings = new Gio.Settings({ schema_id: 'org.gnome.shell.window-switcher' });
 
@@ -66,10 +66,10 @@ const AltTabSettingsWidget = new GObject.Class({
                 radio.active = true;
         }
 
-       let check = new Gtk.CheckButton({ label: _("Show only windows in the current workspace"),
-                                         margin_top: 6 });
-       this._settings.bind(SETTINGS_CURRENT_WORKSPACE_ONLY, check, 'active', Gio.SettingsBindFlags.DEFAULT);
-       this.add(check);
+        let check = new Gtk.CheckButton({ label: _("Show only windows in the current workspace"),
+                                          margin_top: 6 });
+        this._settings.bind(SETTINGS_CURRENT_WORKSPACE_ONLY, check, 'active', Gio.SettingsBindFlags.DEFAULT);
+        this.add(check);
     },
 });
 
diff --git a/extensions/auto-move-windows/extension.js b/extensions/auto-move-windows/extension.js
index e4c7fca..05e6321 100644
--- a/extensions/auto-move-windows/extension.js
+++ b/extensions/auto-move-windows/extension.js
@@ -117,19 +117,19 @@ function myCheckWorkspaces() {
 
     let windows = global.get_window_actors();
     for (i = 0; i < windows.length; i++) {
-       let winActor = windows[i];
+        let winActor = windows[i];
         let win = winActor.meta_window;
-       if (win.is_on_all_workspaces())
+        if (win.is_on_all_workspaces())
             continue;
 
-       let workspaceIndex = win.get_workspace().index();
-       emptyWorkspaces[workspaceIndex] = false;
+        let workspaceIndex = win.get_workspace().index();
+        emptyWorkspaces[workspaceIndex] = false;
     }
 
     // If we don't have an empty workspace at the end, add one
     if (!emptyWorkspaces[emptyWorkspaces.length -1]) {
-       global.screen.append_new_workspace(false, global.get_current_time());
-       emptyWorkspaces.push(false);
+        global.screen.append_new_workspace(false, global.get_current_time());
+        emptyWorkspaces.push(false);
     }
 
     let activeWorkspaceIndex = global.screen.get_active_workspace_index();
diff --git a/extensions/auto-move-windows/prefs.js b/extensions/auto-move-windows/prefs.js
index 31f4c9e..ebed660 100644
--- a/extensions/auto-move-windows/prefs.js
+++ b/extensions/auto-move-windows/prefs.js
@@ -32,15 +32,15 @@ const Widget = new GObject.Class({
     Extends: Gtk.Grid,
 
     _init: function(params) {
-       this.parent(params);
+        this.parent(params);
         this.set_orientation(Gtk.Orientation.VERTICAL);
 
-       this._settings = Convenience.getSettings();
-       this._settings.connect('changed', Lang.bind(this, this._refresh));
-       this._changedPermitted = false;
+        this._settings = Convenience.getSettings();
+        this._settings.connect('changed', Lang.bind(this, this._refresh));
+        this._changedPermitted = false;
 
-       this._store = new Gtk.ListStore();
-       this._store.set_column_types([Gio.AppInfo, GObject.TYPE_STRING, Gio.Icon, GObject.TYPE_INT,
+        this._store = new Gtk.ListStore();
+        this._store.set_column_types([Gio.AppInfo, GObject.TYPE_STRING, Gio.Icon, GObject.TYPE_INT,
                                       Gtk.Adjustment]);
 
         let scrolled = new Gtk.ScrolledWindow({ shadow_type: Gtk.ShadowType.IN});
@@ -48,44 +48,44 @@ const Widget = new GObject.Class({
         this.add(scrolled);
 
 
-       this._treeView = new Gtk.TreeView({ model: this._store,
+        this._treeView = new Gtk.TreeView({ model: this._store,
                                             hexpand: true, vexpand: true });
-       this._treeView.get_selection().set_mode(Gtk.SelectionMode.SINGLE);
-
-       let appColumn = new Gtk.TreeViewColumn({ expand: true, sort_column_id: Columns.DISPLAY_NAME,
-                                                title: _("Application") });
-       let iconRenderer = new Gtk.CellRendererPixbuf;
-       appColumn.pack_start(iconRenderer, false);
-       appColumn.add_attribute(iconRenderer, "gicon", Columns.ICON);
-       let nameRenderer = new Gtk.CellRendererText;
-       appColumn.pack_start(nameRenderer, true);
-       appColumn.add_attribute(nameRenderer, "text", Columns.DISPLAY_NAME);
-       this._treeView.append_column(appColumn);
-
-       let workspaceColumn = new Gtk.TreeViewColumn({ title: _("Workspace"),
+        this._treeView.get_selection().set_mode(Gtk.SelectionMode.SINGLE);
+
+        let appColumn = new Gtk.TreeViewColumn({ expand: true, sort_column_id: Columns.DISPLAY_NAME,
+                                                 title: _("Application") });
+        let iconRenderer = new Gtk.CellRendererPixbuf;
+        appColumn.pack_start(iconRenderer, false);
+        appColumn.add_attribute(iconRenderer, "gicon", Columns.ICON);
+        let nameRenderer = new Gtk.CellRendererText;
+        appColumn.pack_start(nameRenderer, true);
+        appColumn.add_attribute(nameRenderer, "text", Columns.DISPLAY_NAME);
+        this._treeView.append_column(appColumn);
+
+        let workspaceColumn = new Gtk.TreeViewColumn({ title: _("Workspace"),
                                                        sort_column_id: Columns.WORKSPACE });
-       let workspaceRenderer = new Gtk.CellRendererSpin({ editable: true });
-       workspaceRenderer.connect('edited', Lang.bind(this, this._workspaceEdited));
-       workspaceColumn.pack_start(workspaceRenderer, true);
-       workspaceColumn.add_attribute(workspaceRenderer, "adjustment", Columns.ADJUSTMENT);
+        let workspaceRenderer = new Gtk.CellRendererSpin({ editable: true });
+        workspaceRenderer.connect('edited', Lang.bind(this, this._workspaceEdited));
+        workspaceColumn.pack_start(workspaceRenderer, true);
+        workspaceColumn.add_attribute(workspaceRenderer, "adjustment", Columns.ADJUSTMENT);
         workspaceColumn.add_attribute(workspaceRenderer, "text", Columns.WORKSPACE);
-       this._treeView.append_column(workspaceColumn);
+        this._treeView.append_column(workspaceColumn);
 
-       scrolled.add(this._treeView);
+        scrolled.add(this._treeView);
 
-       let toolbar = new Gtk.Toolbar({ icon_size: Gtk.IconSize.SMALL_TOOLBAR });
-       toolbar.get_style_context().add_class(Gtk.STYLE_CLASS_INLINE_TOOLBAR);
-       this.add(toolbar);
+        let toolbar = new Gtk.Toolbar({ icon_size: Gtk.IconSize.SMALL_TOOLBAR });
+        toolbar.get_style_context().add_class(Gtk.STYLE_CLASS_INLINE_TOOLBAR);
+        this.add(toolbar);
 
-       let newButton = new Gtk.ToolButton({ icon_name: 'bookmark-new-symbolic',
+        let newButton = new Gtk.ToolButton({ icon_name: 'bookmark-new-symbolic',
                                              label: _("Add Rule"),
-                                            is_important: true });
-       newButton.connect('clicked', Lang.bind(this, this._createNew));
-       toolbar.add(newButton);
+                                             is_important: true });
+        newButton.connect('clicked', Lang.bind(this, this._createNew));
+        toolbar.add(newButton);
 
-       let delButton = new Gtk.ToolButton({ icon_name: 'edit-delete-symbolic'  });
-       delButton.connect('clicked', Lang.bind(this, this._deleteSelected));
-       toolbar.add(delButton);
+        let delButton = new Gtk.ToolButton({ icon_name: 'edit-delete-symbolic'  });
+        delButton.connect('clicked', Lang.bind(this, this._deleteSelected));
+        toolbar.add(delButton);
 
         let selection = this._treeView.get_selection();
         selection.connect('changed',
@@ -94,23 +94,23 @@ const Widget = new GObject.Class({
             });
         delButton.sensitive = selection.count_selected_rows() > 0;
 
-       this._changedPermitted = true;
-       this._refresh();
+        this._changedPermitted = true;
+        this._refresh();
     },
 
     _createNew: function() {
-       let dialog = new Gtk.Dialog({ title: _("Create new matching rule"),
-                                     transient_for: this.get_toplevel(),
+        let dialog = new Gtk.Dialog({ title: _("Create new matching rule"),
+                                      transient_for: this.get_toplevel(),
                                       use_header_bar: true,
-                                     modal: true });
-       dialog.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL);
-       let addButton = dialog.add_button(_("Add"), Gtk.ResponseType.OK);
+                                      modal: true });
+        dialog.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL);
+        let addButton = dialog.add_button(_("Add"), Gtk.ResponseType.OK);
         dialog.set_default_response(Gtk.ResponseType.OK);
 
-       let grid = new Gtk.Grid({ column_spacing: 10,
+        let grid = new Gtk.Grid({ column_spacing: 10,
                                   row_spacing: 15,
                                   margin: 10 });
-       dialog._appChooser = new Gtk.AppChooserWidget({ show_all: true });
+        dialog._appChooser = new Gtk.AppChooserWidget({ show_all: true });
         dialog._appChooser.connect('application-selected', Lang.bind(this,
             function(w, appInfo) {
                 addButton.sensitive = appInfo &&
@@ -119,105 +119,105 @@ const Widget = new GObject.Class({
         let appInfo = dialog._appChooser.get_app_info();
         addButton.sensitive = appInfo && this._checkId(appInfo.get_id());
 
-       grid.attach(dialog._appChooser, 0, 0, 2, 1);
-       grid.attach(new Gtk.Label({ label: _("Workspace"),
+        grid.attach(dialog._appChooser, 0, 0, 2, 1);
+        grid.attach(new Gtk.Label({ label: _("Workspace"),
                                     halign: Gtk.Align.END }), 0, 1, 1, 1);
-       let adjustment = new Gtk.Adjustment({ lower: 1,
-                                             upper: WORKSPACE_MAX,
-                                             step_increment: 1
+        let adjustment = new Gtk.Adjustment({ lower: 1,
+                                              upper: WORKSPACE_MAX,
+                                              step_increment: 1
                                             });
-       dialog._spin = new Gtk.SpinButton({ adjustment: adjustment,
-                                           snap_to_ticks: true });
+        dialog._spin = new Gtk.SpinButton({ adjustment: adjustment,
+                                            snap_to_ticks: true });
         dialog._spin.set_value(1);
-       grid.attach(dialog._spin, 1, 1, 1, 1);
-       dialog.get_content_area().add(grid);
+        grid.attach(dialog._spin, 1, 1, 1, 1);
+        dialog.get_content_area().add(grid);
 
-       dialog.connect('response', Lang.bind(this, function(dialog, id) {
-           if (id != Gtk.ResponseType.OK) {
+        dialog.connect('response', Lang.bind(this, function(dialog, id) {
+            if (id != Gtk.ResponseType.OK) {
                 dialog.destroy();
-               return;
+                return;
             }
 
-           let appInfo = dialog._appChooser.get_app_info();
-           if (!appInfo)
-               return;
-           let index = Math.floor(dialog._spin.value);
-           if (isNaN(index) || index < 0)
-               index = 1;
-
-           this._changedPermitted = false;
-           this._appendItem(appInfo.get_id(), index);
-           this._changedPermitted = true;
-
-           let iter = this._store.append();
-           let adj = new Gtk.Adjustment({ lower: 1,
-                                          upper: WORKSPACE_MAX,
-                                          step_increment: 1,
+            let appInfo = dialog._appChooser.get_app_info();
+            if (!appInfo)
+                return;
+            let index = Math.floor(dialog._spin.value);
+            if (isNaN(index) || index < 0)
+                index = 1;
+
+            this._changedPermitted = false;
+            this._appendItem(appInfo.get_id(), index);
+            this._changedPermitted = true;
+
+            let iter = this._store.append();
+            let adj = new Gtk.Adjustment({ lower: 1,
+                                           upper: WORKSPACE_MAX,
+                                           step_increment: 1,
                                            value: index });
-           this._store.set(iter,
-                           [Columns.APPINFO, Columns.ICON, Columns.DISPLAY_NAME, Columns.WORKSPACE, 
Columns.ADJUSTMENT],
-                           [appInfo, appInfo.get_icon(), appInfo.get_display_name(), index, adj]);
+            this._store.set(iter,
+                            [Columns.APPINFO, Columns.ICON, Columns.DISPLAY_NAME, Columns.WORKSPACE, 
Columns.ADJUSTMENT],
+                            [appInfo, appInfo.get_icon(), appInfo.get_display_name(), index, adj]);
 
             dialog.destroy();
-       }));
-       dialog.show_all();
+        }));
+        dialog.show_all();
     },
 
     _deleteSelected: function() {
-       let [any, model, iter] = this._treeView.get_selection().get_selected();
+        let [any, model, iter] = this._treeView.get_selection().get_selected();
 
-       if (any) {
-           let appInfo = this._store.get_value(iter, Columns.APPINFO);
+        if (any) {
+            let appInfo = this._store.get_value(iter, Columns.APPINFO);
 
-           this._changedPermitted = false;
-           this._removeItem(appInfo.get_id());
-           this._changedPermitted = true;
-           this._store.remove(iter);
-       }
+            this._changedPermitted = false;
+            this._removeItem(appInfo.get_id());
+            this._changedPermitted = true;
+            this._store.remove(iter);
+        }
     },
 
     _workspaceEdited: function(renderer, pathString, text) {
-       let index = parseInt(text);
-       if (isNaN(index) || index < 0)
-           index = 1;
+        let index = parseInt(text);
+        if (isNaN(index) || index < 0)
+            index = 1;
         let path = Gtk.TreePath.new_from_string(pathString);
-       let [model, iter] = this._store.get_iter(path);
-       let appInfo = this._store.get_value(iter, Columns.APPINFO);
+        let [model, iter] = this._store.get_iter(path);
+        let appInfo = this._store.get_value(iter, Columns.APPINFO);
 
-       this._changedPermitted = false;
-       this._changeItem(appInfo.get_id(), index);
-       this._store.set_value(iter, Columns.WORKSPACE, index);
-       this._changedPermitted = true;
+        this._changedPermitted = false;
+        this._changeItem(appInfo.get_id(), index);
+        this._store.set_value(iter, Columns.WORKSPACE, index);
+        this._changedPermitted = true;
     },
 
     _refresh: function() {
-       if (!this._changedPermitted)
-           // Ignore this notification, model is being modified outside
-           return;
-
-       this._store.clear();
-
-       let currentItems = this._settings.get_strv(SETTINGS_KEY);
-       let validItems = [ ];
-       for (let i = 0; i < currentItems.length; i++) {
-           let [id, index] = currentItems[i].split(':');
-           let appInfo = Gio.DesktopAppInfo.new(id);
-           if (!appInfo)
-               continue;
-           validItems.push(currentItems[i]);
-
-           let iter = this._store.append();
-           let adj = new Gtk.Adjustment({ lower: 1,
-                                          upper: WORKSPACE_MAX,
-                                          step_increment: 1,
+        if (!this._changedPermitted)
+            // Ignore this notification, model is being modified outside
+            return;
+
+        this._store.clear();
+
+        let currentItems = this._settings.get_strv(SETTINGS_KEY);
+        let validItems = [ ];
+        for (let i = 0; i < currentItems.length; i++) {
+            let [id, index] = currentItems[i].split(':');
+            let appInfo = Gio.DesktopAppInfo.new(id);
+            if (!appInfo)
+                continue;
+            validItems.push(currentItems[i]);
+
+            let iter = this._store.append();
+            let adj = new Gtk.Adjustment({ lower: 1,
+                                           upper: WORKSPACE_MAX,
+                                           step_increment: 1,
                                            value: index });
-           this._store.set(iter,
-                           [Columns.APPINFO, Columns.ICON, Columns.DISPLAY_NAME, Columns.WORKSPACE, 
Columns.ADJUSTMENT],
-                           [appInfo, appInfo.get_icon(), appInfo.get_display_name(), parseInt(index), adj]);
-       }
+            this._store.set(iter,
+                            [Columns.APPINFO, Columns.ICON, Columns.DISPLAY_NAME, Columns.WORKSPACE, 
Columns.ADJUSTMENT],
+                            [appInfo, appInfo.get_icon(), appInfo.get_display_name(), parseInt(index), adj]);
+        }
 
-       if (validItems.length != currentItems.length) // some items were filtered out
-           this._settings.set_strv(SETTINGS_KEY, validItems);
+        if (validItems.length != currentItems.length) // some items were filtered out
+            this._settings.set_strv(SETTINGS_KEY, validItems);
     },
 
     _checkId: function(id) {
@@ -226,34 +226,34 @@ const Widget = new GObject.Class({
     },
 
     _appendItem: function(id, workspace) {
-       let currentItems = this._settings.get_strv(SETTINGS_KEY);
-       currentItems.push(id + ':' + workspace);
-       this._settings.set_strv(SETTINGS_KEY, currentItems);
+        let currentItems = this._settings.get_strv(SETTINGS_KEY);
+        currentItems.push(id + ':' + workspace);
+        this._settings.set_strv(SETTINGS_KEY, currentItems);
     },
 
     _removeItem: function(id) {
-       let currentItems = this._settings.get_strv(SETTINGS_KEY);
-       let index = currentItems.map(function(el) {
-           return el.split(':')[0];
-       }).indexOf(id);
-
-       if (index < 0)
-           return;
-       currentItems.splice(index, 1);
-       this._settings.set_strv(SETTINGS_KEY, currentItems);
+        let currentItems = this._settings.get_strv(SETTINGS_KEY);
+        let index = currentItems.map(function(el) {
+            return el.split(':')[0];
+        }).indexOf(id);
+
+        if (index < 0)
+            return;
+        currentItems.splice(index, 1);
+        this._settings.set_strv(SETTINGS_KEY, currentItems);
     },
 
     _changeItem: function(id, workspace) {
-       let currentItems = this._settings.get_strv(SETTINGS_KEY);
-       let index = currentItems.map(function(el) {
-           return el.split(':')[0];
-       }).indexOf(id);
-
-       if (index < 0)
-           currentItems.push(id + ':' + workspace);
-       else
-           currentItems[index] = id + ':' + workspace;
-       this._settings.set_strv(SETTINGS_KEY, currentItems);
+        let currentItems = this._settings.get_strv(SETTINGS_KEY);
+        let index = currentItems.map(function(el) {
+            return el.split(':')[0];
+        }).indexOf(id);
+
+        if (index < 0)
+            currentItems.push(id + ':' + workspace);
+        else
+            currentItems[index] = id + ':' + workspace;
+        this._settings.set_strv(SETTINGS_KEY, currentItems);
     }
 });
 
diff --git a/extensions/drive-menu/extension.js b/extensions/drive-menu/extension.js
index f0b1068..f63868c 100644
--- a/extensions/drive-menu/extension.js
+++ b/extensions/drive-menu/extension.js
@@ -23,19 +23,19 @@ const MountMenuItem = new Lang.Class({
     Extends: PopupMenu.PopupBaseMenuItem,
 
     _init: function(mount) {
-       this.parent();
+        this.parent();
 
-       this.label = new St.Label({ text: mount.get_name() });
-       this.actor.add(this.label, { expand: true });
+        this.label = new St.Label({ text: mount.get_name() });
+        this.actor.add(this.label, { expand: true });
         this.actor.label_actor = this.label;
 
-       this.mount = mount;
+        this.mount = mount;
 
-       let ejectIcon = new St.Icon({ icon_name: 'media-eject-symbolic',
-                                     style_class: 'popup-menu-icon ' });
-       let ejectButton = new St.Button({ child: ejectIcon });
-       ejectButton.connect('clicked', Lang.bind(this, this._eject));
-       this.actor.add(ejectButton);
+        let ejectIcon = new St.Icon({ icon_name: 'media-eject-symbolic',
+                                      style_class: 'popup-menu-icon ' });
+        let ejectButton = new St.Button({ child: ejectIcon });
+        ejectButton.connect('clicked', Lang.bind(this, this._eject));
+        this.actor.add(ejectButton);
 
         this._changedId = mount.connect('changed', Lang.bind(this, this._syncVisibility));
         this._syncVisibility();
@@ -74,38 +74,38 @@ const MountMenuItem = new Lang.Class({
     _eject: function() {
         let mountOp = new ShellMountOperation.ShellMountOperation(this.mount);
 
-       if (this.mount.can_eject())
-           this.mount.eject_with_operation(Gio.MountUnmountFlags.NONE,
+        if (this.mount.can_eject())
+            this.mount.eject_with_operation(Gio.MountUnmountFlags.NONE,
                                             mountOp.mountOp,
-                                           null, // Gio.Cancellable
-                                           Lang.bind(this, this._ejectFinish));
-       else
-           this.mount.unmount_with_operation(Gio.MountUnmountFlags.NONE,
+                                            null, // Gio.Cancellable
+                                            Lang.bind(this, this._ejectFinish));
+        else
+            this.mount.unmount_with_operation(Gio.MountUnmountFlags.NONE,
                                               mountOp.mountOp,
-                                             null, // Gio.Cancellable
-                                             Lang.bind(this, this._unmountFinish));
+                                              null, // Gio.Cancellable
+                                              Lang.bind(this, this._unmountFinish));
     },
 
     _unmountFinish: function(mount, result) {
-       try {
-           mount.unmount_with_operation_finish(result);
-       } catch(e) {
-           this._reportFailure(e);
-       }
+        try {
+            mount.unmount_with_operation_finish(result);
+        } catch(e) {
+            this._reportFailure(e);
+        }
     },
 
     _ejectFinish: function(mount, result) {
-       try {
-           mount.eject_with_operation_finish(result);
-       } catch(e) {
-           this._reportFailure(e);
-       }
+        try {
+            mount.eject_with_operation_finish(result);
+        } catch(e) {
+            this._reportFailure(e);
+        }
     },
 
     _reportFailure: function(exception) {
-       // TRANSLATORS: %s is the filesystem name
-       let msg = _("Ejecting drive “%s” failed:").format(this.mount.get_name());
-       Main.notifyError(msg, exception.message);
+        // TRANSLATORS: %s is the filesystem name
+        let msg = _("Ejecting drive “%s” failed:").format(this.mount.get_name());
+        Main.notifyError(msg, exception.message);
     },
 
     activate: function(event) {
@@ -113,7 +113,7 @@ const MountMenuItem = new Lang.Class({
         Gio.AppInfo.launch_default_for_uri(this.mount.get_root().get_uri(),
                                            context);
 
-       this.parent(event);
+        this.parent(event);
     }
 });
 
@@ -132,64 +132,64 @@ const DriveMenu = new Lang.Class({
         hbox.add_child(PopupMenu.arrowIcon(St.Side.BOTTOM));
         this.actor.add_child(hbox);
 
-       this._monitor = Gio.VolumeMonitor.get();
-       this._addedId = this._monitor.connect('mount-added', Lang.bind(this, function(monitor, mount) {
-           this._addMount(mount);
-           this._updateMenuVisibility();
-       }));
-       this._removedId = this._monitor.connect('mount-removed', Lang.bind(this, function(monitor, mount) {
-           this._removeMount(mount);
-           this._updateMenuVisibility();
-       }));
+        this._monitor = Gio.VolumeMonitor.get();
+        this._addedId = this._monitor.connect('mount-added', Lang.bind(this, function(monitor, mount) {
+            this._addMount(mount);
+            this._updateMenuVisibility();
+        }));
+        this._removedId = this._monitor.connect('mount-removed', Lang.bind(this, function(monitor, mount) {
+            this._removeMount(mount);
+            this._updateMenuVisibility();
+        }));
 
-       this._mounts = [ ];
+        this._mounts = [ ];
 
-       this._monitor.get_mounts().forEach(Lang.bind(this, this._addMount));
+        this._monitor.get_mounts().forEach(Lang.bind(this, this._addMount));
 
-       this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
-       this.menu.addAction(_("Open Files"), function(event) {
-           let appSystem = Shell.AppSystem.get_default();
-           let app = appSystem.lookup_app('org.gnome.Nautilus.desktop');
-           app.activate_full(-1, event.get_time());
-       });
+        this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
+        this.menu.addAction(_("Open Files"), function(event) {
+            let appSystem = Shell.AppSystem.get_default();
+            let app = appSystem.lookup_app('org.gnome.Nautilus.desktop');
+            app.activate_full(-1, event.get_time());
+        });
 
-       this._updateMenuVisibility();
+        this._updateMenuVisibility();
     },
 
     _updateMenuVisibility: function() {
-       if (this._mounts.filter(function(i) i.actor.visible).length > 0)
-           this.actor.show();
-       else
-           this.actor.hide();
+        if (this._mounts.filter(function(i) i.actor.visible).length > 0)
+            this.actor.show();
+        else
+            this.actor.hide();
     },
 
     _addMount: function(mount) {
-       let item = new MountMenuItem(mount);
-       this._mounts.unshift(item);
-       this.menu.addMenuItem(item, 0);
+        let item = new MountMenuItem(mount);
+        this._mounts.unshift(item);
+        this.menu.addMenuItem(item, 0);
     },
 
     _removeMount: function(mount) {
-       for (let i = 0; i < this._mounts.length; i++) {
-           let item = this._mounts[i];
-           if (item.mount == mount) {
-               item.destroy();
-               this._mounts.splice(i, 1);
-               return;
-           }
-       }
-       log ('Removing a mount that was never added to the menu');
+        for (let i = 0; i < this._mounts.length; i++) {
+            let item = this._mounts[i];
+            if (item.mount == mount) {
+                item.destroy();
+                this._mounts.splice(i, 1);
+                return;
+            }
+        }
+        log ('Removing a mount that was never added to the menu');
     },
 
     destroy: function() {
         if (this._connectedId) {
-           this._monitor.disconnect(this._connectedId);
-           this._monitor.disconnect(this._disconnectedId);
+            this._monitor.disconnect(this._connectedId);
+            this._monitor.disconnect(this._disconnectedId);
             this._connectedId = 0;
             this._disconnectedId = 0;
         }
 
-       this.parent();
+        this.parent();
     },
 });
 
diff --git a/extensions/example/extension.js b/extensions/example/extension.js
index 752b373..96a6f78 100644
--- a/extensions/example/extension.js
+++ b/extensions/example/extension.js
@@ -43,7 +43,7 @@ function disable() {
     log ('Example extension disabled');
 
     if (signalId) {
-       Main.panel.actor.disconnect(signalId);
-       signalId = 0;
+        Main.panel.actor.disconnect(signalId);
+        signalId = 0;
     }
 }
diff --git a/extensions/example/prefs.js b/extensions/example/prefs.js
index 8491b8e..c40e809 100644
--- a/extensions/example/prefs.js
+++ b/extensions/example/prefs.js
@@ -22,12 +22,12 @@ const ExamplePrefsWidget = new GObject.Class({
     Extends: Gtk.Grid,
 
     _init: function(params) {
-       this.parent(params);
+        this.parent(params);
         this.margin = 12;
         this.row_spacing = this.column_spacing = 6;
         this.set_orientation(Gtk.Orientation.VERTICAL);
 
-       this.add(new Gtk.Label({ label: '<b>' + _("Message") + '</b>',
+        this.add(new Gtk.Label({ label: '<b>' + _("Message") + '</b>',
                                  use_markup: true,
                                  halign: Gtk.Align.START }));
 
@@ -35,16 +35,16 @@ const ExamplePrefsWidget = new GObject.Class({
                                     margin_bottom: 12 });
         this.add(entry);
 
-       this._settings = Convenience.getSettings();
-       this._settings.bind('hello-text', entry, 'text', Gio.SettingsBindFlags.DEFAULT);
+        this._settings = Convenience.getSettings();
+        this._settings.bind('hello-text', entry, 'text', Gio.SettingsBindFlags.DEFAULT);
 
-       // TRANSLATORS: Example is the name of the extension, should not be
-       // translated
-       let primaryText = _("Example aims to show how to build well behaved \
+        // TRANSLATORS: Example is the name of the extension, should not be
+        // translated
+        let primaryText = _("Example aims to show how to build well behaved \
 extensions for the Shell and as such it has little functionality on its own.\n\
 Nevertheless it’s possible to customize the greeting message.");
 
-       this.add(new Gtk.Label({ label: primaryText,
+        this.add(new Gtk.Label({ label: primaryText,
                                  wrap: true, xalign: 0 }));
     }
 });
diff --git a/extensions/places-menu/extension.js b/extensions/places-menu/extension.js
index 767fb87..70db0e6 100644
--- a/extensions/places-menu/extension.js
+++ b/extensions/places-menu/extension.js
@@ -28,12 +28,12 @@ const PlaceMenuItem = new Lang.Class({
     Extends: PopupMenu.PopupBaseMenuItem,
 
     _init: function(info) {
-       this.parent();
-       this._info = info;
+        this.parent();
+        this._info = info;
 
         this._icon = new St.Icon({ gicon: info.icon,
                                    icon_size: PLACE_ICON_SIZE });
-       this.actor.add_child(this._icon);
+        this.actor.add_child(this._icon);
 
         this._label = new St.Label({ text: info.name });
         this.actor.add_child(this._label);
@@ -52,9 +52,9 @@ const PlaceMenuItem = new Lang.Class({
     },
 
     activate: function(event) {
-       this._info.launch(event.get_time());
+        this._info.launch(event.get_time());
 
-       this.parent(event);
+        this.parent(event);
     },
 
     _propertiesChanged: function(info) {
@@ -87,29 +87,29 @@ const PlacesMenu = new Lang.Class({
 
         this.placesManager = new PlaceDisplay.PlacesManager();
 
-       this._sections = { };
+        this._sections = { };
 
-       for (let i=0; i < SECTIONS.length; i++) {
-           let id = SECTIONS[i];
-           this._sections[id] = new PopupMenu.PopupMenuSection();
-           this.placesManager.connect(id + '-updated', Lang.bind(this, function() {
-               this._redisplay(id);
-           }));
+        for (let i=0; i < SECTIONS.length; i++) {
+            let id = SECTIONS[i];
+            this._sections[id] = new PopupMenu.PopupMenuSection();
+            this.placesManager.connect(id + '-updated', Lang.bind(this, function() {
+                this._redisplay(id);
+            }));
 
-           this._create(id);
-           this.menu.addMenuItem(this._sections[id]);
-           this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
-       }
+            this._create(id);
+            this.menu.addMenuItem(this._sections[id]);
+            this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
+        }
     },
 
     destroy: function() {
-       this.placesManager.destroy();
+        this.placesManager.destroy();
 
         this.parent();
     },
 
     _redisplay: function(id) {
-       this._sections[id].removeAll();
+        this._sections[id].removeAll();
         this._create(id);
     },
 
@@ -119,7 +119,7 @@ const PlacesMenu = new Lang.Class({
         for (let i = 0; i < places.length; i++)
             this._sections[id].addMenuItem(new PlaceMenuItem(places[i]));
 
-       this._sections[id].actor.visible = places.length > 0;
+        this._sections[id].actor.visible = places.length > 0;
     }
 });
 
@@ -134,7 +134,7 @@ function enable() {
 
     let pos = 1;
     if ('apps-menu' in Main.panel.statusArea)
-       pos = 2;
+        pos = 2;
     Main.panel.addToStatusArea('places-menu', _indicator, pos, 'left');
 }
 
diff --git a/extensions/workspace-indicator/extension.js b/extensions/workspace-indicator/extension.js
index 37a3a08..628c5a2 100644
--- a/extensions/workspace-indicator/extension.js
+++ b/extensions/workspace-indicator/extension.js
@@ -27,104 +27,104 @@ const WorkspaceIndicator = new Lang.Class({
     Extends: PanelMenu.Button,
 
     _init: function() {
-       this.parent(0.0, _("Workspace Indicator"));
+        this.parent(0.0, _("Workspace Indicator"));
 
-       this._currentWorkspace = global.screen.get_active_workspace().index();
-       this.statusLabel = new St.Label({ y_align: Clutter.ActorAlign.CENTER,
+        this._currentWorkspace = global.screen.get_active_workspace().index();
+        this.statusLabel = new St.Label({ y_align: Clutter.ActorAlign.CENTER,
                                           text: this._labelText() });
 
-       this.actor.add_actor(this.statusLabel);
+        this.actor.add_actor(this.statusLabel);
 
-       this.workspacesItems = [];
-       this._workspaceSection = new PopupMenu.PopupMenuSection();
-       this.menu.addMenuItem(this._workspaceSection);
+        this.workspacesItems = [];
+        this._workspaceSection = new PopupMenu.PopupMenuSection();
+        this.menu.addMenuItem(this._workspaceSection);
 
-       this._screenSignals = [];
-       this._screenSignals.push(global.screen.connect_after('workspace-added', 
Lang.bind(this,this._createWorkspacesSection)));
-       this._screenSignals.push(global.screen.connect_after('workspace-removed', 
Lang.bind(this,this._createWorkspacesSection)));
-       this._screenSignals.push(global.screen.connect_after('workspace-switched', 
Lang.bind(this,this._updateIndicator)));
+        this._screenSignals = [];
+        this._screenSignals.push(global.screen.connect_after('workspace-added', 
Lang.bind(this,this._createWorkspacesSection)));
+        this._screenSignals.push(global.screen.connect_after('workspace-removed', 
Lang.bind(this,this._createWorkspacesSection)));
+        this._screenSignals.push(global.screen.connect_after('workspace-switched', 
Lang.bind(this,this._updateIndicator)));
 
-       this.actor.connect('scroll-event', Lang.bind(this, this._onScrollEvent));
-       this._createWorkspacesSection();
+        this.actor.connect('scroll-event', Lang.bind(this, this._onScrollEvent));
+        this._createWorkspacesSection();
 
-       //styling
-       this.statusLabel.add_style_class_name('panel-workspace-indicator');
+        //styling
+        this.statusLabel.add_style_class_name('panel-workspace-indicator');
 
         this._settings = new Gio.Settings({ schema_id: WORKSPACE_SCHEMA });
         this._settingsChangedId = this._settings.connect('changed::' + WORKSPACE_KEY, Lang.bind(this, 
this._createWorkspacesSection));
     },
 
     destroy: function() {
-       for (let i = 0; i < this._screenSignals.length; i++)
-           global.screen.disconnect(this._screenSignals[i]);
+        for (let i = 0; i < this._screenSignals.length; i++)
+            global.screen.disconnect(this._screenSignals[i]);
 
         if (this._settingsChangedId) {
             this._settings.disconnect(this._settingsChangedId);
             this._settingsChangedId = 0;
         }
 
-       this.parent();
+        this.parent();
     },
 
     _updateIndicator: function() {
-       this.workspacesItems[this._currentWorkspace].setOrnament(PopupMenu.Ornament.NONE);
-       this._currentWorkspace = global.screen.get_active_workspace().index();
-       this.workspacesItems[this._currentWorkspace].setOrnament(PopupMenu.Ornament.DOT);
+        this.workspacesItems[this._currentWorkspace].setOrnament(PopupMenu.Ornament.NONE);
+        this._currentWorkspace = global.screen.get_active_workspace().index();
+        this.workspacesItems[this._currentWorkspace].setOrnament(PopupMenu.Ornament.DOT);
 
-       this.statusLabel.set_text(this._labelText());
+        this.statusLabel.set_text(this._labelText());
     },
 
     _labelText: function(workspaceIndex) {
-       if(workspaceIndex == undefined) {
-           workspaceIndex = this._currentWorkspace;
-           return (workspaceIndex + 1).toString();
-       }
-       return Meta.prefs_get_workspace_name(workspaceIndex);
+        if(workspaceIndex == undefined) {
+            workspaceIndex = this._currentWorkspace;
+            return (workspaceIndex + 1).toString();
+        }
+        return Meta.prefs_get_workspace_name(workspaceIndex);
     },
 
     _createWorkspacesSection: function() {
-       this._workspaceSection.removeAll();
-       this.workspacesItems = [];
-       this._currentWorkspace = global.screen.get_active_workspace().index();
-
-       let i = 0;
-       for(; i < global.screen.n_workspaces; i++) {
-           this.workspacesItems[i] = new PopupMenu.PopupMenuItem(this._labelText(i));
-           this._workspaceSection.addMenuItem(this.workspacesItems[i]);
-           this.workspacesItems[i].workspaceId = i;
-           this.workspacesItems[i].label_actor = this.statusLabel;
-           let self = this;
-           this.workspacesItems[i].connect('activate', Lang.bind(this, function(actor, event) {
-               this._activate(actor.workspaceId);
-           }));
-
-           if (i == this._currentWorkspace)
-               this.workspacesItems[i].setOrnament(PopupMenu.Ornament.DOT);
-       }
-
-       this.statusLabel.set_text(this._labelText());
+        this._workspaceSection.removeAll();
+        this.workspacesItems = [];
+        this._currentWorkspace = global.screen.get_active_workspace().index();
+
+        let i = 0;
+        for(; i < global.screen.n_workspaces; i++) {
+            this.workspacesItems[i] = new PopupMenu.PopupMenuItem(this._labelText(i));
+            this._workspaceSection.addMenuItem(this.workspacesItems[i]);
+            this.workspacesItems[i].workspaceId = i;
+            this.workspacesItems[i].label_actor = this.statusLabel;
+            let self = this;
+            this.workspacesItems[i].connect('activate', Lang.bind(this, function(actor, event) {
+                this._activate(actor.workspaceId);
+            }));
+
+            if (i == this._currentWorkspace)
+                this.workspacesItems[i].setOrnament(PopupMenu.Ornament.DOT);
+        }
+
+        this.statusLabel.set_text(this._labelText());
     },
 
     _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());
-       }
+        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) {
-       let direction = event.get_scroll_direction();
-       let diff = 0;
-       if (direction == Clutter.ScrollDirection.DOWN) {
-           diff = 1;
-       } else if (direction == Clutter.ScrollDirection.UP) {
-           diff = -1;
-       } else {
-           return;
-       }
-
-       let newIndex = global.screen.get_active_workspace().index() + diff;
-       this._activate(newIndex);
+        let direction = event.get_scroll_direction();
+        let diff = 0;
+        if (direction == Clutter.ScrollDirection.DOWN) {
+            diff = 1;
+        } else if (direction == Clutter.ScrollDirection.UP) {
+            diff = -1;
+        } else {
+            return;
+        }
+
+        let newIndex = global.screen.get_active_workspace().index() + diff;
+        this._activate(newIndex);
     },
 });
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]