aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-11-13 08:57:10 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-11-13 08:57:10 +0800
commit8d4f7dd527a290483ae4456bc23cd4a9ee0cf4e7 (patch)
tree8c9a74146d49e5b19a1166aa828710de03900046
parent6f6b1c0af0b8a7bf1a87a0b2089a88059423da38 (diff)
downloadgsoc2013-evolution-8d4f7dd527a290483ae4456bc23cd4a9ee0cf4e7.tar
gsoc2013-evolution-8d4f7dd527a290483ae4456bc23cd4a9ee0cf4e7.tar.gz
gsoc2013-evolution-8d4f7dd527a290483ae4456bc23cd4a9ee0cf4e7.tar.bz2
gsoc2013-evolution-8d4f7dd527a290483ae4456bc23cd4a9ee0cf4e7.tar.lz
gsoc2013-evolution-8d4f7dd527a290483ae4456bc23cd4a9ee0cf4e7.tar.xz
gsoc2013-evolution-8d4f7dd527a290483ae4456bc23cd4a9ee0cf4e7.tar.zst
gsoc2013-evolution-8d4f7dd527a290483ae4456bc23cd4a9ee0cf4e7.zip
Force the user to name the filter.
2001-11-12 Jeffrey Stedfast <fejj@ximian.com> * 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
-rw-r--r--filter/ChangeLog6
-rw-r--r--filter/filter-rule.c12
-rw-r--r--filter/vfolder-rule.c26
3 files changed, 35 insertions, 9 deletions
diff --git a/filter/ChangeLog b/filter/ChangeLog
index 3f2cf98c34..d8a32ea80b 100644
--- a/filter/ChangeLog
+++ b/filter/ChangeLog
@@ -1,3 +1,9 @@
+2001-11-12 Jeffrey Stedfast <fejj@ximian.com>
+
+ * filter-rule.c (validate): Force the user to name the filter.
+
+ * vfolder-rule.c (validate): Force the user to name the vfolder.
+
2001-10-29 <NotZed@Ximian.com>
* rule-editor.c: Some debug printf fixes for printf's that dont
diff --git a/filter/filter-rule.c b/filter/filter-rule.c
index 5a4b28d5f7..2f8fd76047 100644
--- a/filter/filter-rule.c
+++ b/filter/filter-rule.c
@@ -31,6 +31,8 @@
#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 <gal/widgets/e-unicode.h>
#include "filter-rule.h"
@@ -209,6 +211,16 @@ validate (FilterRule *fr)
int valid = TRUE;
GList *parts;
+ if (!fr->name || !*fr->name) {
+ GtkWidget *dialog;
+
+ dialog = gnome_ok_dialog (_("You must name this filter."));
+
+ gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
+
+ return FALSE;
+ }
+
/* validate rule parts */
parts = fr->parts;
while (parts && valid) {
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;
}