[gnome-commander] advrename profiles: added copy() method



commit c9b2a949491c11c62327f20683fd05806a5aa960
Author: Piotr Eljasiak <epiotr src gnome org>
Date:   Sat Apr 25 22:05:37 2009 +0200

    advrename profiles: added copy() method
---
 ChangeLog                          |    6 ++++++
 src/gnome-cmd-profile-component.cc |   34 ++++++++++++++++++++++++++++++++--
 src/gnome-cmd-profile-component.h  |    3 +++
 3 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a6028d2..80e4b1d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-04-25  Piotr Eljasiak  <epiotr use pl>
+
+	* src/tags/gnome-cmd-profile-component.cc:
+	* src/tags/gnome-cmd-profile-component.h:
+	advrename profiles: added copy() method
+
 2009-04-22  Andrey Cherkinskiy
 
 	* src/gnome-cmd-user-actions.cc:
diff --git a/src/gnome-cmd-profile-component.cc b/src/gnome-cmd-profile-component.cc
index 97412fc..96b041f 100644
--- a/src/gnome-cmd-profile-component.cc
+++ b/src/gnome-cmd-profile-component.cc
@@ -938,8 +938,7 @@ static void gnome_cmd_profile_component_finalize (GObject *object)
 {
     GnomeCmdProfileComponent *component = GNOME_CMD_PROFILE_COMPONENT (object);
 
-    component->profile.template_string = component->get_template_entry();
-    copy_regex_model(component->priv->regex_model, GnomeCmdProfileComponent::COL_REGEX, component->profile.regexes);
+    component->copy();
 
     delete component->priv;
 
@@ -1143,3 +1142,34 @@ void GnomeCmdProfileComponent::set_template_history(GList *history)
     for (GList *i=history; i; i=i->next)
         gtk_combo_box_append_text (GTK_COMBO_BOX (priv->template_combo), (const gchar *) i->data);
 }
+
+
+GtkTreeModel *GnomeCmdProfileComponent::get_regex_model() const
+{
+    return priv ? priv->regex_model : NULL;
+}
+
+
+void GnomeCmdProfileComponent::copy()
+{
+    profile.template_string = get_template_entry();
+    copy_regex_model(priv->regex_model, COL_REGEX, profile.regexes);
+}
+
+
+void GnomeCmdProfileComponent::copy(GnomeCmdData::AdvrenameConfig::Profile &p)
+{
+    p.template_string = get_template_entry();
+    copy_regex_model(priv->regex_model, COL_REGEX, p.regexes);
+
+    if (&p==&profile)
+        return;
+
+    p.name.clear();
+    p.template_string = profile.template_string;
+    p.counter_start = profile.counter_start;
+    p.counter_width = profile.counter_width;
+    p.counter_step = profile.counter_step;
+    p.case_conversion = profile.case_conversion;
+    p.trim_blanks = profile.trim_blanks;
+}
diff --git a/src/gnome-cmd-profile-component.h b/src/gnome-cmd-profile-component.h
index f4e0900..81716a7 100644
--- a/src/gnome-cmd-profile-component.h
+++ b/src/gnome-cmd-profile-component.h
@@ -51,9 +51,12 @@ struct GnomeCmdProfileComponent
     ~GnomeCmdProfileComponent()     {}
 
     void update();
+    void copy();                                                    //  copies component to associated profile
+    void copy(GnomeCmdData::AdvrenameConfig::Profile &profile);     //  copies component to specified profile
 
     const gchar *get_template_entry() const;
     void set_template_history(GList *history);
+    GtkTreeModel *get_regex_model() const;
 };
 
 #endif // __GNOME_CMD_PROFILE_COMPONENT_H__



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