summaryrefslogtreecommitdiff
diff options
-rw-r--r--shortcuts/ShortcutModel.cpp9
-rw-r--r--shortcuts/ShortcutModel.h5
2 files changed, 12 insertions, 2 deletions
diff --git a/shortcuts/ShortcutModel.cpp b/shortcuts/ShortcutModel.cpp
index 2337d6479..c2fc48a6a 100644
--- a/shortcuts/ShortcutModel.cpp
+++ b/shortcuts/ShortcutModel.cpp
@@ -25,6 +25,15 @@ namespace shortcut
{
Model::Model(std::list<AbstractHint::Ptr> const& hints)
+ : categories_per_column(3, [] (unsigned& target, unsigned const& new_value) {
+ unsigned cat_per_col = std::max<unsigned>(1, new_value);
+ if (cat_per_col != target)
+ {
+ target = cat_per_col;
+ return true;
+ }
+ return false;
+ })
{
for (auto hint : hints)
AddHint(hint);
diff --git a/shortcuts/ShortcutModel.h b/shortcuts/ShortcutModel.h
index 5543537a1..13d19c02d 100644
--- a/shortcuts/ShortcutModel.h
+++ b/shortcuts/ShortcutModel.h
@@ -41,8 +41,9 @@ public:
Model(std::list<AbstractHint::Ptr> const& hints);
- std::vector<std::string>& categories() { return categories_; }
- std::map<std::string, std::list<AbstractHint::Ptr>>& hints() { return hints_; }
+ nux::Property<unsigned> categories_per_column;
+ std::vector<std::string> const& categories() const { return categories_; }
+ std::map<std::string, std::list<AbstractHint::Ptr>> const& hints() const { return hints_; }
void Fill();