[polari] roomList: Work around imprecise CONNECTING status
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] roomList: Work around imprecise CONNECTING status
- Date: Sun, 11 Sep 2016 20:19:59 +0000 (UTC)
commit 5ba822e1312dc00ccff01ffffee6e4cbef851c80
Author: Florian Müllner <fmuellner gnome org>
Date: Wed Aug 10 14:21:02 2016 +0200
roomList: Work around imprecise CONNECTING status
This needs some investigation, but for some reason CONNECTING is
used as the initial state, even before we ask to connect in the
first place. I suspect a telepathy-idle issue, but until we figure
it out, this works ...
https://bugzilla.gnome.org/show_bug.cgi?id=770751
src/roomList.js | 21 +++++++++++++--------
1 files changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/src/roomList.js b/src/roomList.js
index e3bc769..07ed7a7 100644
--- a/src/roomList.js
+++ b/src/roomList.js
@@ -197,7 +197,6 @@ const RoomListHeader = new Lang.Class({
let connectionStatusChangedId =
this._account.connect('notify::connection-status',
Lang.bind(this, this._onConnectionStatusChanged));
- this._onConnectionStatusChanged();
let presenceChangedId =
this._account.connect('notify::requested-presence-type',
@@ -242,8 +241,15 @@ const RoomListHeader = new Lang.Class({
return this.parent(event);
},
+ _getConnectionStatus: function() {
+ let presence = this._account.requested_presence_type;
+ if (presence == Tp.ConnectionPresenceType.OFFLINE)
+ return Tp.ConnectionStatus.DISCONNECTED;
+ return this._account.connection_status;
+ },
+
_onConnectionStatusChanged: function() {
- let status = this._account.connection_status;
+ let status = this._getConnectionStatus();
let reason = this._account.connection_status_reason;
let authError = Tp.error_get_dbus_name(Tp.Error.AUTHENTICATION_FAILED);
let isError = (status == Tp.ConnectionStatus.DISCONNECTED &&
@@ -251,12 +257,10 @@ const RoomListHeader = new Lang.Class({
let isAuth = isError && this._account.connection_error == authError;
let child = 'default';
- if (status == Tp.ConnectionStatus.CONNECTING) {
- if (this._networkMonitor.network_available)
- child = 'connecting';
- } else if (isError) {
+ if (status == Tp.ConnectionStatus.CONNECTING)
+ child = 'connecting';
+ else if (isError)
child = isAuth ? 'auth' : 'error';
- }
this._iconStack.visible_child_name = child;
this._spinner.active = (child == 'connecting');
@@ -292,10 +296,11 @@ const RoomListHeader = new Lang.Class({
let offline = presence == Tp.ConnectionPresenceType.OFFLINE;
this._popoverConnect.visible = offline;
this._popoverReconnect.visible = !offline;
+ this._onConnectionStatusChanged();
},
_getStatusLabel: function() {
- switch (this._account.connection_status) {
+ switch (this._getConnectionStatus()) {
case Tp.ConnectionStatus.CONNECTED:
return _("Connected");
case Tp.ConnectionStatus.CONNECTING:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]