From 962307293176c46e0f39ac9c0639eacf584a50c4 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Tue, 18 Mar 2003 08:31:28 +0000 Subject: validate rule & rule is unique. Workaround for #39464. Should this just 2003-03-18 Not Zed * mail-vfolder.c (new_rule_clicked): validate rule & rule is unique. Workaround for #39464. Should this just use rule_context_add_rule_gui?? svn path=/trunk/; revision=20333 --- mail/ChangeLog | 4 ++++ mail/mail-vfolder.c | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index 82c62c60b4..c2cb4a3252 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,5 +1,9 @@ 2003-03-18 Not Zed + * mail-vfolder.c (new_rule_clicked): validate rule & rule is + unique. Workaround for #39464. Should this just use + rule_context_add_rule_gui?? + * mail-search.c (mail_search_destroy): unhook from the html engine signals here, before we redisplay the message. Also make sure this processing only happens once. For #39759. diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c index d8f30087d6..de90ffac19 100644 --- a/mail/mail-vfolder.c +++ b/mail/mail-vfolder.c @@ -903,6 +903,25 @@ new_rule_clicked(GtkWidget *w, int button, void *data) char *user; FilterRule *rule = g_object_get_data((GObject *)w, "rule"); + if (!filter_rule_validate(rule)) { + /* no need to popup a dialog because the validate code does that. */ + return; + } + + if (rule_context_find_rule ((RuleContext *)context, rule->name, rule->source)) { + GtkWidget *dialog = + gtk_message_dialog_new ((GtkWindow *) w, GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, + _("Rule name '%s' is not unique, choose another."), + rule->name); + + gtk_dialog_run ((GtkDialog *) dialog); + gtk_widget_destroy (dialog); + + return; + } + + g_object_ref(rule); rule_context_add_rule((RuleContext *)context, rule); user = g_strdup_printf("%s/vfolders.xml", evolution_dir); -- cgit