[gnome-shell] calendar: Don't ever force reload



commit 9fce12d6b4a9aee338b5aaf7d0c5e3090dc7cea0
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Dec 11 19:58:42 2013 -0500

    calendar: Don't ever force reload
    
    https://bugzilla.gnome.org/show_bug.cgi?id=720298

 js/ui/calendar.js |   43 +++++++++++++++++++------------------------
 js/ui/dateMenu.js |   17 +----------------
 2 files changed, 20 insertions(+), 40 deletions(-)
---
diff --git a/js/ui/calendar.js b/js/ui/calendar.js
index d915783..836e898 100644
--- a/js/ui/calendar.js
+++ b/js/ui/calendar.js
@@ -329,25 +329,22 @@ const DBusEventSource = new Lang.Class({
             return;
 
         if (this._curRequestBegin && this._curRequestEnd){
-            let callFlags = Gio.DBusCallFlags.NO_AUTO_START;
-            if (forceReload)
-                callFlags = Gio.DBusCallFlags.NONE;
             this._dbusProxy.GetEventsRemote(this._curRequestBegin.getTime() / 1000,
                                             this._curRequestEnd.getTime() / 1000,
                                             forceReload,
                                             Lang.bind(this, this._onEventsReceived),
-                                            callFlags);
+                                            Gio.DBusCallFlags.NONE);
         }
     },
 
-    requestRange: function(begin, end, forceReload) {
-        if (forceReload || !(_datesEqual(begin, this._lastRequestBegin) && _datesEqual(end, 
this._lastRequestEnd))) {
+    requestRange: function(begin, end) {
+        if (!(_datesEqual(begin, this._lastRequestBegin) && _datesEqual(end, this._lastRequestEnd))) {
             this.isLoading = true;
             this._lastRequestBegin = begin;
             this._lastRequestEnd = end;
             this._curRequestBegin = begin;
             this._curRequestEnd = end;
-            this._loadEvents(forceReload);
+            this._loadEvents(false);
         }
     },
 
@@ -419,21 +416,19 @@ const Calendar = new Lang.Class({
     setEventSource: function(eventSource) {
         this._eventSource = eventSource;
         this._eventSource.connect('changed', Lang.bind(this, function() {
-            this._update(false);
+            this._update();
         }));
-        this._update(true);
+        this._update();
     },
 
     // Sets the calendar to show a specific date
-    setDate: function(date, forceReload) {
-        if (!_sameDay(date, this._selectedDate)) {
-            this._selectedDate = date;
-            this._update(forceReload);
-            this.emit('selected-date-changed', new Date(this._selectedDate));
-        } else {
-            if (forceReload)
-                this._update(forceReload);
-        }
+    setDate: function(date) {
+        if (_sameDay(date, this._selectedDate))
+            return;
+
+        this._selectedDate = date;
+        this._update();
+        this.emit('selected-date-changed', new Date(this._selectedDate));
     },
 
     _buildHeader: function() {
@@ -521,7 +516,7 @@ const Calendar = new Lang.Class({
 
         this._backButton.grab_key_focus();
 
-        this.setDate(newDate, false);
+        this.setDate(newDate);
     },
 
     _onNextMonthButtonClicked: function() {
@@ -545,16 +540,16 @@ const Calendar = new Lang.Class({
 
         this._forwardButton.grab_key_focus();
 
-        this.setDate(newDate, false);
+        this.setDate(newDate);
     },
 
     _onSettingsChange: function() {
         this._useWeekdate = this._settings.get_boolean(SHOW_WEEKDATE_KEY);
         this._buildHeader();
-        this._update(false);
+        this._update();
     },
 
-    _update: function(forceReload) {
+    _update: function() {
         let now = new Date();
 
         if (_sameYear(this._selectedDate, now))
@@ -614,7 +609,7 @@ const Calendar = new Lang.Class({
                 this._shouldDateGrabFocus = true;
 
                 let newlySelectedDate = new Date(iterStr);
-                this.setDate(newlySelectedDate, false);
+                this.setDate(newlySelectedDate);
 
                 this._shouldDateGrabFocus = false;
             }));
@@ -671,7 +666,7 @@ const Calendar = new Lang.Class({
         }
         // Signal to the event source that we are interested in events
         // only from this date range
-        this._eventSource.requestRange(beginDate, iter, forceReload);
+        this._eventSource.requestRange(beginDate, iter);
     }
 });
 
diff --git a/js/ui/dateMenu.js b/js/ui/dateMenu.js
index bd72a66..d851ed2 100644
--- a/js/ui/dateMenu.js
+++ b/js/ui/dateMenu.js
@@ -113,22 +113,7 @@ const DateMenuButton = new Lang.Class({
         this.menu.connect('open-state-changed', Lang.bind(this, function(menu, isOpen) {
             if (isOpen) {
                 let now = new Date();
-                /* Passing true to setDate() forces events to be reloaded. We
-                 * want this behavior, because
-                 *
-                 *   o It will cause activation of the calendar server which is
-                 *     useful if it has crashed
-                 *
-                 *   o It will cause the calendar server to reload events which
-                 *     is useful if dynamic updates are not supported or not
-                 *     properly working
-                 *
-                 * Since this only happens when the menu is opened, the cost
-                 * isn't very big.
-                 */
-                this._calendar.setDate(now, true);
-                // No need to update this._eventList as ::selected-date-changed
-                // signal will fire
+                this._calendar.setDate(now);
             }
         }));
 


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