[gnome-documents/wip/rishi/split-view: 15/18] application: Let some actions be enabled across multiple window modes



commit 4bb24b6b2590718615b093ba8c89d9d5d6e888a7
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Feb 10 15:57:38 2015 +0100

    application: Let some actions be enabled across multiple window modes
    
    With multiple views, those actions which were only needed in the
    overview will need to work in the documents, collections and search
    views also.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=686461

 src/application.js |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index ca0abad..391e924 100644
--- a/src/application.js
+++ b/src/application.js
@@ -314,6 +314,20 @@ const Application = new Lang.Class({
                             let action = this.lookup_action(actionEntry.name);
                             action.set_enabled(mode == actionEntry.window_mode);
                         }));
+                } else if (actionEntry.window_modes) {
+                    modeController.connect('window-mode-changed', Lang.bind(this,
+                        function() {
+                            let mode = modeController.getWindowMode();
+                            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]