aboutsummaryrefslogtreecommitdiffstats
path: root/filter/rule-context.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-03-22 08:14:29 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-03-22 08:14:29 +0800
commitaedb33b3af7c5c01aa220fe3ab51a111a31c8922 (patch)
treef1192601bc43a0b61b003080602431e14be5e289 /filter/rule-context.c
parenta517acfa3905829e5587c756c046bce8c9c1c241 (diff)
downloadgsoc2013-evolution-aedb33b3af7c5c01aa220fe3ab51a111a31c8922.tar.gz
gsoc2013-evolution-aedb33b3af7c5c01aa220fe3ab51a111a31c8922.tar.zst
gsoc2013-evolution-aedb33b3af7c5c01aa220fe3ab51a111a31c8922.zip
Validate the rule before closing.
2001-03-21 Jeffrey Stedfast <fejj@ximian.com> * rule-context.c (new_rule_clicked): Validate the rule before closing. svn path=/trunk/; revision=8879
Diffstat (limited to 'filter/rule-context.c')
-rw-r--r--filter/rule-context.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/filter/rule-context.c b/filter/rule-context.c
index 386e2cb7ab..1133bc1f63 100644
--- a/filter/rule-context.c
+++ b/filter/rule-context.c
@@ -363,23 +363,29 @@ rule_context_add_rule(RuleContext * f, FilterRule * new)
}
static void
-new_rule_clicked(GtkWidget * w, int button, RuleContext * context)
+new_rule_clicked (GtkWidget *dialog, int button, RuleContext *context)
{
#ifndef NO_WARNINGS
#warning "Need a changed signal for this to work best"
#endif
if (button == 0) {
- FilterRule *rule = gtk_object_get_data((GtkObject *) w, "rule");
- char *user = gtk_object_get_data((GtkObject *) w, "path");
-
- gtk_object_ref((GtkObject *) rule);
- rule_context_add_rule(context, rule);
+ FilterRule *rule = gtk_object_get_data (GTK_OBJECT (dialog), "rule");
+ char *user = gtk_object_get_data (GTK_OBJECT (dialog), "path");
+
+ if (!filter_rule_validate (rule)) {
+ /* no need to popup a dialog because the validate code does that. */
+ return;
+ }
+
+ gtk_object_ref (GTK_OBJECT (rule));
+ rule_context_add_rule (context, rule);
if (user) {
- rule_context_save((RuleContext *) context, user);
+ rule_context_save ((RuleContext *) context, user);
}
}
+
if (button != -1) {
- gnome_dialog_close((GnomeDialog *) w);
+ gnome_dialog_close (GNOME_DIALOG (dialog));
}
}