Commit b37c7206 authored by Charlie Fenton's avatar Charlie Fenton Committed by Oliver Bock

Mgr: Display "Fetching notices..." instead of "There are no notices" while...

Mgr: Display "Fetching notices..." instead of "There are no notices" while getting notices.  Display "There are no notices" only if we have actually determined there are no notices
parent 67e25bac
......@@ -7805,7 +7805,15 @@ Charlie 20 Dec 2012
display or have determined that there are no notices.
- Mgr: Don't call get_notices RPC before previous one is processed to
prevent multiple display of notices.
- Mgr: Display "Fetching notices..." instead of "There are no notices"
while getting notices. Display "There are no notices" only if we
have actually determined there are no notices.
clientgui/
MainDocument.cpp,.h
BOINCInternetFSHandler.cpp
NoticeListCtrl.cpp,.h
ViewNotices.cpp,.h
lib/
gui_rpc_client.h
gui_rpc_client_ops.cpp
......@@ -1936,7 +1936,7 @@ int CMainDocument::GetNoticeCount() {
// only after a get_notices RPC completes so notices buffer is stable.
CachedStateUpdate();
if (!notices.notices.empty()) {
if (notices.received) {
iCount = (int)notices.notices.size();
}
......
......@@ -412,8 +412,9 @@ bool CNoticeListCtrl::Create( wxWindow* parent )
#endif
////@end CNoticeListCtrl creation
// Display the empty notice notification until we have some
// notices to display.
// Display the fetching notices message until we have notices
// to display or have determined that there are no notices.
m_bDisplayFetchingNotices = false;
m_bDisplayEmptyNotice = true;
m_bComputerChanged = false;
......@@ -558,7 +559,21 @@ bool CNoticeListCtrl::UpdateUI()
// Call Freeze() / Thaw() only when actually needed;
// otherwise it causes unnecessary redraws
int noticeCount = pDoc->GetNoticeCount();
if ((noticeCount <= 0) || (!pDoc->IsConnected()) || m_bComputerChanged) {
if ((noticeCount < 0) || (!pDoc->IsConnected()) || m_bComputerChanged) {
if (GetItemCount()) {
SetItemCount(0);
}
m_bDisplayFetchingNotices = true;
m_bDisplayEmptyNotice = false;
m_bComputerChanged = false;
return true;
}
if (noticeCount == 0) {
if (GetItemCount()) {
SetItemCount(0);
}
m_bDisplayFetchingNotices = false;
m_bDisplayEmptyNotice = true;
m_bComputerChanged = false;
return true;
......@@ -572,12 +587,12 @@ bool CNoticeListCtrl::UpdateUI()
if (
pDoc->IsConnected() &&
(pDoc->notices.complete ||
((int)GetItemCount() != noticeCount) ||
((pDoc->GetNoticeCount() > 0) && (m_bDisplayEmptyNotice == true)))
((int)GetItemCount() != noticeCount))
) {
pDoc->notices.complete = false;
Freeze();
SetItemCount(noticeCount);
m_bDisplayFetchingNotices = false;
m_bDisplayEmptyNotice = false;
Thaw();
}
......
......@@ -116,6 +116,7 @@ public:
int GetItemHeight(size_t i) { return (int)OnGetItemHeight(i); }
bool m_bDisplayFetchingNotices;
bool m_bDisplayEmptyNotice;
private:
bool m_bComputerChanged;
......
......@@ -64,11 +64,18 @@ CViewNotices::CViewNotices(wxNotebook* pNotebook) :
SetSizer(itemFlexGridSizer);
m_StatusText = new wxStaticText(
m_FetchingNoticesText = new wxStaticText(
this, wxID_ANY,
_("Fetching notices; please wait..."),
wxPoint(20, 20), wxDefaultSize, 0
);
m_NoNoticesText = new wxStaticText(
this, wxID_ANY,
_("There are no notices at this time."),
wxPoint(20, 20), wxDefaultSize, 0
);
m_NoNoticesText->Hide();
}
......@@ -137,7 +144,8 @@ void CViewNotices::OnListRender(wxTimerEvent& WXUNUSED(event)) {
// Don't call Freeze() / Thaw() here because it causes an unnecessary redraw
m_pHtmlListPane->UpdateUI();
m_StatusText->Show(m_pHtmlListPane->m_bDisplayEmptyNotice);
m_FetchingNoticesText->Show(m_pHtmlListPane->m_bDisplayFetchingNotices);
m_NoNoticesText->Show(m_pHtmlListPane->m_bDisplayEmptyNotice);
pDoc->UpdateUnreadNoticeState();
s_bInProgress = false;
......
......@@ -47,7 +47,8 @@ public:
protected:
CNoticeListCtrl* m_pHtmlListPane;
wxStaticText* m_StatusText;
wxStaticText* m_FetchingNoticesText;
wxStaticText* m_NoNoticesText;
virtual bool OnSaveState( wxConfigBase* pConfig );
virtual bool OnRestoreState( wxConfigBase* pConfig );
......
......@@ -463,6 +463,7 @@ struct MESSAGES {
struct NOTICES {
bool complete;
bool received;
// whether vector contains all notices, or just new ones
std::vector<NOTICE*> notices;
......
......@@ -1170,6 +1170,7 @@ NOTICES::~NOTICES() {
void NOTICES::clear() {
complete = false;
received = false;
unsigned int i;
for (i=0; i<notices.size(); i++) {
delete notices[i];
......@@ -2532,6 +2533,7 @@ int RPC_CLIENT::get_notices(int seqno, NOTICES& notices) {
);
retval = rpc.do_rpc(buf);
if (retval) return retval;
notices.received = true;
return parse_notices(rpc.xp, notices);
}
......@@ -2549,6 +2551,7 @@ int RPC_CLIENT::get_notices_public(int seqno, NOTICES& notices) {
);
retval = rpc.do_rpc(buf);
if (retval) return retval;
notices.received = true;
return parse_notices(rpc.xp, notices);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment