[gnome-commander/get_rid_of_xml] Use initial values for storing the default search profile when search history should not be stored



commit 8e9a89538173fa4c7f2be8bbe19c11000851d3c4
Author: Uwe Scholz <u scholz83 gmx de>
Date:   Sat Dec 29 21:13:05 2018 +0100

    Use initial values for storing the default search profile when search history should not be stored

 src/gnome-cmd-data.cc | 10 +++++++---
 src/gnome-cmd-data.h  | 11 ++++-------
 2 files changed, 11 insertions(+), 10 deletions(-)
---
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 477ac5d2..8a23740e 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -1597,7 +1597,13 @@ static void write(XML::xstream &xml, GnomeCmdCon *con, const gchar *name)
 void GnomeCmdData::save_search_profiles ()
 {
     GVariantBuilder* gVariantBuilder = g_variant_builder_new(G_VARIANT_TYPE_ARRAY);
-    add_search_profile_to_gvariant_builder(gVariantBuilder, search_defaults.default_profile);
+    if (options.save_search_history_on_exit)
+        add_search_profile_to_gvariant_builder(gVariantBuilder, search_defaults.default_profile);
+    else
+    {
+        SearchProfile searchProfile;
+        add_search_profile_to_gvariant_builder(gVariantBuilder, searchProfile);
+    }
 
     for (auto profile : profiles)
     {
@@ -2351,8 +2357,6 @@ void GnomeCmdData::load_search_profiles ()
     {
         SearchProfile searchProfile;
 
-        searchProfile.reset();
-
         searchProfile.name             = name;
         searchProfile.max_depth        = maxDepth;
         searchProfile.syntax           = syntax == 0 ? Filter::TYPE_REGEX : Filter::TYPE_FNMATCH;
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index 97d67d5f..dd1186c5 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -524,14 +524,11 @@ struct GnomeCmdData
     {
         std::string name;
         std::string filename_pattern;
-        Filter::Type syntax;
-        int max_depth;
+        Filter::Type syntax {Filter::TYPE_REGEX};
+        int max_depth {-1};
         std::string text_pattern;
-        gboolean content_search;
-        gboolean match_case;
-
-        SearchProfile(): syntax(Filter::TYPE_REGEX), max_depth(-1), content_search(FALSE), match_case(FALSE) 
      {}
-        ~SearchProfile() {}
+        gboolean content_search {FALSE};
+        gboolean match_case {FALSE};
 
         const std::string &description() const    {  return filename_pattern;  }
         void reset();


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