enough with umpteen "i18n.h" files. Consolidate on pbd/i18n.h
[ardour.git] / gtk2_ardour / insert_remove_time_dialog.cc
index 851f57d1baab79614d84d1463122a7f719c1abae..0aeca1e2df37fc42f0b0e6b2b1756dcbfbcd6363 100644 (file)
@@ -23,7 +23,7 @@
 #include <gtkmm/alignment.h>
 #include "insert_remove_time_dialog.h"
 #include "audio_clock.h"
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace Gtk;
 using namespace Editing;
@@ -96,7 +96,9 @@ InsertRemoveTimeDialog::InsertRemoveTimeDialog (PublicEditor& e, bool remove)
        get_vbox()->pack_start (*tempo_box);
 
        add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
-       add_button (remove ? _("Remove time") : _("Insert time"), Gtk::RESPONSE_OK);
+       Gtk::Button *btn = manage (new Gtk::Button (remove ? _("Remove time") : _("Insert time")));
+       btn->signal_clicked().connect (sigc::mem_fun(*this, &InsertRemoveTimeDialog::doit));
+       get_action_area()->pack_start (*btn);
        show_all ();
 
        move_markers_toggled ();
@@ -165,6 +167,17 @@ InsertRemoveTimeDialog::distance () const
        return _clock.current_duration (_editor.get_preferred_edit_position ());
 }
 
+void
+InsertRemoveTimeDialog::doit ()
+{
+       if (distance () == 0) {
+               Gtk::MessageDialog msg (*this, _("Invalid or zero duration entered. Please enter a valid duration"));
+               msg.run ();
+               return;
+       }
+       response (RESPONSE_OK);
+}
+
 void
 InsertRemoveTimeDialog::move_markers_toggled ()
 {