From 8d4f7dd527a290483ae4456bc23cd4a9ee0cf4e7 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Tue, 13 Nov 2001 00:57:10 +0000 Subject: Force the user to name the filter. 2001-11-12 Jeffrey Stedfast * filter-rule.c (validate): Force the user to name the filter. * vfolder-rule.c (validate): Force the user to name the vfolder. svn path=/trunk/; revision=14679 --- filter/vfolder-rule.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'filter/vfolder-rule.c') diff --git a/filter/vfolder-rule.c b/filter/vfolder-rule.c index 4980151a42..f940747c71 100644 --- a/filter/vfolder-rule.c +++ b/filter/vfolder-rule.c @@ -196,21 +196,29 @@ vfolder_rule_next_source (VfolderRule *vr, const char *last) static gint validate (FilterRule *fr) { + GtkWidget *dialog; + + g_return_val_if_fail (fr != NULL, FALSE); + + if (!fr->name || !*fr->name) { + dialog = gnome_ok_dialog (_("You must name this vfolder.")); + gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); + + return 0; + } + /* We have to have at least one source set in the "specific" case. Do not translate this string! */ - if (fr && fr->source && !strcmp (fr->source, "specific") && VFOLDER_RULE (fr)->sources == NULL) { - - GtkWidget *gd; - - gd = gnome_ok_dialog (_("You need to to specify at least one folder as a source.")); - gnome_dialog_run_and_close (GNOME_DIALOG (gd)); - + if (fr->source && !strcmp (fr->source, "specific") && VFOLDER_RULE (fr)->sources == NULL) { + dialog = gnome_ok_dialog (_("You need to to specify at least one folder as a source.")); + gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); + return 0; } - + if (FILTER_RULE_CLASS (parent_class)->validate) return FILTER_RULE_CLASS (parent_class)->validate (fr); - + return 1; } -- cgit v1.2.3