commit 71720ba6dd812abc162006a390338f924d39b5b2
parent 6b06f479d4bd9d571317c6107e5bb36cc916cf59
Author: cfillion <cfillion@users.noreply.github.com>
Date: Sat, 20 Aug 2016 19:18:24 -0700
about: fix the first loading of the list on windows
Diffstat:
2 files changed, 14 insertions(+), 21 deletions(-)
diff --git a/src/about.cpp b/src/about.cpp
@@ -78,23 +78,7 @@ void About::onCommand(const int id, int)
}
}
-void About::setDelegate(const DelegatePtr &model)
-{
- clear();
-
- m_delegate = model;
- m_delegate->init(this);
- m_menu->sort();
-
- updateList();
-
-#ifdef LVSCW_AUTOSIZE_USEHEADER
- m_menu->resizeColumn(m_menu->columnCount() - 1, LVSCW_AUTOSIZE_USEHEADER);
- m_list->resizeColumn(m_list->columnCount() - 1, LVSCW_AUTOSIZE_USEHEADER);
-#endif
-}
-
-void About::clear()
+void About::setDelegate(const DelegatePtr &delegate)
{
m_tabs->clear();
m_menu->reset();
@@ -105,8 +89,6 @@ void About::clear()
m_delegate = nullptr;
m_links.clear();
- m_currentIndex = -255;
-
const int controls[] = {
IDC_ABOUT,
IDC_MENU,
@@ -120,6 +102,18 @@ void About::clear()
for(const int control : controls)
hide(getControl(control));
+
+ m_delegate = delegate;
+ m_delegate->init(this);
+ m_menu->sort();
+
+ m_currentIndex = -255;
+ updateList();
+
+#ifdef LVSCW_AUTOSIZE_USEHEADER
+ m_menu->resizeColumn(m_menu->columnCount() - 1, LVSCW_AUTOSIZE_USEHEADER);
+ m_list->resizeColumn(m_list->columnCount() - 1, LVSCW_AUTOSIZE_USEHEADER);
+#endif
}
void About::setTitle(const string &what)
@@ -215,7 +209,7 @@ void About::updateList()
const int index = m_menu->currentIndex();
// do nothing when the selection is cleared, except for the initial execution
- if((index < 0 && m_currentIndex >= -1) || index == m_currentIndex)
+ if((index < 0 && m_currentIndex != -255) || index == m_currentIndex)
return;
InhibitControl lock(m_list);
diff --git a/src/about.hpp b/src/about.hpp
@@ -59,7 +59,6 @@ protected:
void onCommand(int, int) override;
private:
- void clear();
void selectLink(int control);
void openLink(const Link *);
void updateList();