gnome-commander r2351 - in branches/gcmd-1-3: . src



Author: epiotr
Date: Thu Dec 11 22:36:14 2008
New Revision: 2351
URL: http://svn.gnome.org/viewvc/gnome-commander?rev=2351&view=rev

Log:
advrename: fix for profile saving

Modified:
   branches/gcmd-1-3/ChangeLog
   branches/gcmd-1-3/src/gnome-cmd-advrename-dialog.cc
   branches/gcmd-1-3/src/gnome-cmd-data.h

Modified: branches/gcmd-1-3/src/gnome-cmd-advrename-dialog.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-advrename-dialog.cc	(original)
+++ branches/gcmd-1-3/src/gnome-cmd-advrename-dialog.cc	Thu Dec 11 22:36:14 2008
@@ -578,8 +578,26 @@
 
     GnomeCmdData::AdvrenameConfig &cfg = GNOME_CMD_ADVRENAME_DIALOG(dialog)->defaults;
 
-    cfg.default_profile.template_string = gtk_entry_get_text (GTK_ENTRY (priv->template_entry));
-    if (cfg.default_profile.template_string.empty())  cfg.default_profile.template_string = "$N";
+    if (new_profile)
+    {
+        GtkTreeIter i;
+
+        cfg.default_profile.template_string = gtk_entry_get_text (GTK_ENTRY (priv->template_entry));
+        if (cfg.default_profile.template_string.empty())  cfg.default_profile.template_string = "$N";
+
+        cfg.default_profile.regexes.clear();
+
+        for (gboolean valid_iter=gtk_tree_model_get_iter_first (cfg.regexes, &i); valid_iter; valid_iter=gtk_tree_model_iter_next (cfg.regexes, &i))
+        {
+            Regex *r;
+
+            gtk_tree_model_get (cfg.regexes, &i,
+                                COL_REGEX, &r,
+                                -1);
+            if (r)                            //  ignore null regex patterns
+                cfg.default_profile.regexes.push_back(GnomeCmdData::AdvrenameConfig::Profile::Regex(r->from, r->to, r->case_sensitive));
+        }
+    }
 
     if (gnome_cmd_advrename_profiles_dialog_new (_("Profiles"), GTK_WINDOW (dialog), cfg,  new_profile))
     {
@@ -617,6 +635,8 @@
 
     GNOME_CMD_ADVRENAME_DIALOG(dialog)->update_new_filenames();
 
+    cfg.default_profile = p;
+
     gtk_widget_set_sensitive (priv->regex_edit_button, !model_is_empty(cfg.regexes));
     gtk_widget_set_sensitive (priv->regex_remove_button, !model_is_empty(cfg.regexes));
     gtk_widget_set_sensitive (priv->regex_remove_all_button, !model_is_empty(cfg.regexes));
@@ -1027,7 +1047,6 @@
             dialog->defaults.templates.add(gtk_entry_get_text (GTK_ENTRY (dialog->priv->template_entry)));
             break;
 
-
         case GTK_RESPONSE_NONE:
         case GTK_RESPONSE_DELETE_EVENT:
         case GTK_RESPONSE_CANCEL:

Modified: branches/gcmd-1-3/src/gnome-cmd-data.h
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-data.h	(original)
+++ branches/gcmd-1-3/src/gnome-cmd-data.h	Thu Dec 11 22:36:14 2008
@@ -70,9 +70,12 @@
                 gboolean match_case;
 
                 Regex(): match_case(FALSE)   {}
+                Regex(const std::string &from, const std::string &to, gboolean _match_case): pattern(from),
+                                                                                             replace(to),
+                                                                                             match_case(_match_case)  {}
                 Regex(const gchar *from, const gchar *to, gboolean _match_case): pattern(from),
-                                                                                replace(to),
-                                                                                match_case(_match_case)  {}
+                                                                                 replace(to),
+                                                                                 match_case(_match_case)  {}
             };
 
             std::string name;



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