From ce47ec411a0894b0bda012d57c5a7472fe7760aa Mon Sep 17 00:00:00 2001 From: Johannes Mueller Date: Sat, 20 Apr 2019 22:36:51 +0200 Subject: Make use of ActionModel::build_custom_action_combo() --- libs/surfaces/faderport/gui.cc | 36 ++---------------------------------- 1 file changed, 2 insertions(+), 34 deletions(-) (limited to 'libs/surfaces/faderport') 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 > const & actions, FaderPort::ButtonID id, FaderPort::ButtonState bs) { - Glib::RefPtr 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 >::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)); } -- cgit v1.2.3