Commit 0bb8d205 authored by Fabien Parent's avatar Fabien Parent
Browse files

Revert the commit '1e61b5ac' for usability issues.

The file pattern entry doesn't show the last 10 pattern used anymore. We are back to the previous behavior which is to show a predefined list of pattern.
parent 588e6481
......@@ -40,7 +40,6 @@ const char *const conf_key_toolbar_style = "/apps/regexxer/toolbar_style";
const char *const conf_key_fallback_encoding = "/apps/regexxer/fallback_encoding";
const char *const conf_key_substitution_patterns = "/apps/regexxer/substitution_patterns";
const char *const conf_key_regex_patterns = "/apps/regexxer/regex_patterns";
const char *const conf_key_files_patterns = "/apps/regexxer/files_patterns";
const char *const ui_mainwindow_filename = REGEXXER_PKGDATADIR G_DIR_SEPARATOR_S
"mainwindow.ui";
......
......@@ -183,8 +183,6 @@ MainWindow::MainWindow()
table_file_ (0),
button_folder_ (0),
combo_entry_pattern_ (Gtk::manage(new Gtk::ComboBoxEntryText())),
combo_entry_pattern_completion_stack_(10, Gnome::Conf::Client::get_default_client()->get_string_list(conf_key_files_patterns)),
combo_entry_pattern_completion_ (Gtk::EntryCompletion::create()),
button_recursive_ (0),
button_hidden_ (0),
entry_regex_ (0),
......@@ -243,9 +241,7 @@ void MainWindow::initialize(const InitState& init)
const bool folder_exists = button_folder_->set_current_folder(folder);
combo_entry_pattern_->get_entry()->set_text((init.pattern.empty()) ? Glib::ustring(1, '*') : init.pattern);
combo_entry_pattern_->set_model(combo_entry_pattern_completion_stack_.get_completion_model());
combo_entry_pattern_->set_text_column(combo_entry_pattern_completion_stack_.get_completion_column());
combo_entry_pattern_->get_entry()->set_completion(combo_entry_pattern_completion_);
entry_regex_ ->set_text(init.regex);
entry_regex_->set_text(init.regex);
entry_regex_->set_completion(entry_regex_completion_);
......@@ -257,16 +253,10 @@ void MainWindow::initialize(const InitState& init)
comboboxentry_substitution_->set_model(entry_substitution_completion_stack_.get_completion_model());
comboboxentry_substitution_->set_text_column(entry_substitution_completion_stack_.get_completion_column());
combo_entry_pattern_completion_->set_model(combo_entry_pattern_completion_stack_.get_completion_model());
combo_entry_pattern_completion_->set_text_column(combo_entry_pattern_completion_stack_.get_completion_column());
combo_entry_pattern_completion_->set_inline_completion(true);
combo_entry_pattern_completion_->set_popup_completion(false);
entry_regex_completion_->set_model(entry_regex_completion_stack_.get_completion_model());
entry_regex_completion_->set_text_column(entry_regex_completion_stack_.get_completion_column());
entry_regex_completion_->set_inline_completion(true);
entry_regex_completion_->set_popup_completion(false);
entry_substitution_completion_->set_model(entry_substitution_completion_stack_.get_completion_model());
entry_substitution_completion_->set_text_column(entry_substitution_completion_stack_.get_completion_column());
......@@ -278,6 +268,17 @@ void MainWindow::initialize(const InitState& init)
button_multiple_ ->set_active(!init.no_global);
button_caseless_ ->set_active(init.ignorecase);
combo_entry_pattern_->append_text("*.[ch]");
combo_entry_pattern_->append_text("*.{c,cc,cpp,cxx,c++,C,h,hh,hpp,hxx,h++}");
combo_entry_pattern_->append_text("*.{ccg,hg}");
combo_entry_pattern_->append_text("*.idl");
combo_entry_pattern_->append_text("*.{java,jsp}");
combo_entry_pattern_->append_text("*.{pl,pm,cgi}");
combo_entry_pattern_->append_text("*.py");
combo_entry_pattern_->append_text("*.php[0-9]?");
combo_entry_pattern_->append_text("*.{html,htm,shtml,js,wml}");
combo_entry_pattern_->append_text("*.{xml,xsl,css,dtd,xsd}");
if (init.feedback)
filetree_->signal_feedback.connect(&print_location);
......@@ -530,10 +531,6 @@ void MainWindow::on_find_files()
if (dialog.run() != Gtk::RESPONSE_OK)
return;
}
const Glib::ustring files_regex = combo_entry_pattern_->get_entry()->get_text();
combo_entry_pattern_completion_stack_.push(files_regex);
Gnome::Conf::Client::get_default_client()->set_string_list(conf_key_files_patterns, combo_entry_pattern_completion_stack_.get_stack());
std::string folder = button_folder_->get_filename();
......@@ -548,7 +545,7 @@ void MainWindow::on_find_files()
try
{
Pcre::Pattern pattern (Util::shell_pattern_to_regex(files_regex), Pcre::DOTALL);
Pcre::Pattern pattern (Util::shell_pattern_to_regex(combo_entry_pattern_->get_entry()->get_text()), Pcre::DOTALL);
filetree_->find_files(folder, pattern,
button_recursive_->get_active(),
......
......@@ -43,6 +43,7 @@ class FileChooser;
class Toolbar;
class Window;
class ComboBoxEntry;
class ComboBoxEntryText;
class VBox;
class ScrolledWindow;
class Table;
......@@ -103,9 +104,7 @@ private:
Gtk::Table* table_file_;
Gtk::FileChooser* button_folder_;
Gtk::ComboBoxEntry* combo_entry_pattern_;
CompletionStack combo_entry_pattern_completion_stack_;
Glib::RefPtr<Gtk::EntryCompletion> combo_entry_pattern_completion_;
Gtk::ComboBoxEntryText* combo_entry_pattern_;
Gtk::CheckButton* button_recursive_;
Gtk::CheckButton* button_hidden_;
......
<?xml version="1.0"?>
<gconfschemafile>
<schemalist>
<schema>
<key>/schemas/apps/regexxer/files_patterns</key>
<applyto>/apps/regexxer/files_patterns</applyto>
<owner>regexxer</owner>
<type>list</type>
<list_type>string</list_type>
<default_value>
<value>
<list type="string">
</list>
</value>
</default_value>
<locale name="C">
<short>Regex Patterns</short>
<long>List of last pattern used for the file's regex entry.</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/regexxer/regex_patterns</key>
<applyto>/apps/regexxer/regex_patterns</applyto>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment