diff options
Diffstat (limited to 'filter')
-rw-r--r-- | filter/ChangeLog | 17 | ||||
-rw-r--r-- | filter/rule-context.c | 10 | ||||
-rw-r--r-- | filter/rule-context.h | 2 | ||||
-rw-r--r-- | filter/rule-editor.c | 10 |
4 files changed, 28 insertions, 11 deletions
diff --git a/filter/ChangeLog b/filter/ChangeLog index ce45dac51c..9d3eb2cf08 100644 --- a/filter/ChangeLog +++ b/filter/ChangeLog @@ -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. diff --git a/filter/rule-context.c b/filter/rule-context.c index a131db6d63..a1751b6e62 100644 --- a/filter/rule-context.c +++ b/filter/rule-context.c @@ -542,11 +542,11 @@ revert(RuleContext *rc, const char *user) 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 @@ rule_context_remove_rule(RuleContext *rc, FilterRule *rule) } 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 @@ rule_context_rank_rule(RuleContext *rc, FilterRule *rule, int rank) 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 @@ rule_context_rank_rule(RuleContext *rc, FilterRule *rule, int rank) } 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; diff --git a/filter/rule-context.h b/filter/rule-context.h index 9a7fcae837..6e7a7f9443 100644 --- a/filter/rule-context.h +++ b/filter/rule-context.h @@ -118,7 +118,7 @@ void rule_context_add_rule_gui (RuleContext *rc, FilterRule *rule, const char *t 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 */ diff --git a/filter/rule-editor.c b/filter/rule-editor.c index 05c1fd3589..32f368a06b 100644 --- a/filter/rule-editor.c +++ b/filter/rule-editor.c @@ -37,7 +37,7 @@ static int enable_undo = 0; 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 @@ rule_move (RuleEditor *re, int from, int to) 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 @@ rule_editor_play_undo (RuleEditor *re) 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; } |