[evolution-patches] fix for bug #41578



http://bugzilla.ximian.com/show_bug.cgi?id=41578

since vfolder rule sources are "local", "specific-folders", etc... it
does not make sense to get the rank specific to the source-type for
vfolders.

Jeff

-- 
Jeffrey Stedfast
Evolution Hacker - Ximian, Inc.
fejj ximian com  - www.ximian.com
? 41578.patch
? filters.dtd
? pipe-filter-action.patch
? searchtypes.xml
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/filter/ChangeLog,v
retrieving revision 1.365
diff -u -r1.365 ChangeLog
--- ChangeLog	23 Apr 2003 01:23:42 -0000	1.365
+++ ChangeLog	24 Apr 2003 18:31:51 -0000
@@ -1,3 +1,20 @@
+2003-04-24  Jeffrey Stedfast  <fejj ximian com>
+
+	Fix for bug #41578.
+
+	* rule-editor.c (rule_move): Pass re->source instead of
+	re->current->source to rule_context_get_rank_rule(). Also updated
+	to pass re->source to rule_context_rank_rule().
+	(rule_editor_play_undo): Updated to pass re->source to
+	rule_context_rank_rule().
+
+	* rule-context.c (rule_context_rank_rule): Now takes a 'source'
+	argument rather than using rule->source (vfolder editor lists
+	rules of all sources, not just same-source rules).
+	(revert): Pass frule->source/part->source to
+	rule_context_rank_rule() - might not be right but should preserve
+	the prior behaviour at least.
+
 2003-04-18  Not Zed  <NotZed Ximian com>
 
 	* rule-editor.c (d): removed debug spew.
Index: rule-context.c
===================================================================
RCS file: /cvs/gnome/evolution/filter/rule-context.c,v
retrieving revision 1.47
diff -u -r1.47 rule-context.c
--- rule-context.c	18 Mar 2003 08:21:34 -0000	1.47
+++ rule-context.c	24 Apr 2003 18:31:52 -0000
@@ -542,11 +542,11 @@
 								filter_rule_copy(frule, part);
 							
 							g_object_unref(part);
-							rule_context_rank_rule(rc, frule, rest_data->rank);
+							rule_context_rank_rule(rc, frule, frule->source, rest_data->rank);
 							g_hash_table_remove(rest_data->rules, frule->name);
 						} else {
 							rule_context_add_rule(rc, part);
-							rule_context_rank_rule(rc, part, rest_data->rank);
+							rule_context_rank_rule(rc, part, part->source, rest_data->rank);
 						}
 						rest_data->rank++;
 					} else {
@@ -733,7 +733,7 @@
 }
 
 void
-rule_context_rank_rule(RuleContext *rc, FilterRule *rule, int rank)
+rule_context_rank_rule(RuleContext *rc, FilterRule *rule, const char *source, int rank)
 {
 	GList *node;
 	int i = 0, index = 0;
@@ -741,7 +741,7 @@
 	g_assert(rc);
 	g_assert(rule);
 	
-	if (rule_context_get_rank_rule(rc, rule, rule->source) == rank)
+	if (rule_context_get_rank_rule (rc, rule, source) == rank)
 		return;
 	
 	rc->rules = g_list_remove(rc->rules, rule);
@@ -758,7 +758,7 @@
 		}
 		
 		index++;		
-		if (rule->source == NULL || (r->source && strcmp(r->source, rule->source) == 0))
+		if (source == NULL || (r->source && strcmp(r->source, source) == 0))
 			i++;
 		
 		node = node->next;
Index: rule-context.h
===================================================================
RCS file: /cvs/gnome/evolution/filter/rule-context.h,v
retrieving revision 1.22
diff -u -r1.22 rule-context.h
--- rule-context.h	13 Nov 2002 09:31:06 -0000	1.22
+++ rule-context.h	24 Apr 2003 18:31:52 -0000
@@ -118,7 +118,7 @@
 void rule_context_remove_rule (RuleContext *rc, FilterRule *rule);
 
 /* get/set the rank (position) of a rule */
-void rule_context_rank_rule (RuleContext *rc, FilterRule *rule, int rank);
+void rule_context_rank_rule (RuleContext *rc, FilterRule *rule, const char *source, int rank);
 int rule_context_get_rank_rule (RuleContext *rc, FilterRule *rule, const char *source);
 
 /* setup type for set parts */
Index: rule-editor.c
===================================================================
RCS file: /cvs/gnome/evolution/filter/rule-editor.c,v
retrieving revision 1.53
diff -u -r1.53 rule-editor.c
--- rule-editor.c	23 Apr 2003 01:23:42 -0000	1.53
+++ rule-editor.c	24 Apr 2003 18:31:53 -0000
@@ -37,7 +37,7 @@
 void rule_editor_add_undo (RuleEditor *re, int type, FilterRule *rule, int rank, int newrank);
 void rule_editor_play_undo (RuleEditor *re);
 
-#define d(x) 
+#define d(x)
 
 static void set_source (RuleEditor *re, const char *source);
 static void set_sensitive (RuleEditor *re);
@@ -445,10 +445,10 @@
 	
 	g_object_ref (re->current);
 	rule_editor_add_undo (re, RULE_EDITOR_LOG_RANK, re->current,
-			      rule_context_get_rank_rule (re->context, re->current, re->current->source), to);
+			      rule_context_get_rank_rule (re->context, re->current, re->source), to);
 	
 	d(printf ("moving %d to %d\n", from, to));
-	rule_context_rank_rule (re->context, re->current, to);
+	rule_context_rank_rule (re->context, re->current, re->source, to);
 	
 	path = gtk_tree_path_new ();
 	gtk_tree_path_append_index (path, from);
@@ -630,12 +630,12 @@
 			d(printf ("Undoing remove on rule '%s'\n", undo->rule->name));
 			g_object_ref (undo->rule);
 			rule_context_add_rule (re->context, undo->rule);
-			rule_context_rank_rule (re->context, undo->rule, undo->rank);
+			rule_context_rank_rule (re->context, undo->rule, re->source, undo->rank);
 			break;
 		case RULE_EDITOR_LOG_RANK:
 			rule = rule_context_find_rank_rule (re->context, undo->newrank, undo->rule->source);
 			if (rule)
-				rule_context_rank_rule (re->context, rule, undo->rank);
+				rule_context_rank_rule (re->context, rule, re->source, undo->rank);
 			break;
 		}
 		


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