diff options
author | Ben Loftis <ben@harrisonconsoles.com> | 2018-11-15 09:33:44 -0600 |
---|---|---|
committer | Ben Loftis <ben@harrisonconsoles.com> | 2019-08-01 12:11:31 -0500 |
commit | e0bdcd7137c4b0f792c7824ad146ebdc5687a5cf (patch) | |
tree | adc0fe4bc904c24626376da3d620e54101f1ee8b /gtk2_ardour/editor_sources.cc | |
parent | edde5d64a2630c6d79239b92f2fe428022626dde (diff) |
(Source List) Clean up the natural_position implementation (gtk2 part).
Diffstat (limited to 'gtk2_ardour/editor_sources.cc')
-rw-r--r-- | gtk2_ardour/editor_sources.cc | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/gtk2_ardour/editor_sources.cc b/gtk2_ardour/editor_sources.cc index 2586151786..2a3e0edcc0 100644 --- a/gtk2_ardour/editor_sources.cc +++ b/gtk2_ardour/editor_sources.cc @@ -350,12 +350,13 @@ EditorSources::populate_row (TreeModel::Row row, boost::shared_ptr<ARDOUR::Sourc row[_columns.natural_s] = source->natural_position(); //Natural Position (text representation) - char buf[64]; - snprintf(buf, 16, "--" ); - if (source->natural_position() > 0) { + if (source->have_natural_position()) { + char buf[64]; format_position (source->natural_position(), buf, sizeof (buf)); + row[_columns.natural_pos] = buf; + } else { + row[_columns.natural_pos] = X_("--"); } - row[_columns.natural_pos] = buf; } void @@ -380,13 +381,20 @@ EditorSources::source_changed (boost::shared_ptr<ARDOUR::Source> source) { TreeModel::iterator i; TreeModel::Children rows = _model->children(); + bool found = false; + for (i = rows.begin(); i != rows.end(); ++i) { boost::shared_ptr<ARDOUR::Source> ss = (*i)[_columns.source]; if (source == ss) { populate_row(*i, source); + found = true; break; } } + + if (!found) { + add_source (source); + } } void |