2011-11-24 [pawel] 3.7.10cvs103
authorPaweł Pękala <c0rn@gazeta.pl>
Thu, 24 Nov 2011 16:52:11 +0000 (16:52 +0000)
committerPaweł Pękala <c0rn@gazeta.pl>
Thu, 24 Nov 2011 16:52:11 +0000 (16:52 +0000)
* src/prefs_filtering.c
Complete cvs102, forgot to commit this

ChangeLog
PATCHSETS
configure.ac
src/prefs_filtering.c

index 3259133..6d34d92 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-11-24 [pawel]     3.7.10cvs103
+
+       * src/prefs_filtering.c
+               Complete cvs102, forgot to commit this
+
 2011-11-24 [pawel]     3.7.10cvs102
 
        * src/account.c
index d56a356..d49df66 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.1.2.24 -r 1.1.2.25 src/gtk/gtkcmctree.c;  ) > 3.7.10cvs100.patchset
 ( cvs diff -u -r 1.1.2.25 -r 1.1.2.26 src/gtk/gtkcmctree.c;  ) > 3.7.10cvs101.patchset
 ( cvs diff -u -r 1.61.2.103 -r 1.61.2.104 src/account.c;  cvs diff -u -r 1.60.2.59 -r 1.60.2.60 src/filtering.c;  cvs diff -u -r 1.21.2.20 -r 1.21.2.21 src/filtering.h;  cvs diff -u -r 1.1.2.67 -r 1.1.2.68 src/imap_gtk.c;  cvs diff -u -r 1.2.2.39 -r 1.2.2.40 src/mh_gtk.c;  cvs diff -u -r 1.60.2.77 -r 1.60.2.78 src/prefs_actions.c;  cvs diff -u -r 1.5.2.7 -r 1.5.2.8 src/prefs_actions.h;  ) > 3.7.10cvs102.patchset
+( cvs diff -u -r 1.59.2.87 -r 1.59.2.88 src/prefs_filtering.c;  ) > 3.7.10cvs103.patchset
index d3d1841..61f95da 100644 (file)
@@ -12,7 +12,7 @@ MINOR_VERSION=7
 MICRO_VERSION=10
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=102
+EXTRA_VERSION=103
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index cb0f70d..c973a2d 100644 (file)
@@ -646,97 +646,13 @@ void prefs_filtering_rename_path(const gchar *old_path, const gchar *new_path)
 static void rename_path(GSList * filters,
                        const gchar * old_path, const gchar * new_path)
 {
-       gchar *base;
-       gchar *prefix;
-       gchar *suffix;
-       gchar *dest_path;
-       gchar *old_path_with_sep;
-       gint destlen;
-       gint prefixlen;
-       gint oldpathlen;
-        GSList * action_cur;
         GSList * cur;
-       const gchar *separator=G_DIR_SEPARATOR_S;
-       gboolean matched = FALSE;
-#ifdef G_OS_WIN32
-again:
-#endif
-       oldpathlen = strlen(old_path);
-       old_path_with_sep = g_strconcat(old_path,separator,NULL);
 
        for (cur = filters; cur != NULL; cur = cur->next) {
                FilteringProp   *filtering = (FilteringProp *)cur->data;
-                
-                for(action_cur = filtering->action_list ; action_cur != NULL ;
-                    action_cur = action_cur->next) {
-
-                        FilteringAction *action = action_cur->data;
-                        
-                        if (action->type == MATCHACTION_SET_TAG ||
-                           action->type == MATCHACTION_UNSET_TAG)
-                               continue;
-                        if (!action->destination) 
-                               continue;
-                        
-                        destlen = strlen(action->destination);
-                        
-                        if (destlen > oldpathlen) {
-                                prefixlen = destlen - oldpathlen;
-                                suffix = action->destination + prefixlen;
-                                
-                                if (!strncmp(old_path, suffix, oldpathlen)) {
-                                        prefix = g_malloc0(prefixlen + 1);
-                                        strncpy2(prefix, action->destination, prefixlen);
-                                        
-                                        base = suffix + oldpathlen;
-                                        while (*base == G_DIR_SEPARATOR) base++;
-                                        if (*base == '\0')
-                                                dest_path = g_strconcat(prefix,
-                                                    separator,
-                                                    new_path, NULL);
-                                        else
-                                                dest_path = g_strconcat(prefix,
-                                                    separator,
-                                                    new_path,
-                                                    separator,
-                                                    base, NULL);
-                                        
-                                        g_free(prefix);
-                                        g_free(action->destination);
-                                        action->destination = dest_path;
-                                       matched = TRUE;
-                                } else { /* for non-leaf folders */
-                                        /* compare with trailing slash */
-                                        if (!strncmp(old_path_with_sep, action->destination, oldpathlen+1)) {
-                                                
-                                                suffix = action->destination + oldpathlen + 1;
-                                                dest_path = g_strconcat(new_path,
-                                                    separator,
-                                                    suffix, NULL);
-                                                g_free(action->destination);
-                                                action->destination = dest_path;
-                                               matched = TRUE;
-                                        }
-                                }
-                        } else {
-                                /* folder-moving a leaf */
-                                if (!strcmp(old_path, action->destination)) {
-                                        dest_path = g_strdup(new_path);
-                                        g_free(action->destination);
-                                        action->destination = dest_path;
-                                       matched = TRUE;
-                                }
-                        }
-                }
+               filtering_action_list_rename_path(filtering->action_list,
+                                                 old_path, new_path);
         }
-       
-       g_free(old_path_with_sep);
-#ifdef G_OS_WIN32
-       if (!strcmp(separator, G_DIR_SEPARATOR_S) && !matched) {
-               separator = "/";
-               goto again;
-       }
-#endif
 }
 
 static gboolean prefs_filtering_rename_path_func(GNode *node, gpointer data)