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



Author: epiotr
Date: Sat Nov 29 14:55:07 2008
New Revision: 2325
URL: http://svn.gnome.org/viewvc/gnome-commander?rev=2325&view=rev

Log:
Added AdvrenameConfig::fill_regex_model(Profile &)

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

Modified: branches/gcmd-1-3/src/gnome-cmd-data.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-data.cc	(original)
+++ branches/gcmd-1-3/src/gnome-cmd-data.cc	Sat Nov 29 14:55:07 2008
@@ -101,6 +101,29 @@
 }
 
 
+void GnomeCmdData::AdvrenameConfig::fill_regex_model(Profile &profile)
+{
+    if (!regexes)
+        return;
+
+    GtkTreeIter iter;
+
+    for (vector<Profile::Regex>::const_iterator r=profile.regexes.begin(); r!=profile.regexes.end(); ++r)
+    {
+        GnomeCmdAdvrenameDialog::Regex *rx = new GnomeCmdAdvrenameDialog::Regex(r->pattern.c_str(), r->replace.c_str(), r->match_case);
+
+        gtk_list_store_append (GTK_LIST_STORE (regexes), &iter);
+        gtk_list_store_set (GTK_LIST_STORE (regexes), &iter,
+                            GnomeCmdAdvrenameDialog::COL_REGEX, rx,
+                            GnomeCmdAdvrenameDialog::COL_MALFORMED_REGEX, !*rx,
+                            GnomeCmdAdvrenameDialog::COL_PATTERN, r->pattern.c_str(),
+                            GnomeCmdAdvrenameDialog::COL_REPLACE, r->replace.c_str(),
+                            GnomeCmdAdvrenameDialog::COL_MATCH_CASE, r->match_case ? _("Yes") : _("No"),
+                            -1);
+    }
+}
+
+
 inline gint get_int (const gchar *path, int def)
 {
     gboolean b = FALSE;

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	Sat Nov 29 14:55:07 2008
@@ -103,6 +103,8 @@
         AdvrenameConfig(): width(600), height(400),
                            templates(ADVRENAME_HISTORY_SIZE), regexes(NULL)    {}
         ~AdvrenameConfig()          {  if (regexes)  g_object_unref (regexes);  }
+
+        void fill_regex_model(Profile &profile);
     };
 
     struct IntViewerConfig

Modified: branches/gcmd-1-3/src/gnome-cmd-xml-config.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-xml-config.cc	(original)
+++ branches/gcmd-1-3/src/gnome-cmd-xml-config.cc	Sat Nov 29 14:55:07 2008
@@ -468,24 +468,8 @@
 
                 if (p!=cfg->advrename_defaults.profiles.end())
                 {
-                    GtkTreeIter iter;
-
                     cfg->advrename_defaults.default_profile = *p;
-
-                    for (std::vector<GnomeCmdData::AdvrenameConfig::Profile::Regex>::const_iterator r=p->regexes.begin(); r!=p->regexes.end(); ++r)
-                    {
-                        GnomeCmdAdvrenameDialog::Regex *rx = new GnomeCmdAdvrenameDialog::Regex(r->pattern.c_str(),r->replace.c_str(), r->match_case);
-
-                        gtk_list_store_append (GTK_LIST_STORE (cfg->advrename_defaults.regexes), &iter);
-                        gtk_list_store_set (GTK_LIST_STORE (cfg->advrename_defaults.regexes), &iter,
-                                            GnomeCmdAdvrenameDialog::COL_REGEX, rx,
-                                            GnomeCmdAdvrenameDialog::COL_MALFORMED_REGEX, !*rx,
-                                            GnomeCmdAdvrenameDialog::COL_PATTERN, r->pattern.c_str(),
-                                            GnomeCmdAdvrenameDialog::COL_REPLACE, r->replace.c_str(),
-                                            GnomeCmdAdvrenameDialog::COL_MATCH_CASE, r->match_case ? _("Yes") : _("No"),
-                                            -1);
-                    }
-
+                    cfg->advrename_defaults.fill_regex_model(*p);
                     cfg->advrename_defaults.profiles.erase(p);
                 }
             }



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