make remove work for transport masters (bug fix, really)
authorPaul Davis <paul@linuxaudiosystems.com>
Fri, 5 Oct 2018 18:29:15 +0000 (14:29 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Fri, 5 Oct 2018 18:29:15 +0000 (14:29 -0400)
gtk2_ardour/transport_masters_dialog.cc
libs/ardour/transport_master_manager.cc

index ac2066cebac64eff8ac5524fda5aa6ec561097b5..027d98964c6dc0946d36c29e5f665cd0d9290f4b 100644 (file)
@@ -83,6 +83,8 @@ TransportMastersWidget::TransportMastersWidget ()
        table.set_spacings (6);
 
        TransportMasterManager::instance().CurrentChanged.connect (current_connection, invalidator (*this), boost::bind (&TransportMastersWidget::current_changed, this, _1, _2), gui_context());
+       TransportMasterManager::instance().Added.connect (current_connection, invalidator (*this), boost::bind (&TransportMastersWidget::rebuild, this), gui_context());
+       TransportMasterManager::instance().Removed.connect (current_connection, invalidator (*this), boost::bind (&TransportMastersWidget::rebuild, this), gui_context());
 
        rebuild ();
 }
@@ -114,9 +116,7 @@ TransportMastersWidget::current_changed (boost::shared_ptr<TransportMaster> old_
 void
 TransportMastersWidget::add_master ()
 {
-       if (!TransportMasterManager::instance().add (LTC, "new ltc")) {
-               rebuild ();
-       }
+       TransportMasterManager::instance().add (LTC, "new ltc");
 }
 
 void
@@ -247,6 +247,7 @@ TransportMastersWidget::Row::name_press (GdkEventButton* ev)
 void
 TransportMastersWidget::Row::remove_clicked ()
 {
+       TransportMasterManager::instance().remove (tm->name());
 }
 
 void
index 7912b82218ca085e486ae09954261369a8aa591c..0ac3bbfca259ab3eed19b047144a0be272a86431 100644 (file)
@@ -359,7 +359,7 @@ TransportMasterManager::remove (std::string const & name)
 
                for (TransportMasters::iterator t = _transport_masters.begin(); t != _transport_masters.end(); ++t) {
                        if ((*t)->name() == name) {
-                               if (!tm->removeable()) {
+                               if (!(*t)->removeable()) {
                                        return -1;
                                }
                                tm = *t;