Commit eb1c5589 authored by Florian Müllner's avatar Florian Müllner
Browse files

app: Add 'discard-identify-password' action

Users will not only be offered the choice of saving "identify"
credentials, but also to dismiss the operation. Discard the
cached parameters in that case as well as on shutdown when
the cache becomes invalid.

https://bugzilla.gnome.org/show_bug.cgi?id=709982
parent d85fd78f
......@@ -80,6 +80,8 @@ const Application = new Lang.Class({
parameter_type: GLib.VariantType.new('o') },
{ name: 'save-identify-password',
parameter_type: GLib.VariantType.new('o') },
{ name: 'discard-identify-password',
parameter_type: GLib.VariantType.new('o') },
{ name: 'help',
activate: Lang.bind(this, this._onShowHelp),
accels: ['F1'] },
......
......@@ -118,6 +118,7 @@ const TelepathyClient = new Lang.Class({
this._app = Gio.Application.get_default();
this._app.connect('prepare-shutdown', () => {
[...this._pendingRequests.values()].forEach(r => { r.cancel(); });
[...this._pendingBotPasswords.keys()].forEach(a => { this._discardIdentifyPassword(a); });
});
this._pendingBotPasswords = new Map();
......@@ -152,7 +153,9 @@ const TelepathyClient = new Lang.Class({
{ name: 'authenticate-account',
handler: Lang.bind(this, this._onAuthenticateAccountActivated) },
{ name: 'save-identify-password',
handler: Lang.bind(this, this._onSaveIdentifyPasswordActivated) }
handler: Lang.bind(this, this._onSaveIdentifyPasswordActivated) },
{ name: 'discard-identify-password',
handler: Lang.bind(this, this._onDiscardIdentifyPasswordActivated) }
];
actions.forEach(a => {
this._app.lookup_action(a.name).connect('activate', a.handler);
......@@ -368,6 +371,16 @@ const TelepathyClient = new Lang.Class({
settings.set_string('identify-username', data.username);
},
_onDiscardIdentifyPasswordActivated: function(action, parameter) {
let accountPath = parameter.deep_unpack();
this._discardIdentifyPassword(accountPath);
},
_discardIdentifyPassword: function(accountPath) {
this._pendingBotPasswords.delete(accountPath);
},
_isAuthChannel: function(channel) {
return channel.channel_type == Tp.IFACE_CHANNEL_TYPE_SERVER_AUTHENTICATION;
},
......
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