X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Froute_group_menu.cc;h=5ccafaec398c70467c9313d65c8943ccd4449126;hb=e653da32c06c00e2ff481f2fc9d2d2de34b5aba0;hp=9c1f6f9e38e9d25f92b557bae5f6ed22afa38a0b;hpb=965a9740835a77cc2bf9e6cea237e56ae41150d8;p=ardour.git diff --git a/gtk2_ardour/route_group_menu.cc b/gtk2_ardour/route_group_menu.cc index 9c1f6f9e38..5ccafaec39 100644 --- a/gtk2_ardour/route_group_menu.cc +++ b/gtk2_ardour/route_group_menu.cc @@ -19,13 +19,17 @@ #include #include + #include "gtkmm2ext/utils.h" +#include "gtkmm2ext/doi.h" + #include "ardour/session.h" #include "ardour/route_group.h" #include "ardour/route.h" #include "route_group_menu.h" #include "route_group_dialog.h" -#include "i18n.h" + +#include "pbd/i18n.h" using namespace Gtk; using namespace ARDOUR; @@ -51,7 +55,7 @@ void RouteGroupMenu::build (WeakRouteList const & s) { assert (!s.empty ()); - + using namespace Menu_Helpers; _subject = s; @@ -68,7 +72,7 @@ RouteGroupMenu::build (WeakRouteList const & s) _inhibit_group_selected = true; delete _menu; - + /* Note: don't use manage() here, otherwise if our _menu object is attached as a submenu and its parent is then destroyed, our _menu object will be deleted and we'll have no way of knowing about it. Without manage(), when the above happens our _menu's gobject @@ -77,12 +81,12 @@ RouteGroupMenu::build (WeakRouteList const & s) _menu = new Menu; MenuList& items = _menu->items (); - - items.push_back (MenuElem (_("New group..."), sigc::mem_fun (*this, &RouteGroupMenu::new_group))); + + items.push_back (MenuElem (_("New Group..."), sigc::mem_fun (*this, &RouteGroupMenu::new_group))); items.push_back (SeparatorElem ()); RadioMenuItem::Group group; - items.push_back (RadioMenuElem (group, _("No group"))); + items.push_back (RadioMenuElem (group, _("No Group"))); RadioMenuItem* i = static_cast (&items.back ()); i->signal_activate().connect (sigc::bind (sigc::mem_fun (*this, &RouteGroupMenu::set_group), (RouteGroup *) 0)); @@ -158,16 +162,23 @@ RouteGroupMenu::new_group () } RouteGroup* g = new RouteGroup (*_session, ""); - g->apply_changes (*_default_properties); + RouteGroupDialog* d = new RouteGroupDialog (g, true); - RouteGroupDialog d (g, true); + d->signal_response().connect (sigc::bind (sigc::mem_fun (*this, &RouteGroupMenu::new_group_dialog_finished), d)); + d->present (); +} - if (d.do_run ()) { - delete g; +void +RouteGroupMenu::new_group_dialog_finished (int r, RouteGroupDialog* d) +{ + if (r == RESPONSE_OK) { + _session->add_route_group (d->group()); + set_group (d->group()); } else { - _session->add_route_group (g); - set_group (g); + delete d->group (); } + + delete_when_idle (d); } Gtk::Menu *