Commit 21455581 authored by Florian Müllner's avatar Florian Müllner

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.
parent 32f038df
......@@ -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);
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment