aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--filter/ChangeLog6
-rw-r--r--filter/Makefile.am6
-rw-r--r--filter/filter-datespec.c11
-rw-r--r--filter/filter-file.c21
-rw-r--r--filter/filter-folder.c10
-rw-r--r--filter/filter-input.c11
-rw-r--r--filter/filter-option.c2
-rw-r--r--filter/filter-rule.c10
-rw-r--r--filter/rule-context.c10
-rw-r--r--filter/rule-editor.c22
-rw-r--r--filter/vfolder-rule.c21
11 files changed, 34 insertions, 96 deletions
diff --git a/filter/ChangeLog b/filter/ChangeLog
index 529ce0998e..0c7e6ef18d 100644
--- a/filter/ChangeLog
+++ b/filter/ChangeLog
@@ -1,3 +1,9 @@
+2004-04-28 Not Zed <NotZed@Ximian.com>
+
+ * filter-option.c (filter_option_add): fix a warning.
+
+ ** Changed error messages to use EError.
+
2004-03-31 Not Zed <NotZed@Ximian.com>
* filter.glade: renamed filter_label to rule_label, and removed
diff --git a/filter/Makefile.am b/filter/Makefile.am
index ba72e9933a..502e543a5c 100644
--- a/filter/Makefile.am
+++ b/filter/Makefile.am
@@ -70,6 +70,7 @@ libfilter_la_DEPENDENCIES = libfilter-i18n.h
EXTRA_DIST = \
$(glade_DATA) \
+ $(error_in_files) \
ChangeLog.pre-1-4 \
filter-marshal.list \
filtertypes.xml \
@@ -81,6 +82,11 @@ EXTRA_DIST = \
filterdir = $(privdatadir)
filter_DATA = filtertypes.xml vfoldertypes.xml searchtypes.xml
+error_in_files = filter-errors.xml.in
+error_DATA = $(error_in_files:.xml.in=.xml)
+errordir = $(privdatadir)/errors
+@INTLTOOL_XML_RULE@
+
libfilter-i18n.h: filtertypes.xml vfoldertypes.xml
echo "/* Automatically generated. Do not edit. */" > $@; \
cat $(srcdir)/filtertypes.xml $(srcdir)/vfoldertypes.xml | \
diff --git a/filter/filter-datespec.c b/filter/filter-datespec.c
index f913b20ed8..6aa0b9cfc6 100644
--- a/filter/filter-datespec.c
+++ b/filter/filter-datespec.c
@@ -20,7 +20,6 @@
* Boston, MA 02111-1307, USA.
*/
-
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -36,6 +35,7 @@
#include "filter-datespec.h"
#include "e-util/e-sexp.h"
+#include "widgets/misc/e-error.h"
#define d(x)
@@ -173,7 +173,6 @@ static gboolean
validate (FilterElement *fe)
{
FilterDatespec *fds = (FilterDatespec *) fe;
- GtkWidget *dialog;
gboolean valid;
valid = fds->type != FDST_UNKNOWN;
@@ -182,13 +181,7 @@ validate (FilterElement *fe)
GtkWidget member pointing to the value gotten with
::get_widget() so that we can get the parent window
here. */
- dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
- "%s", _("You must choose a date."));
-
- gtk_dialog_set_has_separator ((GtkDialog *) dialog, FALSE);
- gtk_dialog_run ((GtkDialog *) dialog);
- gtk_widget_destroy (dialog);
+ e_error_run(NULL, "filter:no-date", NULL);
}
return valid;
diff --git a/filter/filter-file.c b/filter/filter-file.c
index 2a79fdc172..e163cb0562 100644
--- a/filter/filter-file.c
+++ b/filter/filter-file.c
@@ -35,6 +35,7 @@
#include "filter-file.h"
#include "e-util/e-sexp.h"
+#include "widgets/misc/e-error.h"
#define d(x)
@@ -153,7 +154,6 @@ static gboolean
validate (FilterElement *fe)
{
FilterFile *file = (FilterFile *) fe;
- GtkWidget *dialog;
struct stat st;
if (!file->path) {
@@ -161,14 +161,8 @@ validate (FilterElement *fe)
GtkWidget member pointing to the value gotten with
::get_widget() so that we can get the parent window
here. */
- dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
- "%s", _("You must specify a file name."));
-
- gtk_dialog_set_has_separator ((GtkDialog *) dialog, FALSE);
- gtk_dialog_run ((GtkDialog *) dialog);
- gtk_widget_destroy (dialog);
-
+ e_error_run(NULL, "filter:no-file", NULL);
+
return FALSE;
}
@@ -180,14 +174,7 @@ validate (FilterElement *fe)
GtkWidget member pointing to the value gotten with
::get_widget() so that we can get the parent window
here. */
- dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
- _("File '%s' does not exist or is not a regular file."),
- file->path);
-
- gtk_dialog_set_has_separator ((GtkDialog *) dialog, FALSE);
- gtk_dialog_run ((GtkDialog *) dialog);
- gtk_widget_destroy (dialog);
+ e_error_run(NULL, "filter:bad-file", file->path, NULL);
return FALSE;
}
diff --git a/filter/filter-folder.c b/filter/filter-folder.c
index a2489e030b..95e85efa32 100644
--- a/filter/filter-folder.c
+++ b/filter/filter-folder.c
@@ -34,6 +34,7 @@
#include "mail/em-folder-selection-button.h"
#include "mail/mail-component.h"
#include "e-util/e-sexp.h"
+#include "widgets/misc/e-error.h"
#define d(x)
@@ -139,7 +140,6 @@ static gboolean
validate (FilterElement *fe)
{
FilterFolder *ff = (FilterFolder *) fe;
- GtkWidget *dialog;
if (ff->uri && *ff->uri) {
return TRUE;
@@ -148,14 +148,8 @@ validate (FilterElement *fe)
GtkWidget member pointing to the value gotten with
::get_widget() so that we can get the parent window
here. */
- dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
- "%s", _("You must specify a folder."));
+ e_error_run(NULL, "filter:no-folder", NULL);
- gtk_dialog_set_has_separator ((GtkDialog *) dialog, FALSE);
- gtk_dialog_run ((GtkDialog *) dialog);
- gtk_widget_destroy (dialog);
-
return FALSE;
}
}
diff --git a/filter/filter-input.c b/filter/filter-input.c
index ff5afe5337..021aa54a28 100644
--- a/filter/filter-input.c
+++ b/filter/filter-input.c
@@ -34,6 +34,7 @@
#include "filter-input.h"
#include "e-util/e-sexp.h"
+#include "widgets/misc/e-error.h"
#define d(x)
@@ -165,7 +166,6 @@ validate (FilterElement *fe)
{
FilterInput *fi = (FilterInput *)fe;
gboolean valid = TRUE;
- GtkWidget *dialog;
if (fi->values && !strcmp (fi->type, "regex")) {
const char *pattern;
@@ -188,14 +188,7 @@ validate (FilterElement *fe)
GtkWidget member pointing to the value gotten with
::get_widget() so that we can get the parent window
here. */
- dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
- _("Error in regular expression '%s':\n%s"),
- pattern, regmsg);
-
- gtk_dialog_set_has_separator ((GtkDialog *) dialog, FALSE);
- gtk_dialog_run ((GtkDialog *) dialog);
- gtk_widget_destroy (dialog);
+ e_error_run(NULL, "filter:bad-regexp", pattern, regmsg, NULL);
g_free (regmsg);
valid = FALSE;
diff --git a/filter/filter-option.c b/filter/filter-option.c
index 7d1530620d..73296cd86d 100644
--- a/filter/filter-option.c
+++ b/filter/filter-option.c
@@ -169,7 +169,7 @@ filter_option_add(FilterOption *fo, const char *value, const char *title, const
struct _filter_option *op;
g_assert(IS_FILTER_OPTION(fo));
- g_return_if_fail(find_option(fo, value) == NULL);
+ g_return_val_if_fail(find_option(fo, value) == NULL, NULL);
op = g_malloc(sizeof(*op));
op->title = g_strdup(title);
diff --git a/filter/filter-rule.c b/filter/filter-rule.c
index bd5f0f26d6..8b90fffee0 100644
--- a/filter/filter-rule.c
+++ b/filter/filter-rule.c
@@ -30,6 +30,7 @@
#include <gtk/gtk.h>
#include <libgnome/gnome-i18n.h>
+#include "widgets/misc/e-error.h"
#include "filter-rule.h"
#include "filter-context.h"
#include "filter-marshal.h"
@@ -205,7 +206,6 @@ filter_rule_validate (FilterRule *fr)
static int
validate (FilterRule *fr)
{
- GtkWidget *dialog;
int valid = TRUE;
GList *parts;
@@ -214,13 +214,7 @@ validate (FilterRule *fr)
GtkWidget member pointing to the value gotten with
::get_widget() so that we can get the parent window
here. */
- dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
- "%s", _("You must name this filter."));
-
- gtk_dialog_set_has_separator ((GtkDialog *) dialog, FALSE);
- gtk_dialog_run ((GtkDialog *) dialog);
- gtk_widget_destroy (dialog);
+ e_error_run(NULL, "filter:no-name", NULL);
return FALSE;
}
diff --git a/filter/rule-context.c b/filter/rule-context.c
index 07a3775e3e..61fa4cbf1b 100644
--- a/filter/rule-context.c
+++ b/filter/rule-context.c
@@ -35,6 +35,7 @@
#include <gtk/gtk.h>
#include <libgnome/gnome-i18n.h>
#include <gal/util/e-xml-utils.h>
+#include "widgets/misc/e-error.h"
#include "rule-context.h"
#include "filter-rule.h"
@@ -677,14 +678,7 @@ new_rule_response(GtkWidget *dialog, int button, RuleContext *context)
}
if (rule_context_find_rule (context, rule->name, rule->source)) {
- dialog = gtk_message_dialog_new ((GtkWindow *) dialog, GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
- _("Rule name '%s' is not unique, choose another."),
- rule->name);
-
- gtk_dialog_set_has_separator ((GtkDialog *) dialog, FALSE);
- gtk_dialog_run ((GtkDialog *) dialog);
- gtk_widget_destroy (dialog);
+ e_error_run((GtkWindow *)dialog, "filter:bad-name-notunique", rule->name, NULL);
return;
}
diff --git a/filter/rule-editor.c b/filter/rule-editor.c
index a868e25d73..907f1f917e 100644
--- a/filter/rule-editor.c
+++ b/filter/rule-editor.c
@@ -27,9 +27,11 @@
/* for getenv only, remove when getenv need removed */
#include <stdlib.h>
+#include <string.h>
#include <libgnome/gnome-i18n.h>
+#include "widgets/misc/e-error.h"
#include "rule-editor.h"
static int enable_undo = 0;
@@ -234,15 +236,7 @@ add_editor_response (GtkWidget *dialog, int button, RuleEditor *re)
}
if (rule_context_find_rule (re->context, re->edit->name, re->edit->source)) {
- dialog = gtk_message_dialog_new ((GtkWindow *) dialog, GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
- _("Rule name '%s' is not unique, choose another."),
- re->edit->name);
-
- gtk_dialog_set_has_separator ((GtkDialog *) dialog, FALSE);
- gtk_dialog_run ((GtkDialog *) dialog);
- gtk_widget_destroy (dialog);
-
+ e_error_run((GtkWindow *)dialog, "filter:bad-name-notunique", re->edit->name, NULL);
return;
}
@@ -320,15 +314,7 @@ edit_editor_response (GtkWidget *dialog, int button, RuleEditor *re)
rule = rule_context_find_rule (re->context, re->edit->name, re->edit->source);
if (rule != NULL && rule != re->current) {
- dialog = gtk_message_dialog_new ((GtkWindow *) dialog,
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
- _("Rule name '%s' is not unique, choose another."),
- re->edit->name);
-
- gtk_dialog_set_has_separator ((GtkDialog *) dialog, FALSE);
- gtk_dialog_run ((GtkDialog *) dialog);
- gtk_widget_destroy (dialog);
+ e_error_run((GtkWindow *)dialog, "filter:bad-name-notunique", rule->name, NULL);
return;
}
diff --git a/filter/vfolder-rule.c b/filter/vfolder-rule.c
index c71b9558de..21ff2e409c 100644
--- a/filter/vfolder-rule.c
+++ b/filter/vfolder-rule.c
@@ -37,6 +37,7 @@
#include "mail/em-folder-tree.h"
#include "mail/em-folder-selector.h"
#include "mail/mail-component.h"
+#include "widgets/misc/e-error.h"
#define d(x)
@@ -204,20 +205,11 @@ vfolder_rule_next_source (VfolderRule *vr, const char *last)
static int
validate (FilterRule *fr)
{
- GtkWidget *dialog;
-
g_return_val_if_fail (fr != NULL, FALSE);
if (!fr->name || !*fr->name) {
/* FIXME: set a aprent window? */
- dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
- "%s", _("You must name this vfolder."));
-
- gtk_dialog_set_has_separator ((GtkDialog *) dialog, FALSE);
- gtk_dialog_run ((GtkDialog *) dialog);
- gtk_widget_destroy (dialog);
-
+ e_error_run(NULL, "filter:no-name-vfolder", NULL);
return 0;
}
@@ -225,14 +217,7 @@ validate (FilterRule *fr)
Do not translate this string! */
if (((VfolderRule *)fr)->with == VFOLDER_RULE_WITH_SPECIFIC && ((VfolderRule *)fr)->sources == NULL) {
/* FIXME: set a parent window? */
- dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
- "%s", _("You need to to specify at least one folder as a source."));
-
- gtk_dialog_set_has_separator ((GtkDialog *) dialog, FALSE);
- gtk_dialog_run ((GtkDialog *) dialog);
- gtk_widget_destroy (dialog);
-
+ e_error_run(NULL, "filter:vfolder-no-source", NULL);
return 0;
}