From e05d9ff77c79cf7ae762172b809709f5e1ffb904 Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Wed, 2 Mar 2011 18:47:24 +0000 Subject: [PATCH] - MGR: Properly handle the case where the only notice in the manager is the 'no notice' notice and then we transition to a single notice from another source. clientgui/ NoticeListCtrl.cpp, .h svn path=/trunk/boinc/; revision=23132 --- checkin_notes | 8 ++++++++ clientgui/NoticeListCtrl.cpp | 16 +++++++++++----- clientgui/NoticeListCtrl.h | 1 + 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/checkin_notes b/checkin_notes index ae63405422..e81b4da623 100644 --- a/checkin_notes +++ b/checkin_notes @@ -1233,3 +1233,11 @@ David 2 Mar 2011 html/user/ friend.php + +Rom 2 Mar 2011 + - MGR: Properly handle the case where the only notice in the manager + is the 'no notice' notice and then we transition to a single notice + from another source. + + clientgui/ + NoticeListCtrl.cpp, .h diff --git a/clientgui/NoticeListCtrl.cpp b/clientgui/NoticeListCtrl.cpp index 8beabbc2fe..e38b7fd28d 100644 --- a/clientgui/NoticeListCtrl.cpp +++ b/clientgui/NoticeListCtrl.cpp @@ -412,6 +412,10 @@ bool CNoticeListCtrl::Create( wxWindow* parent ) #endif ////@end CNoticeListCtrl creation + // Display the empty notice notification until we have some + // notices to display. + m_bDisplayEmptyNotice = true; + return TRUE; } @@ -472,7 +476,7 @@ wxString CNoticeListCtrl::OnGetItem(size_t i) const { wxASSERT(wxDynamicCast(pDoc, CMainDocument)); - if (pDoc->GetNoticeCount() <= 0) { + if (m_bDisplayEmptyNotice) { strBuffer = wxT("
"); strBuffer += _("There are no notices at this time."); strBuffer += wxT("

"); @@ -533,8 +537,6 @@ wxString CNoticeListCtrl::OnGetItem(size_t i) const { strBuffer += wxT("
"); } - - return strBuffer; } @@ -553,6 +555,7 @@ bool CNoticeListCtrl::UpdateUI() // Call Freeze() / Thaw() only when actually needed; // otherwise it causes unnecessary redraws if (pDoc->GetNoticeCount() <= 0) { + m_bDisplayEmptyNotice = true; Freeze(); SetItemCount(1); Thaw(); @@ -560,14 +563,17 @@ bool CNoticeListCtrl::UpdateUI() } if ( + pDoc->notices.complete || ((int)GetItemCount() != pDoc->GetNoticeCount()) || - pDoc->notices.complete + ((pDoc->GetNoticeCount() > 0) && (m_bDisplayEmptyNotice == true)) ) { + pDoc->notices.complete = false; + m_bDisplayEmptyNotice = false; Freeze(); SetItemCount(pDoc->GetNoticeCount()); - pDoc->notices.complete = false; Thaw(); } + #ifdef __WXMAC__ // Enable accessibility only after drawing the page // to avoid a mysterious crash bug diff --git a/clientgui/NoticeListCtrl.h b/clientgui/NoticeListCtrl.h index b56cbff584..b119dce0ff 100644 --- a/clientgui/NoticeListCtrl.h +++ b/clientgui/NoticeListCtrl.h @@ -116,6 +116,7 @@ public: int GetItemHeight(size_t i) { return (int)OnGetItemHeight(i); } private: + bool m_bDisplayEmptyNotice; #ifdef __WXMAC__ CNoticeListCtrlAccessible* m_accessible; #endif