| 277 | } |
| 278 | |
| 279 | void AddressBar::UpdateTextAndIcon(const Tab &tab) |
| 280 | { |
| 281 | // At this point, the text and icon in the address bar are being updated |
| 282 | // because the current folder has changed (e.g. because another tab has been |
| 283 | // selected). Therefore, any icon updates for the last history entry can be |
| 284 | // ignored. If that history entry becomes the current one again (e.g. |
| 285 | // because the original tab is re-selected), the listener can be set back up |
| 286 | // (if necessary). |
| 287 | m_historyEntryUpdatedConnection.disconnect(); |
| 288 | |
| 289 | auto entry = tab.GetShellBrowser()->GetNavigationController()->GetCurrentEntry(); |
| 290 | |
| 291 | auto cachedFullPath = entry->GetFullPathForDisplay(); |
| 292 | std::optional<std::wstring> text; |
| 293 | |
| 294 | if (cachedFullPath) |
| 295 | { |
| 296 | text = cachedFullPath; |
| 297 | } |
| 298 | else |
| 299 | { |
| 300 | text = GetFolderPathForDisplay(entry->GetPidl().get()); |
| 301 | |
| 302 | if (text) |
| 303 | { |
| 304 | entry->SetFullPathForDisplay(*text); |
| 305 | } |
| 306 | } |
| 307 | |
| 308 | if (!text) |
| 309 | { |
| 310 | return; |
| 311 | } |
| 312 | |
| 313 | auto cachedIconIndex = entry->GetSystemIconIndex(); |
| 314 | int iconIndex; |
| 315 | |
| 316 | if (cachedIconIndex) |
| 317 | { |
| 318 | iconIndex = *cachedIconIndex; |
| 319 | } |
| 320 | else |
| 321 | { |
| 322 | iconIndex = m_defaultFolderIconIndex; |
| 323 | |
| 324 | m_historyEntryUpdatedConnection = entry->historyEntryUpdatedSignal.AddObserver( |
| 325 | boost::bind(&AddressBar::OnHistoryEntryUpdated, this, _1, _2)); |
| 326 | } |
| 327 | |
| 328 | SendMessage(m_hwnd, CB_RESETCONTENT, 0, 0); |
| 329 | |
| 330 | UpdateTextAndIconInUI(&*text, iconIndex); |
| 331 | } |
| 332 | |
| 333 | void AddressBar::UpdateTextAndIconInUI(std::wstring *text, int iconIndex) |
| 334 | { |
nothing calls this directly
no test coverage detected