Bug 401693 â Today pane not updated on Mac OS X after hibernation; r=berend
git-svn-id: svn://10.0.0.236/trunk@251250 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user