aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2002-08-08 10:49:56 +0800
committerMichael Zucci <zucchi@src.gnome.org>2002-08-08 10:49:56 +0800
commitf6b959c9ecc0af67fb7607de5ae6645b4f3e2cbc (patch)
treec195c9a8de9aa863523d2180197e05b127ae5de6
parentbb7325aeac8e1dbbd8bafe301681464bf7215833 (diff)
downloadgsoc2013-evolution-f6b959c9ecc0af67fb7607de5ae6645b4f3e2cbc.tar.gz
gsoc2013-evolution-f6b959c9ecc0af67fb7607de5ae6645b4f3e2cbc.tar.zst
gsoc2013-evolution-f6b959c9ecc0af67fb7607de5ae6645b4f3e2cbc.zip
Dont allow duplicate names. (edit_editor_clicked): Same here. For #24803.
2002-08-08 Not Zed <NotZed@Ximian.com> * rule-editor.c (add_editor_clicked): Dont allow duplicate names. (edit_editor_clicked): Same here. For #24803. svn path=/trunk/; revision=17739
-rw-r--r--filter/ChangeLog5
-rw-r--r--filter/rule-editor.c31
2 files changed, 34 insertions, 2 deletions
diff --git a/filter/ChangeLog b/filter/ChangeLog
index 496a401448..fa6ddced4d 100644
--- a/filter/ChangeLog
+++ b/filter/ChangeLog
@@ -1,3 +1,8 @@
+2002-08-08 Not Zed <NotZed@Ximian.com>
+
+ * rule-editor.c (add_editor_clicked): Dont allow duplicate names.
+ (edit_editor_clicked): Same here. For #24803.
+
2002-08-06 Jeffrey Stedfast <fejj@ximian.com>
* rule-context.c (save): Don't need to save temp/backup files
diff --git a/filter/rule-editor.c b/filter/rule-editor.c
index f9350ea372..9ef0084340 100644
--- a/filter/rule-editor.c
+++ b/filter/rule-editor.c
@@ -25,8 +25,9 @@
#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-i18n.h>
#include <libgnomeui/gnome-stock.h>
+#include <libgnomeui/gnome-dialog.h>
+#include <libgnomeui/gnome-dialog-util.h>
#include <glade/glade.h>
-
#include <gal/widgets/e-unicode.h>
#include <gal/util/e-unicode-i18n.h>
#include "rule-editor.h"
@@ -230,6 +231,18 @@ add_editor_clicked (GtkWidget *dialog, int button, RuleEditor *re)
/* no need to popup a dialog because the validate code does that. */
return;
}
+
+ if (rule_context_find_rule(re->context, re->edit->name, re->edit->source)) {
+ GtkWidget *dialog;
+ char *what;
+
+ what = g_strdup_printf(_("Rule name '%s' is not unique, choose another"), re->edit->name);
+ dialog = gnome_ok_dialog (what);
+ g_free(what);
+ gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
+
+ return;
+ }
gtk_object_ref (GTK_OBJECT (re->edit));
string = e_utf8_to_gtk_string (GTK_WIDGET (re->list), re->edit->name);
@@ -305,13 +318,27 @@ edit_editor_clicked (GtkWidget *dialog, int button, RuleEditor *re)
GtkWidget *item;
char *string;
int pos;
-
+ struct _FilterRule *rule;
+
switch (button) {
case 0:
if (!filter_rule_validate (re->edit)) {
/* no need to popup a dialog because the validate code does that. */
return;
}
+
+ rule = rule_context_find_rule(re->context, re->edit->name, re->edit->source);
+ if (rule != NULL && rule != re->current) {
+ GtkWidget *dialog;
+ char *what;
+
+ what = g_strdup_printf(_("Rule name '%s' is not unique, choose another"), re->edit->name);
+ dialog = gnome_ok_dialog (what);
+ g_free(what);
+ gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
+
+ return;
+ }
pos = rule_context_get_rank_rule (re->context, re->current, re->source);
if (pos != -1) {