[gnome-documents/wip/gepub] application: simplify code



commit afdca5f73f36ad58b48659756db8d353a4f25e11
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Tue Jun 21 15:45:22 2016 -0700

    application: simplify code
    
    Use indexOf() instead of a hand-written implementation of the same.

 src/application.js |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index 2d5e364..ba84ec3 100644
--- a/src/application.js
+++ b/src/application.js
@@ -319,14 +319,8 @@ const Application = new Lang.Class({
                     modeController.connect('window-mode-changed', Lang.bind(this,
                         function() {
                             let mode = modeController.getWindowMode();
+                            let enable = actionEntry.window_modes.indexOf(mode) != -1;
                             let action = this.lookup_action(actionEntry.name);
-                            let enable = false;
-                            for (let idx in actionEntry.window_modes) {
-                                if (mode == actionEntry.window_modes[idx]) {
-                                    enable = true;
-                                    break;
-                                }
-                            }
                             action.set_enabled(enable);
                         }));
                 }


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