[polari] roomListHeader: Ensure feedback for the "reconnect" action
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] roomListHeader: Ensure feedback for the "reconnect" action
- Date: Fri, 19 Jan 2018 10:56:03 +0000 (UTC)
commit 4f940c7b8af761bf1da2eaacca3b02dd53b54450
Author: unkemptArc99 <abhishekbhardwaj540 gmail com>
Date: Wed Jan 17 19:41:03 2018 +0530
roomListHeader: Ensure feedback for the "reconnect" action
In cases where the user is offline or the IRC server is down (and
similar other cases), the reconnect action appears to have no effect,
as the transition of state changes from ERROR to CONNECTING back to
ERROR resolves so fast that it feels like the state changes from ERROR
to ERROR.
Resolved this by delaying the last state change, if necessary, so
that the spinner is shown for at least a second.
https://gitlab.gnome.org/GNOME/polari/issues/21
src/roomList.js | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
---
diff --git a/src/roomList.js b/src/roomList.js
index 6d29a37..e7f6087 100644
--- a/src/roomList.js
+++ b/src/roomList.js
@@ -9,6 +9,8 @@ const Tp = imports.gi.TelepathyGLib;
const {AccountsMonitor} = imports.accountsMonitor;
const {RoomManager} = imports.roomManager;
+const MIN_SPINNER_TIME = 1000000; //in microsecond
+
function _onPopoverVisibleChanged(popover) {
let context = popover.relative_to.get_style_context();
if (popover.visible)
@@ -244,6 +246,8 @@ var RoomListHeader = GObject.registerClass({
this.popover.hide();
});
+ this._spinnerActivationTime = 0;
+
let displayNameChangedId =
this._account.connect('notify::display-name',
this._onDisplayNameChanged.bind(this));
@@ -319,10 +323,24 @@ var RoomListHeader = GObject.registerClass({
else if (status == Tp.ConnectionStatus.DISCONNECTED)
child = 'disconnected';
+ if (isError && this._spinner.active) {
+ let spinnerTime = GLib.get_monotonic_time() - this._spinnerActivationTime;
+ if (spinnerTime < MIN_SPINNER_TIME) {
+ Mainloop.timeout_add((MIN_SPINNER_TIME - spinnerTime) / 1000, () => {
+ this._onConnectionStatusChanged();
+ return GLib.SOURCE_REMOVE;
+ });
+ return;
+ }
+ }
+
this._iconStack.visible_child_name = child;
this._spinner.active = (child == 'connecting');
this._popoverTitle.visible = !isAuth;
+ if(this._spinner.active)
+ this._spinnerActivationTime = GLib.get_monotonic_time();
+
this._popoverTitle.use_markup = isError;
this._popoverStatus.use_markup = !isError;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]