[gnome-shell] Calendar: freeze updates when the event source is loading



commit 443fe813c361585b6d4163a919e5964e497449fd
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Tue Oct 23 18:41:24 2012 +0200

    Calendar: freeze updates when the event source is loading
    
    Check if the event source is currently doing an async call, and prevent
    UI updates in that case. This avoids a flash of "No updates" when switching
    months.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=641383

 js/ui/calendar.js |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/calendar.js b/js/ui/calendar.js
index 050ad8d..4606ed6 100644
--- a/js/ui/calendar.js
+++ b/js/ui/calendar.js
@@ -168,6 +168,7 @@ const EmptyEventSource = new Lang.Class({
     Name: 'EmptyEventSource',
 
     _init: function() {
+        this.isLoading = false;
     },
 
     requestRange: function(begin, end) {
@@ -229,6 +230,7 @@ const DBusEventSource = new Lang.Class({
 
     _init: function() {
         this._resetCache();
+        this.isLoading = false;
 
         this._initialized = false;
         this._dbusProxy = new CalendarServer();
@@ -293,6 +295,7 @@ const DBusEventSource = new Lang.Class({
         }
 
         this._events = newEvents;
+        this.isLoading = false;
         this.emit('changed');
     },
 
@@ -315,6 +318,7 @@ const DBusEventSource = new Lang.Class({
 
     requestRange: function(begin, end, forceReload) {
         if (forceReload || !(_datesEqual(begin, this._lastRequestBegin) && _datesEqual(end, 
this._lastRequestEnd))) {
+            this.isLoading = true;
             this._lastRequestBegin = begin;
             this._lastRequestEnd = end;
             this._curRequestBegin = begin;
@@ -776,6 +780,9 @@ const EventsList = new Lang.Class({
     },
 
     _update: function() {
+        if (this._eventSource.isLoading)
+            return;
+
         let today = new Date();
         if (_sameDay (this._date, today)) {
             this._showToday();


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