summaryrefslogtreecommitdiff
path: root/shortcuts
diff options
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2013-01-19 00:51:17 +0100
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2013-01-19 00:51:17 +0100
commit166c2c2fd24c477e7e7bf6c5bf7a28ab9c90b0e9 (patch)
tree6a1db8d2a1919f735480b49375ed5b97fbb49fdd /shortcuts
parent93c1b774eb43f4520103ca2e6f550fc421dae680 (diff)
ShortcutModel: add categories_per_column property, use const getters
(bzr r2919.3.21)
Diffstat (limited to 'shortcuts')
-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();