From 01344fcf7109aa776f73bdee48ae34b148e09fdc Mon Sep 17 00:00:00 2001 From: "daniel.boelzle%sun.com" Date: Tue, 6 May 2008 12:40:15 +0000 Subject: [PATCH] =?UTF-8?q?Bug=20401693=20=C3=A2=C2=80=C2=93=20Today=20pan?= =?UTF-8?q?e=20not=20updated=20on=20Mac=20OS=20X=20after=20hibernation;=20?= =?UTF-8?q?r=3Dberend?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://10.0.0.236/trunk@251250 18797224-902f-48f8-a5cc-f745e15eee43 --- .../calendar/base/content/calendar-views.js | 14 ++++++++-- .../content/messenger-overlay-sidebar.js | 28 +++++++++++-------- .../calendar/resources/content/calendar.js | 8 ++++-- 3 files changed, 34 insertions(+), 16 deletions(-) diff --git a/mozilla/calendar/base/content/calendar-views.js b/mozilla/calendar/base/content/calendar-views.js index 5b80c8f160a..43fb3b74482 100644 --- a/mozilla/calendar/base/content/calendar-views.js +++ b/mozilla/calendar/base/content/calendar-views.js @@ -378,6 +378,7 @@ function scheduleMidnightUpdate(aRefreshCallback) { // stuck in an infinite loop. var udCallback = { notify: function(timer) { + LOG("scheduleMidnightUpdate -- timer shot."); aRefreshCallback(); } }; @@ -386,8 +387,17 @@ function scheduleMidnightUpdate(aRefreshCallback) { // Observer for wake after sleep/hibernate/standby to create new timers and refresh UI var wakeObserver = { observe: function(aSubject, aTopic, aData) { + LOG("scheduleMidnightUpdate -- wakeObserver: " + aTopic); if (aTopic == "wake_notification") { - aRefreshCallback(); + // postpone refresh for another couple of seconds to get netwerk ready: + if (this.mTimer) { + this.mTimer.cancel(); + } else { + this.mTimer = Components.classes["@mozilla.org/timer;1"] + .createInstance(Components.interfaces.nsITimer); + } + this.mTimer.initWithCallback(udCallback, 10 * 1000, + Components.interfaces.nsITimer.TYPE_ONE_SHOT); } } }; @@ -402,12 +412,12 @@ function scheduleMidnightUpdate(aRefreshCallback) { function() { observerService.removeObserver(wakeObserver, "wake_notification"); }, false); - gMidnightTimer = Components.classes["@mozilla.org/timer;1"] .createInstance(Components.interfaces.nsITimer); } else { gMidnightTimer.cancel(); } + LOG("scheduleMidnightUpdate -- init timer."); gMidnightTimer.initWithCallback(udCallback, msUntilTomorrow, gMidnightTimer.TYPE_ONE_SHOT); } diff --git a/mozilla/calendar/lightning/content/messenger-overlay-sidebar.js b/mozilla/calendar/lightning/content/messenger-overlay-sidebar.js index 7dce748bd6c..cd9bef3488c 100644 --- a/mozilla/calendar/lightning/content/messenger-overlay-sidebar.js +++ b/mozilla/calendar/lightning/content/messenger-overlay-sidebar.js @@ -295,21 +295,25 @@ function onSelectionChanged(aEvent) { * this for normal refresh, since it also calls scheduleMidnightRefresh. */ function refreshUIBits() { - document.getElementById("ltnMinimonth").refreshDisplay(); + try { + getMinimonth().refreshDisplay(); - // refresh the current view, if it has ever been shown - var cView = currentView(); - if (cView.initialized) { - cView.goToDay(cView.selectedDay); + // refresh the current view, if it has ever been shown + var cView = currentView(); + if (cView.initialized) { + cView.goToDay(cView.selectedDay); + } + + if (!TodayPane.showsToday()) { + TodayPane.setDay(now()); + } + + // update the unifinder + refreshEventTree(); + } catch (exc) { + ASSERT(false, exc); } - if (TodayPane.showsYesterday()) { - TodayPane.setDay(now()); - } - - // update the unifinder - refreshEventTree(); - // schedule our next update... scheduleMidnightUpdate(refreshUIBits); } diff --git a/mozilla/calendar/resources/content/calendar.js b/mozilla/calendar/resources/content/calendar.js index f9c55ba1c3b..4e875018a4c 100644 --- a/mozilla/calendar/resources/content/calendar.js +++ b/mozilla/calendar/resources/content/calendar.js @@ -196,8 +196,12 @@ function handleCommandLine(aComLine) { /* Called at midnight to tell us to update the views and other ui bits */ function refreshUIBits() { - currentView().goToDay(now()); - refreshEventTree(); + try { + currentView().goToDay(now()); + refreshEventTree(); + } catch (exc) { + ASSERT(false, exc); + } // and schedule again... scheduleMidnightUpdate(refreshUIBits);