[gnome-commander] xml: <Searchtool><Path recursive=...> -> <Searchtool><Subdirectories max-dep=... >



commit 7a23fc7d2177caf23b5ccffa8e6b74ed56c69e50
Author: Piotr Eljasiak <epiotr src gnome org>
Date:   Fri May 6 00:31:07 2011 +0200

    xml: <Searchtool><Path recursive=...>  ->  <Searchtool><Subdirectories max-dep=... >

 src/gnome-cmd-data.cc          |    6 +++---
 src/gnome-cmd-data.h           |    6 ++----
 src/gnome-cmd-search-dialog.cc |    6 +++---
 src/gnome-cmd-xml-config.cc    |   16 ++++++++--------
 4 files changed, 16 insertions(+), 18 deletions(-)
---
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 5512af6..da78be0 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -81,7 +81,7 @@ void GnomeCmdData::Selection::reset()
     name.clear();
     filename_pattern.clear();
     syntax = Filter::TYPE_REGEX;
-    recursive = TRUE;
+    max_depth = -1;
     text_pattern.clear();
     match_case = FALSE;
 }
@@ -792,7 +792,7 @@ 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.default_profile.recursive = gnome_cmd_data_get_bool ("/search-history/recursive", TRUE);
+    search_defaults.default_profile.max_depth = gnome_cmd_data_get_bool ("/search-history/recursive", TRUE) ? -1 : 0;
     search_defaults.default_profile.match_case = gnome_cmd_data_get_bool ("/search-history/case_sens", FALSE);
 }
 
@@ -1979,7 +1979,7 @@ XML::xstream &operator << (XML::xstream &xml, GnomeCmdData::Selection &cfg)
 
         xml << XML::tag("Pattern") << XML::attr("syntax") << (cfg.syntax==Filter::TYPE_REGEX ? "regex" : "shell")
                                    << XML::attr("match-case") << 0 << XML::chardata() << XML::escape(cfg.filename_pattern) << XML::endtag();
-        xml << XML::tag("Path") << XML::attr("recursive") << cfg.recursive << XML::endtag();
+        xml << XML::tag("Subdirectories") << XML::attr("max-depth") << cfg.max_depth << XML::endtag();
         xml << XML::tag("Text") << XML::attr("match-case") << cfg.match_case << XML::chardata() << XML::escape(cfg.text_pattern) << XML::endtag();
 
     xml << XML::endtag();
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index 2ea809e..05fe4ef 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -70,15 +70,13 @@ struct GnomeCmdData
         std::string name;
         std::string filename_pattern;
         Filter::Type syntax;
-        gboolean recursive;
+        int max_depth;
         std::string text_pattern;
         gboolean match_case;
 
         void reset();
 
-        Selection(): syntax(Filter::TYPE_REGEX),
-                     recursive(TRUE),
-                     match_case(FALSE)                          {}
+        Selection(): syntax(Filter::TYPE_REGEX), max_depth(-1), match_case(FALSE)       {}
 
         friend XML::xstream &operator << (XML::xstream &xml, Selection &cfg);
     };
diff --git a/src/gnome-cmd-search-dialog.cc b/src/gnome-cmd-search-dialog.cc
index 4ea5ee6..debc1f9 100755
--- a/src/gnome-cmd-search-dialog.cc
+++ b/src/gnome-cmd-search-dialog.cc
@@ -553,7 +553,7 @@ static void on_search (GtkButton *button, GnomeCmdSearchDialog *dialog)
 
     // save default settings
     gnome_cmd_data.search_defaults.default_profile.match_case = data->case_sens;
-    gnome_cmd_data.search_defaults.default_profile.recursive = data->recurse;
+    gnome_cmd_data.search_defaults.default_profile.max_depth = data->recurse ? -1 : 0;
     gnome_cmd_data.search_defaults.name_patterns.add(data->name_pattern);
 
     if (data->content_search)
@@ -718,7 +718,7 @@ static void gnome_cmd_search_dialog_finalize (GObject *object)
     gnome_cmd_data.search_defaults.height = allocation.height;
 
     gnome_cmd_data.filter_type = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (lookup_widget (GTK_WIDGET (dialog), "regex_radio"))) ? Filter::TYPE_REGEX : Filter::TYPE_FNMATCH;
-
+    gnome_cmd_data.search_defaults.default_profile.max_depth = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->recurse_check)) ? -1 : 0;
     g_free (dialog->priv);
 
     G_OBJECT_CLASS (gnome_cmd_search_dialog_parent_class)->finalize (object);
@@ -781,7 +781,7 @@ static void gnome_cmd_search_dialog_init (GnomeCmdSearchDialog *dialog)
 
     // recurse check
     dialog->priv->recurse_check = create_check_with_mnemonic (window, _("Search _recursively"), "recurse_check");
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->recurse_check), defaults.default_profile.recursive);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->recurse_check), defaults.default_profile.max_depth==-1);
     gtk_box_pack_start (GTK_BOX (hbox), dialog->priv->recurse_check, FALSE, FALSE, 0);
 
 
