[polari] app: Restore previous state when 'user-list' action is enabled



commit 21455581a05801e39923ad287630cf810e6ff91c
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Oct 4 15:31:12 2013 +0200

    app: Restore previous state when 'user-list' action is enabled
    
    The user list only makes sense for group chats, so we hide the
    sidebar and disable the corresponding action in other cases.
    However showing the sidebar was a user choice, so we should
    restore its visibility once the action becomes available again
    rather than leaving it hidden.

 src/application.js |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index 40195fe..089884a 100644
--- a/src/application.js
+++ b/src/application.js
@@ -196,8 +196,14 @@ const Application = new Lang.Class({
                 this._updateUserListAction(action);
             }));
         action.connect('notify::enabled', function() {
-            if (!action.enabled)
+            if (action.enabled) {
+                if (action._previousState)
+                    action.change_state(GLib.Variant.new('b', true));
+                delete action._previousState;
+            } else {
+                action._previousState = action.state.get_boolean();
                 action.change_state(GLib.Variant.new('b', false));
+            }
         });
         this._updateUserListAction(action);
     },


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