Add test for #3356.
[ardour.git] / gtk2_ardour / route_group_dialog.cc
index 83a36d083fac7a588a42cd9c8d62eeba0375e8b5..176c23d8e2ae468a069b76e2f278715002efdeaf 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2009 Paul Davis 
+    Copyright (C) 2009 Paul Davis
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 
 #include <gtkmm/table.h>
 #include <gtkmm/stock.h>
-#include <gtkmm2ext/window_title.h>
 #include "ardour/route_group.h"
 #include "route_group_dialog.h"
 #include "i18n.h"
 #include <iostream>
 
 using namespace Gtk;
-using namespace Gtkmm2ext;
 using namespace ARDOUR;
 using namespace std;
+using namespace PBD;
 
 RouteGroupDialog::RouteGroupDialog (RouteGroup* g, StockID const & s)
-       : ArdourDialog (_("route group dialog")),
+       : ArdourDialog (_("Route Group")),
          _group (g),
          _active (_("Active")),
          _gain (_("Gain")),
@@ -48,10 +47,6 @@ RouteGroupDialog::RouteGroupDialog (RouteGroup* g, StockID const & s)
        set_position (Gtk::WIN_POS_MOUSE);
        set_name (N_("RouteGroupDialog"));
 
-       WindowTitle title (Glib::get_application_name());
-       title += _("Route group");
-       set_title(title.get_string());
-
        VBox* vbox = manage (new VBox);
        Gtk::Label* l;
 
@@ -63,12 +58,12 @@ RouteGroupDialog::RouteGroupDialog (RouteGroup* g, StockID const & s)
        HBox* hbox = manage (new HBox);
        hbox->set_spacing (6);
        l = manage (new Label (_("Name:"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false ));
-       
+
        hbox->pack_start (*l, false, true);
        hbox->pack_start (_name, true, true);
 
        vbox->pack_start (*hbox, false, true);
+
        VBox* options_box = manage (new VBox);
        options_box->set_spacing (6);
 
@@ -79,16 +74,18 @@ RouteGroupDialog::RouteGroupDialog (RouteGroup* g, StockID const & s)
        _name.set_text (_group->name ());
        _active.set_active (_group->is_active ());
 
-       _gain.set_active (_group->property (RouteGroup::Gain));
+       _name.signal_activate ().connect (sigc::bind (sigc::mem_fun (*this, &Dialog::response), RESPONSE_OK));
+
+       _gain.set_active (_group->is_gain());
        _relative.set_active (_group->is_relative());
-       _mute.set_active (_group->property (RouteGroup::Mute));
-       _solo.set_active (_group->property (RouteGroup::Solo));
-       _rec_enable.set_active (_group->property (RouteGroup::RecEnable));
-       _select.set_active (_group->property (RouteGroup::Select));
-       _edit.set_active (_group->property (RouteGroup::Edit));
+       _mute.set_active (_group->is_mute());
+       _solo.set_active (_group->is_solo());
+       _rec_enable.set_active (_group->is_recenable());
+       _select.set_active (_group->is_select());
+       _edit.set_active (_group->is_edit());
 
        gain_toggled ();
-       
+
        Table* table = manage (new Table (8, 3, false));
        table->set_row_spacings (6);
 
@@ -115,10 +112,11 @@ RouteGroupDialog::RouteGroupDialog (RouteGroup* g, StockID const & s)
 
        get_vbox()->pack_start (*vbox, false, false);
 
-       _gain.signal_toggled().connect(mem_fun (*this, &RouteGroupDialog::gain_toggled));
+       _gain.signal_toggled().connect(sigc::mem_fun (*this, &RouteGroupDialog::gain_toggled));
 
        add_button (Stock::CANCEL, RESPONSE_CANCEL);
        add_button (s, RESPONSE_OK);
+       set_default_response (RESPONSE_OK);
 
        show_all_children ();
 }
@@ -128,16 +126,21 @@ RouteGroupDialog::do_run ()
 {
        int const r = run ();
 
-       if (r == Gtk::RESPONSE_OK) {
-               _group->set_property (RouteGroup::Gain, _gain.get_active ());
-               _group->set_property (RouteGroup::Mute, _mute.get_active ());
-               _group->set_property (RouteGroup::Solo, _solo.get_active ());
-               _group->set_property (RouteGroup::RecEnable, _rec_enable.get_active ());
-               _group->set_property (RouteGroup::Select, _select.get_active ());
-               _group->set_property (RouteGroup::Edit, _edit.get_active ());
-               _group->set_name (_name.get_text ()); // This emits changed signal
-               _group->set_active (_active.get_active (), this);
-               _group->set_relative (_relative.get_active(), this);
+       if (r == Gtk::RESPONSE_OK || r == Gtk::RESPONSE_ACCEPT) {
+
+               PropertyList plist;
+
+               plist.add (Properties::gain, _gain.get_active());
+               plist.add (Properties::recenable, _rec_enable.get_active());
+               plist.add (Properties::mute, _mute.get_active());
+               plist.add (Properties::solo, _solo.get_active ());
+               plist.add (Properties::select, _select.get_active());
+               plist.add (Properties::edit, _edit.get_active());
+               plist.add (Properties::relative, _relative.get_active());
+               plist.add (Properties::active, _active.get_active());
+               plist.add (Properties::name, string (_name.get_text()));
+
+               _group->set_properties (plist);
        }
 
        return r;