[regexxer] Move pre-defined file patterns into gsettings. This way the user can edit the pattern via gconf if w



commit 8dd399cb7a4a9fbdc28d681643e3511df7d315d5
Author: Fabien Parent <parent f gmail com>
Date:   Sun Feb 20 20:40:08 2011 +0100

    Move pre-defined file patterns into gsettings. This way the user can edit the pattern via gconf if wanted.
    Changes description of regex-patterns and substituion-patterns.

 src/globalstrings.h            |    1 +
 src/mainwindow.cc              |   18 ++++++++----------
 ui/org.regexxer.gschema.xml.in |   10 ++++++++--
 3 files changed, 17 insertions(+), 12 deletions(-)
---
diff --git a/src/globalstrings.h b/src/globalstrings.h
index fc94b62..611412c 100644
--- a/src/globalstrings.h
+++ b/src/globalstrings.h
@@ -39,6 +39,7 @@ const char *const conf_key_current_match_color = "current-match-color";
 const char *const conf_key_fallback_encoding   = "fallback-encoding";
 const char *const conf_key_substitution_patterns = "substitution-patterns";
 const char *const conf_key_regex_patterns      = "regex-patterns";
+const char *const conf_key_files_patterns      = "files-patterns";
 const char *const conf_key_window_width        = "window-width";
 const char *const conf_key_window_height       = "window-height";
 const char *const conf_key_window_position_x   = "window-position-x";
diff --git a/src/mainwindow.cc b/src/mainwindow.cc
index be455a2..6fba846 100644
--- a/src/mainwindow.cc
+++ b/src/mainwindow.cc
@@ -281,16 +281,14 @@ 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}");
+  const std::list<Glib::ustring> patterns =
+      settings->get_string_array(conf_key_files_patterns);
+  for (std::list<Glib::ustring>::const_iterator pattern = patterns.begin();
+       pattern != patterns.end();
+       ++pattern)
+  {
+    combo_entry_pattern_->append_text(*pattern);
+  }
 
   if (init.feedback)
     filetree_->signal_feedback.connect(&print_location);
diff --git a/ui/org.regexxer.gschema.xml.in b/ui/org.regexxer.gschema.xml.in
index 02f8c72..0c93099 100644
--- a/ui/org.regexxer.gschema.xml.in
+++ b/ui/org.regexxer.gschema.xml.in
@@ -1,15 +1,21 @@
 <schemalist>
   <schema id="org.regexxer" path="/apps/regexxer/">
+    <key name="files-patterns" type="as">
+      <default>['*.[ch]','*.{c,cc,cpp,cxx,c++,C,h,hh,hpp,hxx,h++}','*.{ccg,hg}','*.idl','*.{java,jsp}','*.{pl,pm,cgi}','*.py','*.php[0-9]?','*.{html,htm,shtml,js,wml}','*.{xml,xsl,css,dtd,xsd}']</default>
+      <_summary>File Patterns</_summary>
+      <_description>List of pre-defined patterns available in the 'Pattern' entry.</_description>
+    </key>
+
     <key name="regex-patterns" type="as">
       <default>[]</default>
       <_summary>Regex Patterns</_summary>
-      <_description>List of last patterns used for the regex entry.</_description>
+      <_description>List of last patterns used in the 'Regex' entry.</_description>
     </key>
 
     <key name="substitution-patterns" type="as">
       <default>[]</default>
       <_summary>Regex Patterns</_summary>
-      <_description>List of last patterns used for the substitution entry.</_description>
+      <_description>List of last patterns used in the 'Substitution' entry.</_description>
     </key>
 
     <key name="textview-font" type="s">



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]