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



commit ea56e40bd9c7560adc01643e6232cab2039204e7
Author: Piotr Eljasiak <epiotr src gnome org>
Date:   Tue Jul 26 22:17:40 2011 +0200

    advrename: store 'Default' profile modifications between sesions

 src/dialogs/gnome-cmd-advrename-dialog.cc    |    6 ++----
 src/gnome-cmd-advrename-profile-component.cc |    5 +++++
 2 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/src/dialogs/gnome-cmd-advrename-dialog.cc b/src/dialogs/gnome-cmd-advrename-dialog.cc
index 8f2b73d..4de5133 100644
--- a/src/dialogs/gnome-cmd-advrename-dialog.cc
+++ b/src/dialogs/gnome-cmd-advrename-dialog.cc
@@ -468,13 +468,14 @@ void GnomeCmdAdvrenameDialog::Private::on_dialog_response (GnomeCmdAdvrenameDial
             }
             dialog->update_new_filenames();
             dialog->defaults.templates.add(dialog->priv->profile_component->get_template_entry());
+            dialog->priv->profile_component->set_template_history(dialog->defaults.templates.ents);
             break;
 
         case GTK_RESPONSE_NONE:
         case GTK_RESPONSE_DELETE_EVENT:
         case GTK_RESPONSE_CANCEL:
         case GTK_RESPONSE_CLOSE:
-            dialog->defaults.templates.add(dialog->priv->profile_component->get_template_entry());
+            dialog->priv->profile_component->copy();
             gtk_widget_hide (*dialog);
             dialog->unset();
             g_signal_stop_emission_by_name (dialog, "response");        //  FIXME:  ???
@@ -697,9 +698,6 @@ GnomeCmdAdvrenameDialog::GnomeCmdAdvrenameDialog(GnomeCmdData::AdvrenameConfig &
     gtk_box_pack_start (GTK_BOX (priv->vbox), *priv->profile_component, FALSE, FALSE, 0);
     gtk_box_reorder_child (GTK_BOX (priv->vbox), *priv->profile_component, 0);
 
-    // Template
-    priv->profile_component->set_template_history(defaults.templates.ents);
-
     // Results
     files = create_files_model ();
 
diff --git a/src/gnome-cmd-advrename-profile-component.cc b/src/gnome-cmd-advrename-profile-component.cc
index 70bedfd..6c4c579 100644
--- a/src/gnome-cmd-advrename-profile-component.cc
+++ b/src/gnome-cmd-advrename-profile-component.cc
@@ -1241,6 +1241,8 @@ inline GtkWidget *create_regex_view ()
 
 void GnomeCmdAdvrenameProfileComponent::update()
 {
+    set_template_history(gnome_cmd_data.advrename_defaults.templates.ents);
+
     gtk_entry_set_text (GTK_ENTRY (priv->template_entry), profile.template_string.empty() ? "$N" : profile.template_string.c_str());
     gtk_editable_set_position (GTK_EDITABLE (priv->template_entry), -1);
     gtk_editable_select_region (GTK_EDITABLE (priv->template_entry), -1, -1);
@@ -1275,6 +1277,9 @@ const gchar *GnomeCmdAdvrenameProfileComponent::get_template_entry() const
 
 void GnomeCmdAdvrenameProfileComponent::set_template_history(GList *history)
 {
+    GtkTreeModel *store = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->template_combo));
+    gtk_list_store_clear (GTK_LIST_STORE (store));
+
     for (GList *i=history; i; i=i->next)
         gtk_combo_box_append_text (GTK_COMBO_BOX (priv->template_combo), (const gchar *) i->data);
 }



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