aboutsummaryrefslogtreecommitdiffstats
path: root/filter/filter-part.c
diff options
context:
space:
mode:
Diffstat (limited to 'filter/filter-part.c')
-rw-r--r--filter/filter-part.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/filter/filter-part.c b/filter/filter-part.c
index 15e78b77b8..e92c42aafb 100644
--- a/filter/filter-part.c
+++ b/filter/filter-part.c
@@ -273,6 +273,36 @@ filter_part_clone (FilterPart *fp)
return new;
}
+/* only copies values of matching parts in the right order */
+void
+filter_part_copy_values (FilterPart *dst, FilterPart *src)
+{
+ GList *dstl, *srcl, *dstt;
+ FilterElement *de, *se;
+
+ /* NOTE: we go backwards, it just works better that way */
+
+ /* for each source type, search the dest type for
+ a matching type in the same order */
+ srcl = g_list_last(src->elements);
+ dstl = g_list_last(dst->elements);
+ while (srcl && dstl) {
+ se = srcl->data;
+ dstt = dstl;
+ while (dstt) {
+ de = dstt->data;
+ if (((GtkObject *)de)->klass == ((GtkObject *)se)->klass) {
+ filter_element_copy_value(de, se);
+ dstl = dstt->prev;
+ break;
+ }
+ dstt = dstt->prev;
+ }
+
+ srcl = srcl->prev;
+ }
+}
+
FilterElement *
filter_part_find_element (FilterPart *ff, const char *name)
{