From 7f5e7f27cebd03e04a8200e5d1c20b3412e1dcf1 Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Mon, 4 Mar 2013 04:31:30 +0100 Subject: [PATCH] GitProgressDlg: Correctly set title Regression introduced in revision 05026a570063d272a18542298e8164f59e0aca87. Signed-off-by: Sven Strickroth --- src/TortoiseProc/GitProgressDlg.cpp | 1 + src/TortoiseProc/GitProgressList.cpp | 33 +++++++++++++++++++-------------- src/TortoiseProc/GitProgressList.h | 4 +++- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/src/TortoiseProc/GitProgressDlg.cpp b/src/TortoiseProc/GitProgressDlg.cpp index 0f92e8643..5e30c89e7 100644 --- a/src/TortoiseProc/GitProgressDlg.cpp +++ b/src/TortoiseProc/GitProgressDlg.cpp @@ -123,6 +123,7 @@ BOOL CGitProgressDlg::OnInitDialog() m_ProgList.m_pProgressLabelCtrl = &m_ProgLableCtrl; m_ProgList.m_pInfoCtrl = &m_InfoCtrl; m_ProgList.m_pPostWnd = this; + m_ProgList.m_bSetTitle = true; if (hWndExplorer) CenterWindow(CWnd::FromHandle(hWndExplorer)); diff --git a/src/TortoiseProc/GitProgressList.cpp b/src/TortoiseProc/GitProgressList.cpp index 23d4e61d5..6d4c6778d 100644 --- a/src/TortoiseProc/GitProgressList.cpp +++ b/src/TortoiseProc/GitProgressList.cpp @@ -81,6 +81,7 @@ CGitProgressList::CGitProgressList():CListCtrl() , m_bNoCheckout(false) , m_AutoTag(GIT_REMOTE_DOWNLOAD_TAGS_AUTO) , m_options(ProgOptNone) + , m_bSetTitle(false) { m_pInfoCtrl = nullptr; m_pAnimate = nullptr; @@ -884,7 +885,8 @@ UINT CGitProgressList::ProgressThread() else temp.LoadString(IDS_PROGRS_TITLEFIN); sWindowTitle = sWindowTitle + _T(" ") + temp; - SetWindowText(sWindowTitle); + if (m_bSetTitle && m_pPostWnd) + ::SetWindowText(m_pPostWnd->GetSafeHwnd(), sWindowTitle); KillTimer(TRANSFERTIMER); KillTimer(VISIBLETIMER); @@ -1726,8 +1728,7 @@ void CGitProgressList::OnSize(UINT nType, int cx, int cy) bool CGitProgressList::CmdAdd(CString& sWindowTitle, bool& localoperation) { localoperation = true; - sWindowTitle.LoadString(IDS_PROGRS_TITLE_ADD); - CAppUtils::SetWindowTitle(m_hWnd, m_targetPathList.GetCommonRoot().GetUIPathString(), sWindowTitle); + SetWindowTitle(IDS_PROGRS_TITLE_ADD, m_targetPathList.GetCommonRoot().GetUIPathString(), sWindowTitle); SetBackgroundImage(IDI_ADD_BKG); ReportCmd(CString(MAKEINTRESOURCE(IDS_PROGRS_CMD_ADD))); @@ -1948,8 +1949,7 @@ bool CGitProgressList::CmdResolve(CString& sWindowTitle, bool& localoperation) localoperation = true; ASSERT(m_targetPathList.GetCount() == 1); - sWindowTitle.LoadString(IDS_PROGRS_TITLE_RESOLVE); - CAppUtils::SetWindowTitle(m_hWnd, m_targetPathList.GetCommonRoot().GetUIPathString(), sWindowTitle); + SetWindowTitle(IDS_PROGRS_TITLE_RESOLVE, m_targetPathList.GetCommonRoot().GetUIPathString(), sWindowTitle); SetBackgroundImage(IDI_RESOLVE_BKG); // check if the file may still have conflict markers in it. //BOOL bMarkers = FALSE; @@ -2027,8 +2027,7 @@ bool CGitProgressList::CmdRevert(CString& sWindowTitle, bool& localoperation) { localoperation = true; - sWindowTitle.LoadString(IDS_PROGRS_TITLE_REVERT); - CAppUtils::SetWindowTitle(m_hWnd, m_targetPathList.GetCommonRoot().GetUIPathString(), sWindowTitle); + SetWindowTitle(IDS_PROGRS_TITLE_REVERT, m_targetPathList.GetCommonRoot().GetUIPathString(), sWindowTitle); SetBackgroundImage(IDI_REVERT_BKG); CTGitPathList delList; @@ -2113,8 +2112,7 @@ bool CGitProgressList::CmdClone(CString& sWindowTitle, bool& /*localoperation*/) } this->m_TotalBytesTransferred = 0; - sWindowTitle.LoadString(IDS_PROGRS_TITLE_CLONE); - CAppUtils::SetWindowTitle(m_hWnd, m_url.GetGitPathString(), sWindowTitle); + SetWindowTitle(IDS_PROGRS_TITLE_CLONE, m_url.GetGitPathString(), sWindowTitle); SetBackgroundImage(IDI_SWITCH_BKG); ReportCmd(CString(MAKEINTRESOURCE(IDS_PROG_CLONE))); @@ -2182,8 +2180,7 @@ bool CGitProgressList::CmdClone(CString& sWindowTitle, bool& /*localoperation*/) } bool CGitProgressList::CmdSendMail(CString& sWindowTitle, bool& /*localoperation*/) { - sWindowTitle.LoadString(IDS_PROGRS_TITLE_SENDMAIL); - CAppUtils::SetWindowTitle(m_hWnd, m_targetPathList.GetCommonRoot().GetUIPathString(), sWindowTitle); + SetWindowTitle(IDS_PROGRS_TITLE_SENDMAIL, m_targetPathList.GetCommonRoot().GetUIPathString(), sWindowTitle); //SetBackgroundImage(IDI_ADD_BKG); ReportCmd(CString(MAKEINTRESOURCE(IDS_PROGRS_CMD_SENDMAIL))); bool ret=true; @@ -2279,8 +2276,7 @@ bool CGitProgressList::CmdFetch(CString& sWindowTitle, bool& /*localoperation*/) } this->m_TotalBytesTransferred = 0; - sWindowTitle.LoadString(IDS_PROGRS_TITLE_FETCH); - CAppUtils::SetWindowTitle(m_hWnd, g_Git.m_CurrentDir, sWindowTitle); + SetWindowTitle(IDS_PROGRS_TITLE_FETCH, g_Git.m_CurrentDir, sWindowTitle); SetBackgroundImage(IDI_UPDATE_BKG); ReportCmd(CString(MAKEINTRESOURCE(IDS_PROGRS_TITLE_FETCH)) + _T(" ") + m_url.GetGitPathString() + _T(" ") + m_RefSpec); @@ -2511,4 +2507,13 @@ CString CGitProgressList::GetPathFromColumnText(const CString& sColumnText) sPath = g_Git.m_CurrentDir + _T("\\") + sColumnText; } return sPath; -} \ No newline at end of file +} + +void CGitProgressList::SetWindowTitle(UINT id, const CString& urlorpath, CString& dialogname) +{ + if (!m_bSetTitle || !m_pPostWnd) + return; + + dialogname.LoadString(id); + CAppUtils::SetWindowTitle(m_pPostWnd->GetSafeHwnd(), urlorpath, dialogname); +} diff --git a/src/TortoiseProc/GitProgressList.h b/src/TortoiseProc/GitProgressList.h index 4eb558c5f..0f7989835 100644 --- a/src/TortoiseProc/GitProgressList.h +++ b/src/TortoiseProc/GitProgressList.h @@ -156,6 +156,7 @@ public: CWinThread* m_pThread; bool m_AlwaysConflicted; CWnd *m_pPostWnd; + bool m_bSetTitle; private: class NotificationData { @@ -204,7 +205,6 @@ private: CString sPathColumnText; CGitHash m_OldHash; CGitHash m_NewHash; - }; protected: DECLARE_MESSAGE_MAP() @@ -226,6 +226,8 @@ protected: virtual BOOL Notify(const git_wc_notify_action_t action, const git_transfer_progress *stat); virtual BOOL Notify(const git_wc_notify_action_t action, CString str, const git_oid *a, const git_oid *b); + void SetWindowTitle(UINT id, const CString& urlorpath, CString& dialogname); + // virtual git_wc_conflict_choice_t ConflictResolveCallback(const git_wc_conflict_description_t *description, CString& mergedfile); static int FetchCallback(const git_transfer_progress *stats, void *payload) -- 2.11.4.GIT