diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2001-03-22 08:14:29 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-03-22 08:14:29 +0800 |
commit | aedb33b3af7c5c01aa220fe3ab51a111a31c8922 (patch) | |
tree | f1192601bc43a0b61b003080602431e14be5e289 | |
parent | a517acfa3905829e5587c756c046bce8c9c1c241 (diff) | |
download | gsoc2013-evolution-aedb33b3af7c5c01aa220fe3ab51a111a31c8922.tar gsoc2013-evolution-aedb33b3af7c5c01aa220fe3ab51a111a31c8922.tar.gz gsoc2013-evolution-aedb33b3af7c5c01aa220fe3ab51a111a31c8922.tar.bz2 gsoc2013-evolution-aedb33b3af7c5c01aa220fe3ab51a111a31c8922.tar.lz gsoc2013-evolution-aedb33b3af7c5c01aa220fe3ab51a111a31c8922.tar.xz 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
-rw-r--r-- | filter/ChangeLog | 5 | ||||
-rw-r--r-- | filter/filter-rule.c | 5 | ||||
-rw-r--r-- | filter/rule-context.c | 22 | ||||
-rw-r--r-- | filter/rule-editor.c | 5 |
4 files changed, 24 insertions, 13 deletions
diff --git a/filter/ChangeLog b/filter/ChangeLog index f8b925c390..353ca7bdd8 100644 --- a/filter/ChangeLog +++ b/filter/ChangeLog @@ -1,3 +1,8 @@ +2001-03-21 Jeffrey Stedfast <fejj@ximian.com> + + * rule-context.c (new_rule_clicked): Validate the rule before + closing. + 2001-03-20 Jeffrey Stedfast <fejj@ximian.com> * rule-editor.c (rule_edit): Set the editor dialog modal rather diff --git a/filter/filter-rule.c b/filter/filter-rule.c index e63e7df5fd..44dbeb0b1a 100644 --- a/filter/filter-rule.c +++ b/filter/filter-rule.c @@ -176,7 +176,8 @@ filter_rule_set_source (FilterRule *fr, const char *source) fr->source = g_strdup (source); } -int filter_rule_validate (FilterRule *fr) +int +filter_rule_validate (FilterRule *fr) { g_assert(IS_FILTER_RULE(fr)); @@ -184,7 +185,7 @@ int filter_rule_validate (FilterRule *fr) } static int -validate(FilterRule *fr) +validate (FilterRule *fr) { int valid = TRUE; GList *parts; 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)); } } diff --git a/filter/rule-editor.c b/filter/rule-editor.c index 0098f959e9..4826cdf01c 100644 --- a/filter/rule-editor.c +++ b/filter/rule-editor.c @@ -190,7 +190,7 @@ add_editor_clicked (GtkWidget *dialog, int button, RuleEditor *re) switch (button) { case 0: if (!filter_rule_validate (re->edit)) { - /* FIXME: popup an error or somelthing? */ + /* no need to popup a dialog because the validate code does that. */ return; } @@ -255,7 +255,7 @@ edit_editor_clicked (GtkWidget *dialog, int button, RuleEditor *re) switch (button) { case 0: if (!filter_rule_validate (re->edit)) { - /* FIXME: popup an error or something? */ + /* no need to popup a dialog because the validate code does that. */ return; } @@ -471,4 +471,3 @@ rule_editor_construct(RuleEditor *re, RuleContext *context, GladeXML *gui, const gnome_dialog_append_buttons((GnomeDialog *)re, GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL, 0); } - |