diff --git a/checkin_notes b/checkin_notes index 522976ce21..f2474a7ff8 100755 --- a/checkin_notes +++ b/checkin_notes @@ -1897,3 +1897,14 @@ David 15 Feb 2006 clientgui/ MainFrame.cpp + +Rom 15 Feb 2006 + - Bug Fix: Force a project state update even when we are looking at + the tasks tab. Copy the updated project state to the existing global + state structure. + + clientgui/ + MainDocument.cpp, .h + lib/ + gui_rpc_client.h + gui_rpc_client_ops.C diff --git a/clientgui/MainDocument.cpp b/clientgui/MainDocument.cpp index 5117b0e59f..6f13fddeab 100644 --- a/clientgui/MainDocument.cpp +++ b/clientgui/MainDocument.cpp @@ -386,7 +386,6 @@ int CMainDocument::ResetState() { rpc.close(); state.clear(); host.clear_host_info(); - project_status.clear(); results.clear(); messages.clear(); ft.clear(); @@ -584,15 +583,15 @@ int CMainDocument::CachedProjectStatusUpdate() { int i = 0; if (IsConnected()) { - iRetVal = rpc.get_project_status(project_status); + iRetVal = rpc.get_project_status(state); if (iRetVal) { wxLogTrace(wxT("Function Status"), "CMainDocument::CachedProjectStatusUpdate - Get Project Status Failed '%d'", iRetVal); - m_pNetworkConnection->SetStateDisconnected(); + ForceCacheUpdate(); } m_fProjectTotalResourceShare = 0.0; - for (i=0; i < (long)project_status.projects.size(); i++) { - m_fProjectTotalResourceShare += project_status.projects.at(i)->resource_share; + for (i=0; i < (long)state.projects.size(); i++) { + m_fProjectTotalResourceShare += state.projects.at(i)->resource_share; } } @@ -610,8 +609,8 @@ PROJECT* CMainDocument::project(unsigned int i) { // which will cause an exception which can be trapped and return a NULL // pointer when the exception is thrown. try { - if (!project_status.projects.empty()) - pProject = project_status.projects.at(i); + if (!state.projects.empty()) + pProject = state.projects.at(i); } catch (std::out_of_range e) { pProject = NULL; @@ -624,11 +623,11 @@ PROJECT* CMainDocument::project(unsigned int i) { int CMainDocument::GetProjectCount() { int iCount = -1; - CachedStateUpdate(); CachedProjectStatusUpdate(); + CachedStateUpdate(); - if (!project_status.projects.empty()) - iCount = project_status.projects.size(); + if (!state.projects.empty()) + iCount = state.projects.size(); return iCount; } @@ -735,7 +734,7 @@ int CMainDocument::CachedResultsStatusUpdate() { iRetVal = rpc.get_results(results); if (iRetVal) { wxLogTrace(wxT("Function Status"), "CMainDocument::CachedResultsStatusUpdate - Get Result Status Failed '%d'", iRetVal); - m_pNetworkConnection->SetStateDisconnected(); + ForceCacheUpdate(); } } @@ -767,8 +766,9 @@ RESULT* CMainDocument::result(unsigned int i) { int CMainDocument::GetWorkCount() { int iCount = -1; - CachedStateUpdate(); + CachedProjectStatusUpdate(); CachedResultsStatusUpdate(); + CachedStateUpdate(); if (!results.results.empty()) iCount = results.results.size(); @@ -932,7 +932,7 @@ int CMainDocument::CachedFileTransfersUpdate() { iRetVal = rpc.get_file_transfers(ft); if (iRetVal) { wxLogTrace(wxT("Function Status"), "CMainDocument::CachedFileTransfersUpdate - Get File Transfers Failed '%d'", iRetVal); - m_pNetworkConnection->SetStateDisconnected(); + ForceCacheUpdate(); } } @@ -1007,7 +1007,7 @@ int CMainDocument::CachedResourceStatusUpdate() { iRetVal = rpc.get_disk_usage(resource_status); if (iRetVal) { wxLogTrace(wxT("Function Status"), "CMainDocument::CachedResourceStatusUpdate - Get Disk Usage Failed '%d'", iRetVal); - m_pNetworkConnection->SetStateDisconnected(); + ForceCacheUpdate(); } } @@ -1058,7 +1058,7 @@ int CMainDocument::CachedStatisticsStatusUpdate() { iRetVal = rpc.get_statistics(statistics_status); if (iRetVal) { wxLogTrace(wxT("Function Status"), "CMainDocument::CachedStatisticsStatusUpdate - Get Statistics Failed '%d'", iRetVal); - m_pNetworkConnection->SetStateDisconnected(); + ForceCacheUpdate(); } } diff --git a/clientgui/MainDocument.h b/clientgui/MainDocument.h index 0144d20082..bb2b23a038 100644 --- a/clientgui/MainDocument.h +++ b/clientgui/MainDocument.h @@ -145,7 +145,6 @@ private: int CachedProjectStatusUpdate(); public: - PROJECTS project_status; PROJECT* project(unsigned int); float m_fProjectTotalResourceShare; diff --git a/lib/gui_rpc_client.h b/lib/gui_rpc_client.h index e908bfcd1b..59e4eef0af 100644 --- a/lib/gui_rpc_client.h +++ b/lib/gui_rpc_client.h @@ -531,6 +531,7 @@ public: int get_state(CC_STATE&); int get_results(RESULTS&); int get_file_transfers(FILE_TRANSFERS&); + int get_project_status(CC_STATE&); int get_project_status(PROJECTS&); int get_disk_usage(PROJECTS&); int show_graphics( diff --git a/lib/gui_rpc_client_ops.C b/lib/gui_rpc_client_ops.C index facec30177..228a3d7cfa 100644 --- a/lib/gui_rpc_client_ops.C +++ b/lib/gui_rpc_client_ops.C @@ -1047,6 +1047,32 @@ int RPC_CLIENT::get_project_status(PROJECTS& p) { return 0; } +int RPC_CLIENT::get_project_status(CC_STATE& state) { + char buf[256]; + RPC rpc(this); + int retval; + + retval = rpc.do_rpc("\n"); + if (retval) return retval; + + while (rpc.fin.fgets(buf, 256)) { + if (match_tag(buf, "")) break; + else if (match_tag(buf, "")) { + PROJECT* project = new PROJECT(); + PROJECT* state_project; + project->parse(rpc.fin); + state_project = state.lookup_project(project->master_url); + if (state_project && (project->master_url == state_project->master_url)) { + state_project->copy(*project); + } else { + return ERR_NOT_FOUND; + } + continue; + } + } + return 0; +} + int RPC_CLIENT::get_disk_usage(PROJECTS& p) { char buf[256]; RPC rpc(this);