commit 78956b0acd8b0ae48f47bad73ca1fac7ff960a65
parent cc2b610bd603d92bc8664a3354f847574964d2b9
Author: cfillion <cfillion@users.noreply.github.com>
Date: Thu, 21 Apr 2016 04:23:39 -0400
browser: update the display button label when clearing actions in the queued tab
Diffstat:
2 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/src/browser.cpp b/src/browser.cpp
@@ -285,6 +285,19 @@ void Browser::onContextMenu(HWND target, const int x, const int y)
menu.show(x, y, handle());
}
+void Browser::updateDisplayLabel()
+{
+ basic_ostringstream<auto_char> btnLabel;
+ btnLabel.imbue(locale("")); // enable number formatting
+ btnLabel << m_list->rowCount() << AUTO_STR('/') << m_entries.size()
+ << AUTO_STR(" package");
+
+ if(m_entries.size() != 1)
+ btnLabel << AUTO_STR('s');
+
+ SetWindowText(m_display, btnLabel.str().c_str());
+}
+
void Browser::displayButton()
{
RECT rect;
@@ -521,15 +534,7 @@ void Browser::fillList()
m_list->sort();
- basic_ostringstream<auto_char> btnLabel;
- btnLabel.imbue(locale("")); // enable number formatting
- btnLabel << m_list->rowCount() << AUTO_STR('/') << m_entries.size()
- << AUTO_STR(" package");
-
- if(m_entries.size() != 1)
- btnLabel << AUTO_STR('s');
-
- SetWindowText(m_display, btnLabel.str().c_str());
+ updateDisplayLabel();
}
ListView::Row Browser::makeRow(const Entry &entry) const
@@ -723,6 +728,7 @@ void Browser::resetAction(const int index)
if(currentTab() == Queued) {
m_list->removeRow(index);
m_visibleEntries.erase(m_visibleEntries.begin() + index);
+ updateDisplayLabel();
}
else
m_list->replaceRow(index, makeRow(*entry));
diff --git a/src/browser.hpp b/src/browser.hpp
@@ -99,6 +99,7 @@ private:
std::string getValue(Column, const Entry &entry) const;
ListView::Row makeRow(const Entry &) const;
const Entry *getEntry(int) const;
+ void updateDisplayLabel();
void displayButton();
bool isFiltered(Package::Type) const;
void toggleFiltered(Package::Type);