diff options
author | Johannes Mueller <github@johannes-mueller.org> | 2019-04-20 22:36:51 +0200 |
---|---|---|
committer | Johannes Mueller <github@johannes-mueller.org> | 2019-04-20 22:36:51 +0200 |
commit | ce47ec411a0894b0bda012d57c5a7472fe7760aa (patch) | |
tree | 3d77c15905347f7b6560a21d86eb6b805152a463 /libs/surfaces/faderport | |
parent | 822f55f4afe5d28bb32fba2e35c4518575c29ae3 (diff) |
Make use of ActionModel::build_custom_action_combo()
Diffstat (limited to 'libs/surfaces/faderport')
-rw-r--r-- | libs/surfaces/faderport/gui.cc | 36 |
1 files changed, 2 insertions, 34 deletions
diff --git a/libs/surfaces/faderport/gui.cc b/libs/surfaces/faderport/gui.cc index 28b5976d06..81c31f7db1 100644 --- a/libs/surfaces/faderport/gui.cc +++ b/libs/surfaces/faderport/gui.cc @@ -358,40 +358,8 @@ FPGUI::action_changed (Gtk::ComboBox* cb, FaderPort::ButtonID id, FaderPort::But void FPGUI::build_action_combo (Gtk::ComboBox& cb, vector<pair<string,string> > const & actions, FaderPort::ButtonID id, FaderPort::ButtonState bs) { - Glib::RefPtr<Gtk::ListStore> model (Gtk::ListStore::create (action_model.columns())); - TreeIter rowp; - TreeModel::Row row; - string current_action = fp.get_action (id, false, bs); /* lookup release action */ - int active_row = -1; - int n; - vector<pair<string,string> >::const_iterator i; - - rowp = model->append(); - row = *(rowp); - row[action_model.name()] = _("Disabled"); - row[action_model.path()] = string(); - - if (current_action.empty()) { - active_row = 0; - } - - for (i = actions.begin(), n = 0; i != actions.end(); ++i, ++n) { - rowp = model->append(); - row = *(rowp); - row[action_model.name()] = i->first; - row[action_model.path()] = i->second; - if (current_action == i->second) { - active_row = n+1; - } - } - - cb.set_model (model); - cb.pack_start (action_model.name()); - - if (active_row >= 0) { - cb.set_active (active_row); - } - + const string current_action = fp.get_action (id, false, bs); /* lookup release action */ + action_model.build_custom_action_combo (cb, actions, current_action); cb.signal_changed().connect (sigc::bind (sigc::mem_fun (*this, &FPGUI::action_changed), &cb, id, bs)); } |