#include "ardour/export_format_specification.h"
#include "ardour/export_profile_manager.h"
-#include "ardour/session.h"
#include "i18n.h"
new_button.set_name ("PaddedButton");
edit_button.signal_clicked().connect (sigc::hide_return (sigc::bind (sigc::mem_fun (*this, &ExportFormatSelector::open_edit_dialog), false)));
- remove_button.signal_clicked().connect (sigc::mem_fun (*this, &ExportFormatSelector::remove_format));
+ remove_button.signal_clicked().connect (sigc::bind (sigc::mem_fun (*this, &ExportFormatSelector::remove_format), true));
new_button.signal_clicked().connect (sigc::mem_fun (*this, &ExportFormatSelector::add_new_format));
/* Format combo */
format_list = Gtk::ListStore::create (format_cols);
+ format_list->set_sort_column (format_cols.label, Gtk::SORT_ASCENDING);
format_combo.set_model (format_list);
format_combo.pack_start (format_cols.label);
format_combo.set_active (0);
tree_it->set_value (format_cols.label, (*it)->description());
}
- if (format_combo.get_active_row_number() == -1) {
+ if (format_combo.get_active_row_number() == -1 && format_combo.get_model()->children().size() > 0) {
format_combo.set_active (0);
}
FormatPtr new_format = state->format = NewFormat (state->format);
if (open_edit_dialog (true) != Gtk::RESPONSE_APPLY) {
- remove_format();
+ remove_format(false);
if (state->list->empty()) {
state->format.reset ();
}
}
void
-ExportFormatSelector::remove_format ()
+ExportFormatSelector::remove_format (bool called_from_button)
{
+ if (called_from_button) {
+ Gtk::MessageDialog dialog (_("Do you really want to remove the format?"),
+ false,
+ Gtk::MESSAGE_QUESTION,
+ Gtk::BUTTONS_YES_NO);
+
+ if (Gtk::RESPONSE_YES != dialog.run ()) {
+ /* User has selected "no" or closed the dialog, better
+ * abort
+ */
+ return;
+ }
+ }
+
FormatPtr remove;
Gtk::TreeModel::iterator it = format_combo.get_active();
remove = it->get_value (format_cols.format);
+
FormatRemoved (remove);
}