diff --git a/src/gnome-cmd-xml-config.cc b/src/gnome-cmd-xml-config.cc
index 6606211..6d3468b 100644
--- a/src/gnome-cmd-xml-config.cc
+++ b/src/gnome-cmd-xml-config.cc
@@ -351,7 +351,7 @@ enum {XML_ELEM_NOT_FOUND,
       XML_GNOMECOMMANDER_SEARCHTOOL_WINDOWSIZE,
       XML_GNOMECOMMANDER_SEARCHTOOL_PROFILE,
       XML_GNOMECOMMANDER_SEARCHTOOL_PROFILE_PATTERN,
-      XML_GNOMECOMMANDER_SEARCHTOOL_PROFILE_PATH,
+      XML_GNOMECOMMANDER_SEARCHTOOL_PROFILE_SUBDIRECTORIES,
       XML_GNOMECOMMANDER_SEARCHTOOL_PROFILE_TEXT,
       XML_GNOMECOMMANDER_SEARCHTOOL_HISTORY,
       XML_GNOMECOMMANDER_SEARCHTOOL_HISTORY_PATTERN,
@@ -364,7 +364,7 @@ enum {XML_ELEM_NOT_FOUND,
       XML_GNOMECOMMANDER_SELECTIONS,
       XML_GNOMECOMMANDER_SELECTIONS_PROFILE,
       XML_GNOMECOMMANDER_SELECTIONS_PROFILE_PATTERN,
-      XML_GNOMECOMMANDER_SELECTIONS_PROFILE_PATH,
+      XML_GNOMECOMMANDER_SELECTIONS_PROFILE_SUBDIRECTORIES,
       XML_GNOMECOMMANDER_SELECTIONS_PROFILE_TEXT,
       XML_GNOMECOMMANDER_KEYBINDINGS,
       XML_GNOMECOMMANDER_KEYBINDINGS_KEY};
@@ -587,12 +587,12 @@ static void xml_start(GMarkupParseContext *context,
             }
             break;
 
-        case XML_GNOMECOMMANDER_SEARCHTOOL_PROFILE_PATH:
-        case XML_GNOMECOMMANDER_SELECTIONS_PROFILE_PATH:
+        case XML_GNOMECOMMANDER_SEARCHTOOL_PROFILE_SUBDIRECTORIES:
+        case XML_GNOMECOMMANDER_SELECTIONS_PROFILE_SUBDIRECTORIES:
             if (g_markup_collect_attributes (element_name, attribute_names, attribute_values, error,
-                                             G_MARKUP_COLLECT_BOOLEAN, "recursive", &param4,
+                                             G_MARKUP_COLLECT_STRING, "max-depth", &param1,
                                              G_MARKUP_COLLECT_INVALID))
-                xml_search_profile.recursive = param4;
+                xml_search_profile.max_depth = atoi(param1);
             break;
 
         case XML_GNOMECOMMANDER_SEARCHTOOL_PROFILE_TEXT:
@@ -787,7 +787,7 @@ gboolean gnome_cmd_xml_config_parse (const gchar *xml, gsize xml_len, GnomeCmdDa
                         {XML_GNOMECOMMANDER_SEARCHTOOL_WINDOWSIZE, "/GnomeCommander/SearchTool/WindowSize"},
                         {XML_GNOMECOMMANDER_SEARCHTOOL_PROFILE, "/GnomeCommander/SearchTool/Profile"},
                         {XML_GNOMECOMMANDER_SEARCHTOOL_PROFILE_PATTERN, "/GnomeCommander/SearchTool/Profile/Pattern"},
-                        {XML_GNOMECOMMANDER_SEARCHTOOL_PROFILE_PATH, "/GnomeCommander/SearchTool/Profile/Path"},
+                        {XML_GNOMECOMMANDER_SEARCHTOOL_PROFILE_SUBDIRECTORIES, "/GnomeCommander/SearchTool/Profile/Subdirectories"},
                         {XML_GNOMECOMMANDER_SEARCHTOOL_PROFILE_TEXT, "/GnomeCommander/SearchTool/Profile/Text"},
                         {XML_GNOMECOMMANDER_SEARCHTOOL_HISTORY, "/GnomeCommander/SearchTool/History"},
                         {XML_GNOMECOMMANDER_SEARCHTOOL_HISTORY_PATTERN, "/GnomeCommander/SearchTool/History/Pattern"},
@@ -800,7 +800,7 @@ gboolean gnome_cmd_xml_config_parse (const gchar *xml, gsize xml_len, GnomeCmdDa
                         {XML_GNOMECOMMANDER_SELECTIONS, "/GnomeCommander/Selections"},
                         {XML_GNOMECOMMANDER_SELECTIONS_PROFILE, "/GnomeCommander/Selections/Profile"},
                         {XML_GNOMECOMMANDER_SELECTIONS_PROFILE_PATTERN, "/GnomeCommander/Selections/Profile/Pattern"},
-                        {XML_GNOMECOMMANDER_SELECTIONS_PROFILE_PATH, "/GnomeCommander/Selections/Profile/Path"},
+                        {XML_GNOMECOMMANDER_SELECTIONS_PROFILE_SUBDIRECTORIES, "/GnomeCommander/Selections/Profile/Subdirectories"},
                         {XML_GNOMECOMMANDER_SELECTIONS_PROFILE_TEXT, "/GnomeCommander/Selections/Profile/Text"},
                         {XML_GNOMECOMMANDER_KEYBINDINGS, "/GnomeCommander/KeyBindings"},
                         {XML_GNOMECOMMANDER_KEYBINDINGS_KEY, "/GnomeCommander/KeyBindings/Key"}



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