From 836948506a1a0d291c99ff0094586dadfe1af51f Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sun, 23 Dec 2012 18:39:19 +0000 Subject: some more tweaks for the import dialog git-svn-id: svn://localhost/ardour2/branches/3.0@13718 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/sfdb_ui.cc | 36 +++++++++++++++++++++++++----------- gtk2_ardour/sfdb_ui.h | 2 ++ 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/gtk2_ardour/sfdb_ui.cc b/gtk2_ardour/sfdb_ui.cc index ee6a86290f..167b2534b3 100644 --- a/gtk2_ardour/sfdb_ui.cc +++ b/gtk2_ardour/sfdb_ui.cc @@ -600,11 +600,18 @@ SoundFileBrowser::SoundFileBrowser (Gtk::Window& parent, string title, ARDOUR::S button_box->set_layout (BUTTONBOX_END); button_box->pack_start (cancel_button, false, false); cancel_button.signal_clicked().connect (sigc::bind (sigc::mem_fun (*this, &SoundFileBrowser::do_something), RESPONSE_CANCEL)); - button_box->pack_start (apply_button, false, false); - apply_button.signal_clicked().connect (sigc::bind (sigc::mem_fun (*this, &SoundFileBrowser::do_something), RESPONSE_APPLY)); + if (persistent) { + button_box->pack_start (apply_button, false, false); + apply_button.signal_clicked().connect (sigc::bind (sigc::mem_fun (*this, &SoundFileBrowser::do_something), RESPONSE_APPLY)); + } + button_box->pack_start (ok_button, false, false); ok_button.signal_clicked().connect (sigc::bind (sigc::mem_fun (*this, &SoundFileBrowser::do_something), RESPONSE_OK)); + Gtkmm2ext::UI::instance()->set_tip (ok_button, _("Press to import selected files and close this window")); + Gtkmm2ext::UI::instance()->set_tip (apply_button, _("Press to import selected files and leave this window open")); + Gtkmm2ext::UI::instance()->set_tip (cancel_button, _("Press to close this window without importing any files")); + vpacker.pack_end (*button_box, false, false); } @@ -629,6 +636,13 @@ SoundFileBrowser::run () return _status; } +void +SoundFileBrowser::set_action_sensitive (bool yn) +{ + ok_button.set_sensitive (yn); + apply_button.set_sensitive (yn); +} + void SoundFileBrowser::do_something (int action) { @@ -762,7 +776,7 @@ void SoundFileBrowser::found_list_view_selected () { if (!reset_options ()) { - ok_button.set_sensitive (false); + set_action_sensitive (false); } else { string file; @@ -772,9 +786,9 @@ SoundFileBrowser::found_list_view_selected () TreeIter iter = found_list->get_iter(*rows.begin()); file = (*iter)[found_list_columns.pathname]; chooser.set_filename (file); - ok_button.set_sensitive (true); + set_action_sensitive (true); } else { - ok_button.set_sensitive (false); + set_action_sensitive (false); } preview.setup_labels (file); @@ -788,7 +802,7 @@ SoundFileBrowser::freesound_list_view_selected () #ifdef FREESOUND if (!reset_options ()) { - ok_button.set_sensitive (false); + set_action_sensitive (false); } else { string file; @@ -814,10 +828,10 @@ SoundFileBrowser::freesound_list_view_selected () if (file != "") { chooser.set_filename (file); - ok_button.set_sensitive (true); + set_action_sensitive (true); } } else { - ok_button.set_sensitive (false); + set_action_sensitive (false); } freesound_progress_bar.set_text( @@ -1742,12 +1756,12 @@ SoundFileOmega::file_selection_changed () } if (!reset_options ()) { - ok_button.set_sensitive (false); + set_action_sensitive (false); } else { if (chooser.get_filenames().size() > 0) { - ok_button.set_sensitive (true); + set_action_sensitive (true); } else { - ok_button.set_sensitive (false); + set_action_sensitive (false); } } } diff --git a/gtk2_ardour/sfdb_ui.h b/gtk2_ardour/sfdb_ui.h index d0e63568cd..e4e919ae1e 100644 --- a/gtk2_ardour/sfdb_ui.h +++ b/gtk2_ardour/sfdb_ui.h @@ -236,6 +236,8 @@ class SoundFileBrowser : public ArdourWindow bool on_midi_filter (const Gtk::FileFilter::Info& filter_info); bool on_audio_and_midi_filter (const Gtk::FileFilter::Info& filter_info); + void set_action_sensitive (bool); + virtual bool reset_options() { return true; } protected: -- cgit v1.2.3