[polari/wip/bastianilso/error-handling: 15/16] WIP: Reconnect without encryption action



commit 56d71e1541a8430537f8ab811375c965d38a2711
Author: Bastian Ilsø <bastianilso src gnome org>
Date:   Sun Aug 16 22:37:10 2015 +0200

    WIP: Reconnect without encryption action

 src/application.js |   17 +++++++++++++++++
 src/roomList.js    |    5 +++--
 2 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index aeb432d..1b78240 100644
--- a/src/application.js
+++ b/src/application.js
@@ -84,6 +84,9 @@ const Application = new Lang.Class({
             create_hook: Lang.bind(this, this._userListCreateHook),
             state: GLib.Variant.new('b', false),
             accels: ['F9', '<Primary>u'] },
+          { name: 'reconnect-without-encryption',
+            activate: Lang.bind(this, this._onReconnectWithoutEncryption),
+            parameter_type: GLib.VariantType.new('o') },
           { name: 'edit-connection',
             activate: Lang.bind(this, this._onEditConnection),
             parameter_type: GLib.VariantType.new('o') },
@@ -418,6 +421,20 @@ const Application = new Lang.Class({
         dialog.widget.show();
     },
 
+    _onReconnectWithoutEncryption: function(action, parameter) {
+        let accountPath = parameter.deep_unpack();
+        let factory = Tp.AccountManager.dup().get_factory();
+        let account = factory.ensure_account(accountPath, []);
+
+        let sv = { port: GLib.Variant.new('u', 6667) };
+        sv['use-ssl'] = GLib.Variant.new('b', false);
+        let asv = GLib.Variant.new('a{sv}', sv);
+        account.update_parameters_vardict_async(asv, [],
+            Lang.bind(this, function(a, res) {
+                a.update_parameters_vardict_finish(res);
+            }));
+    },
+
     _onShowPreferences: function() {
     },
 
diff --git a/src/roomList.js b/src/roomList.js
index 660f093..054009f 100644
--- a/src/roomList.js
+++ b/src/roomList.js
@@ -249,8 +249,9 @@ const RoomListHeader = new Lang.Class({
                 case Tp.error_get_dbus_name(Tp.Error.CERT_FINGERPRINT_MISMATCH):
                 case Tp.error_get_dbus_name(Tp.Error.CERT_SELF_SIGNED): {
                     this._popoverLabel.label = _("Could not make connection in a safe way.");
-                    this._popoverButton.label =  _("Edit Connection");
-                    this._popoverButton.action_name = 'app.edit-connection';
+                    this._popoverButton.label =  _("Continue Anyway");
+                    this._popoverButton.action_name = 'app.reconnect-without-encryption';
+                    this._popoverLabel.label = _("The connection is not safe.");
                     this._popoverButton.action_target = GLib.Variant.new('o', 
this._account.get_object_path());
                     break;
                 }


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