[gnome-commander] search: store 'Default' profile modifications between sesions



commit 59b46e381434b694a73c7deae6c4c48d895d9f8f
Author: Piotr Eljasiak <epiotr src gnome org>
Date:   Thu Jul 28 21:48:21 2011 +0200

    search: store 'Default' profile modifications between sesions

 src/dialogs/gnome-cmd-search-dialog.cc       |    4 ++++
 src/gnome-cmd-selection-profile-component.cc |    9 +++++++++
 2 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/src/dialogs/gnome-cmd-search-dialog.cc b/src/dialogs/gnome-cmd-search-dialog.cc
index e7e4f72..7da3260 100755
--- a/src/dialogs/gnome-cmd-search-dialog.cc
+++ b/src/dialogs/gnome-cmd-search-dialog.cc
@@ -967,12 +967,16 @@ void GnomeCmdSearchDialog::Private::on_dialog_response(GtkDialog *window, int re
                 // save default settings
                 dialog->priv->profile_component->copy();
                 if (!dialog->defaults.default_profile.filename_pattern.empty())
+                {
                     gnome_cmd_data.search_defaults.name_patterns.add(dialog->defaults.default_profile.filename_pattern.c_str());
+                    dialog->priv->profile_component->set_name_patterns_history(dialog->defaults.name_patterns.ents);
+                }
 
                 if (dialog->defaults.default_profile.content_search && !dialog->defaults.default_profile.text_pattern.empty())
                 {
                     gnome_cmd_data.search_defaults.content_patterns.add(dialog->defaults.default_profile.text_pattern.c_str());
                     gnome_cmd_data.intviewer_defaults.text_patterns.add(dialog->defaults.default_profile.text_pattern.c_str());
+                    dialog->priv->profile_component->set_content_patterns_history(dialog->defaults.content_patterns.ents);
                 }
 
                 data.search_done = FALSE;
diff --git a/src/gnome-cmd-selection-profile-component.cc b/src/gnome-cmd-selection-profile-component.cc
index 2ae61fb..df67b42 100755
--- a/src/gnome-cmd-selection-profile-component.cc
+++ b/src/gnome-cmd-selection-profile-component.cc
@@ -208,6 +208,9 @@ GnomeCmdSelectionProfileComponent::GnomeCmdSelectionProfileComponent(GnomeCmdDat
 
 void GnomeCmdSelectionProfileComponent::update()
 {
+    set_name_patterns_history(gnome_cmd_data.search_defaults.name_patterns.ents);
+    set_content_patterns_history(gnome_cmd_data.search_defaults.content_patterns.ents);
+
     gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->pattern_combo))), profile.filename_pattern.c_str());
     gtk_combo_box_set_active (GTK_COMBO_BOX (priv->filter_type_combo), (int) profile.syntax);
     gtk_combo_box_set_active (GTK_COMBO_BOX (priv->recurse_combo), profile.max_depth+1);
@@ -240,6 +243,9 @@ void GnomeCmdSelectionProfileComponent::copy(GnomeCmdData::Selection &profile)
 
 void GnomeCmdSelectionProfileComponent::set_name_patterns_history(GList *history)
 {
+    GtkTreeModel *store = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->pattern_combo));
+    gtk_list_store_clear (GTK_LIST_STORE (store));
+
     g_list_foreach (history, (GFunc) combo_box_insert_text, priv->pattern_combo);
     gtk_combo_box_set_active (GTK_COMBO_BOX (priv->pattern_combo), 0);
 }
@@ -247,5 +253,8 @@ void GnomeCmdSelectionProfileComponent::set_name_patterns_history(GList *history
 
 void GnomeCmdSelectionProfileComponent::set_content_patterns_history(GList *history)
 {
+    GtkTreeModel *store = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->find_text_combo));
+    gtk_list_store_clear (GTK_LIST_STORE (store));
+
     g_list_foreach (history, (GFunc) combo_box_insert_text, priv->find_text_combo);
 }



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