[gnome-commander] Added GnomeCmdData::Selection struct for storing search settings



commit 636260c4fef070f10db2a92b07fbae64d4764fc5
Author: Piotr Eljasiak <epiotr src gnome org>
Date:   Wed Jul 1 19:15:56 2009 +0200

    Added GnomeCmdData::Selection struct for storing search settings

 src/gnome-cmd-data.cc |   30 +++++++++++++-----------------
 src/gnome-cmd-data.h  |   30 +++++++++++++++++++++++-------
 2 files changed, 36 insertions(+), 24 deletions(-)
---
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index ae38956..1bdee94 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -76,6 +76,17 @@ DICT<guint> gdk_key_names(GDK_VoidSymbol);
 DICT<guint> gdk_modifiers_names;
 
 
+void GnomeCmdData::Selection::reset()
+{
+    name.clear();
+    filename_pattern.clear();
+    syntax = Filter::TYPE_REGEX;
+    recursive = TRUE;
+    text_pattern.clear();
+    match_case = FALSE;
+}
+
+
 void GnomeCmdData::AdvrenameConfig::Profile::reset()
 {
     name.clear();
@@ -806,20 +817,6 @@ inline void GnomeCmdData::save_cmdline_history()
 }
 
 
-inline void GnomeCmdData::save_search_defaults()
-{
-    gnome_cmd_data_set_int ("/search-history/width", search_defaults.width);
-    gnome_cmd_data_set_int ("/search-history/height", search_defaults.height);
-
-    gnome_cmd_data_set_string_history ("/search-history/name_pattern%d", search_defaults.name_patterns.ents);
-    gnome_cmd_data_set_string_history ("/search-history/content_pattern%d", search_defaults.content_patterns.ents);
-    gnome_cmd_data_set_string_history ("/search-history/directory%d", search_defaults.directories.ents);
-
-    gnome_cmd_data_set_bool ("/search-history/recursive", search_defaults.recursive);
-    gnome_cmd_data_set_bool ("/search-history/case_sens", search_defaults.case_sens);
-}
-
-
 inline void GnomeCmdData::save_intviewer_defaults()
 {
     gnome_cmd_data_set_string_history ("/internal_viewer/text_pattern%d", intviewer_defaults.text_patterns.ents);
@@ -927,8 +924,8 @@ inline void GnomeCmdData::load_search_defaults()
 
     search_defaults.width = gnome_cmd_data_get_int ("/search-history/width", 640);
     search_defaults.height = gnome_cmd_data_get_int ("/search-history/height", 400);
-    search_defaults.recursive = gnome_cmd_data_get_bool ("/search-history/recursive", TRUE);
-    search_defaults.case_sens = gnome_cmd_data_get_bool ("/search-history/case_sens", FALSE);
+    search_defaults.default_profile.recursive = gnome_cmd_data_get_bool ("/search-history/recursive", TRUE);
+    search_defaults.default_profile.match_case = gnome_cmd_data_get_bool ("/search-history/case_sens", FALSE);
 }
 
 
@@ -1744,7 +1741,6 @@ void GnomeCmdData::save()
     save_connections ("connections");
     save_devices ("devices");
     save_fav_apps ("fav-apps");
-    save_search_defaults();
     save_intviewer_defaults();
     gnome_cmd_xml_config_save (xml_cfg_path, *this);
     save_local_bookmarks();
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index c80b2af..68f67f0 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -50,20 +50,36 @@ struct GnomeCmdData
 
     enum {SEARCH_HISTORY_SIZE=10, ADVRENAME_HISTORY_SIZE=10, INTVIEWER_HISTORY_SIZE=16};
 
+    struct Selection
+    {
+        std::string name;
+        std::string filename_pattern;
+        Filter::Type syntax;
+        gboolean recursive;
+        std::string text_pattern;
+        gboolean match_case;
+
+        void reset();
+
+        Selection(): syntax(Filter::TYPE_REGEX),
+                     recursive(TRUE),
+                     match_case(FALSE)                          {}
+    };
+
     struct SearchConfig
     {
+        gint width, height;
+
+        Selection default_profile;
+
         History name_patterns;
         History directories;
         History content_patterns;
-        gboolean recursive;
-        gboolean case_sens;
-        gint width, height;
 
-        SearchConfig(): name_patterns(SEARCH_HISTORY_SIZE),
+        SearchConfig(): width(600), height(400),
+                        name_patterns(SEARCH_HISTORY_SIZE),
                         directories(SEARCH_HISTORY_SIZE),
-                        content_patterns(SEARCH_HISTORY_SIZE),
-                        recursive(TRUE), case_sens(FALSE),
-                        width(600), height(400)                 {}
+                        content_patterns(SEARCH_HISTORY_SIZE)   {}
     };
 
     struct AdvrenameConfig



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