From c2ee0afbc85ce3ddf38ec07497c0cdae4f42a7fc Mon Sep 17 00:00:00 2001 From: Jonathon Jongsma Date: Mon, 30 Nov 2009 11:34:43 -0600 Subject: Rename EError to EAlert to match general use better The EError mechanism is used both for error dialogs as well as basic alerts or user prompts, so we should give it a more general name which matches this use. This patch also cleans up a few includes of e-alert.h (formerly e-error.h) that were not actually being used. https://bugzilla.gnome.org/show_bug.cgi?id=602963 --- filter/e-filter-datespec.c | 10 +++++----- filter/e-filter-element.c | 6 +++--- filter/e-filter-element.h | 6 +++--- filter/e-filter-file.c | 14 +++++++------- filter/e-filter-input.c | 10 +++++----- filter/e-filter-part.c | 4 ++-- filter/e-filter-part.h | 7 +++++-- filter/e-filter-rule.c | 22 +++++++++++----------- filter/e-filter-rule.h | 4 ++-- filter/e-rule-context.c | 12 ++++++------ filter/e-rule-editor.c | 22 +++++++++++----------- 11 files changed, 60 insertions(+), 57 deletions(-) (limited to 'filter') diff --git a/filter/e-filter-datespec.c b/filter/e-filter-datespec.c index f85de14953..00aaad7e01 100644 --- a/filter/e-filter-datespec.c +++ b/filter/e-filter-datespec.c @@ -33,7 +33,7 @@ #include #include -#include "e-util/e-error.h" +#include "e-util/e-alert.h" #include "e-util/e-util.h" #include "e-util/e-util-private.h" @@ -299,17 +299,17 @@ button_clicked (GtkButton *button, EFilterDatespec *fds) static gboolean filter_datespec_validate (EFilterElement *element, - EError **error) + EAlert **alert) { EFilterDatespec *fds = E_FILTER_DATESPEC (element); gboolean valid; - g_warn_if_fail (error == NULL || *error == NULL); + g_warn_if_fail (alert == NULL || *alert == NULL); valid = fds->type != FDST_UNKNOWN; if (!valid) { - if (error) - *error = e_error_new ("filter:no-date", NULL); + if (alert) + *alert = e_alert_new ("filter:no-date", NULL); } return valid; diff --git a/filter/e-filter-element.c b/filter/e-filter-element.c index 2165ea22c9..61ca68295c 100644 --- a/filter/e-filter-element.c +++ b/filter/e-filter-element.c @@ -42,7 +42,7 @@ static gpointer parent_class; static gboolean filter_element_validate (EFilterElement *element, - EError **error) + EAlert **alert) { return TRUE; } @@ -249,7 +249,7 @@ e_filter_element_new (void) gboolean e_filter_element_validate (EFilterElement *element, - EError **error) + EAlert **alert) { EFilterElementClass *class; @@ -258,7 +258,7 @@ e_filter_element_validate (EFilterElement *element, class = E_FILTER_ELEMENT_GET_CLASS (element); g_return_val_if_fail (class->validate != NULL, FALSE); - return class->validate (element, error); + return class->validate (element, alert); } gint diff --git a/filter/e-filter-element.h b/filter/e-filter-element.h index e7abc77d6f..9abd83ca0a 100644 --- a/filter/e-filter-element.h +++ b/filter/e-filter-element.h @@ -27,7 +27,7 @@ #include #include #include -#include +#include #define E_TYPE_FILTER_ELEMENT \ (e_filter_element_get_type ()) @@ -69,7 +69,7 @@ struct _EFilterElementClass { GObjectClass parent_class; gboolean (*validate) (EFilterElement *element, - EError **error); + EAlert **alert); gint (*eq) (EFilterElement *element_a, EFilterElement *element_b); @@ -96,7 +96,7 @@ EFilterElement *e_filter_element_new (void); void e_filter_element_set_data (EFilterElement *element, gpointer data); gboolean e_filter_element_validate (EFilterElement *element, - EError **error); + EAlert **alert); gint e_filter_element_eq (EFilterElement *element_a, EFilterElement *element_b); void e_filter_element_xml_create (EFilterElement *element, diff --git a/filter/e-filter-file.c b/filter/e-filter-file.c index b518f91f1b..2a622f8e93 100644 --- a/filter/e-filter-file.c +++ b/filter/e-filter-file.c @@ -31,7 +31,7 @@ #include -#include "e-util/e-error.h" +#include "e-util/e-alert.h" #include "e-filter-file.h" #include "e-filter-part.h" @@ -65,15 +65,15 @@ filter_file_finalize (GObject *object) static gboolean filter_file_validate (EFilterElement *element, - EError **error) + EAlert **alert) { EFilterFile *file = E_FILTER_FILE (element); - g_warn_if_fail (error == NULL || *error == NULL); + g_warn_if_fail (alert == NULL || *alert == NULL); if (!file->path) { - if (error) - *error = e_error_new ("filter:no-file", NULL); + if (alert) + *alert = e_alert_new ("filter:no-file", NULL); return FALSE; } @@ -81,8 +81,8 @@ filter_file_validate (EFilterElement *element, if (g_strcmp0 (file->type, "file") == 0) { if (!g_file_test (file->path, G_FILE_TEST_IS_REGULAR)) { - if (error) - *error = e_error_new ( "filter:bad-file", + if (alert) + *alert = e_alert_new ( "filter:bad-file", file->path, NULL); return FALSE; } diff --git a/filter/e-filter-input.c b/filter/e-filter-input.c index 9166d9272f..f8315d99e3 100644 --- a/filter/e-filter-input.c +++ b/filter/e-filter-input.c @@ -34,7 +34,7 @@ #include -#include "e-util/e-error.h" +#include "e-util/e-alert.h" #include "e-filter-input.h" @@ -70,12 +70,12 @@ filter_input_finalize (GObject *object) static gboolean filter_input_validate (EFilterElement *element, - EError **error) + EAlert **alert) { EFilterInput *input = E_FILTER_INPUT (element); gboolean valid = TRUE; - g_warn_if_fail (error == NULL || *error == NULL); + g_warn_if_fail (alert == NULL || *alert == NULL); if (input->values && !strcmp (input->type, "regex")) { const gchar *pattern; @@ -85,7 +85,7 @@ filter_input_validate (EFilterElement *element, pattern = input->values->data; if ((regerr = regcomp (®expat, pattern, REG_EXTENDED | REG_NEWLINE | REG_ICASE))) { - if (error) { + if (alert) { gsize reglen; gchar *regmsg; @@ -95,7 +95,7 @@ filter_input_validate (EFilterElement *element, regmsg = g_malloc0 (reglen + 1); regerror (regerr, ®expat, regmsg, reglen); - *error = e_error_new ("filter:bad-regexp", + *alert = e_alert_new ("filter:bad-regexp", pattern, regmsg, NULL); g_free (regmsg); } diff --git a/filter/e-filter-part.c b/filter/e-filter-part.c index 3128f58d31..a999b8adb6 100644 --- a/filter/e-filter-part.c +++ b/filter/e-filter-part.c @@ -105,7 +105,7 @@ e_filter_part_new (void) gboolean e_filter_part_validate (EFilterPart *part, - EError **error) + EAlert **alert) { GList *link; @@ -115,7 +115,7 @@ e_filter_part_validate (EFilterPart *part, for (link = part->elements; link != NULL; link = g_list_next (link)) { EFilterElement *element = link->data; - if (!e_filter_element_validate (element, error)) + if (!e_filter_element_validate (element, alert)) return FALSE; } diff --git a/filter/e-filter-part.h b/filter/e-filter-part.h index fe1f3cc8cf..dcf1e8b4ca 100644 --- a/filter/e-filter-part.h +++ b/filter/e-filter-part.h @@ -25,7 +25,10 @@ #define E_FILTER_PART_H #include -#include "e-filter-input.h" +#include +#include +#include "e-util/e-alert.h" +#include "e-filter-element.h" /* Standard GObject macros */ #define E_TYPE_FILTER_PART \ @@ -71,7 +74,7 @@ struct _EFilterPartClass { GType e_filter_part_get_type (void); EFilterPart * e_filter_part_new (void); gboolean e_filter_part_validate (EFilterPart *part, - EError **error); + EAlert **alert); gint e_filter_part_eq (EFilterPart *part_a, EFilterPart *part_b); gint e_filter_part_xml_create (EFilterPart *part, diff --git a/filter/e-filter-rule.c b/filter/e-filter-rule.c index fb496a5b87..61d6270ab1 100644 --- a/filter/e-filter-rule.c +++ b/filter/e-filter-rule.c @@ -30,7 +30,7 @@ #include #include -#include "e-util/e-error.h" +#include "e-util/e-alert.h" #include "e-filter-rule.h" #include "e-rule-context.h" @@ -239,12 +239,12 @@ more_parts (GtkWidget *button, if (data->rule->parts) { EFilterPart *part; GList *l; - EError *error = NULL; + EAlert *alert = NULL; l = g_list_last (data->rule->parts); part = l->data; - if (!e_filter_part_validate (part, &error)) { - e_error_run_dialog (GTK_WINDOW (gtk_widget_get_toplevel (button)), error); + if (!e_filter_part_validate (part, &alert)) { + e_alert_run_dialog (GTK_WINDOW (gtk_widget_get_toplevel (button)), alert); return; } } @@ -356,15 +356,15 @@ filter_rule_finalize (GObject *object) static gint filter_rule_validate (EFilterRule *rule, - EError **error) + EAlert **alert) { gint valid = TRUE; GList *parts; - g_warn_if_fail (error == NULL || *error == NULL); + g_warn_if_fail (alert == NULL || *alert == NULL); if (!rule->name || !*rule->name) { - if (error) - *error = e_error_new ("filter:no-name", NULL); + if (alert) + *alert = e_alert_new ("filter:no-name", NULL); return FALSE; } @@ -373,7 +373,7 @@ filter_rule_validate (EFilterRule *rule, parts = rule->parts; valid = parts != NULL; while (parts && valid) { - valid = e_filter_part_validate ((EFilterPart *) parts->data, error); + valid = e_filter_part_validate ((EFilterPart *) parts->data, alert); parts = parts->next; } @@ -912,7 +912,7 @@ e_filter_rule_set_source (EFilterRule *rule, gint e_filter_rule_validate (EFilterRule *rule, - EError **error) + EAlert **alert) { EFilterRuleClass *class; @@ -921,7 +921,7 @@ e_filter_rule_validate (EFilterRule *rule, class = E_FILTER_RULE_GET_CLASS (rule); g_return_val_if_fail (class->validate != NULL, FALSE); - return class->validate (rule, error); + return class->validate (rule, alert); } gint diff --git a/filter/e-filter-rule.h b/filter/e-filter-rule.h index 5f0c9a519f..924fb14074 100644 --- a/filter/e-filter-rule.h +++ b/filter/e-filter-rule.h @@ -96,7 +96,7 @@ struct _EFilterRuleClass { /* virtual methods */ gint (*validate) (EFilterRule *rule, - EError **error); + EAlert **alert); gint (*eq) (EFilterRule *rule_a, EFilterRule *rule_b); @@ -126,7 +126,7 @@ void e_filter_rule_set_name (EFilterRule *rule, void e_filter_rule_set_source (EFilterRule *rule, const gchar *source); gint e_filter_rule_validate (EFilterRule *rule, - EError **error); + EAlert **alert); gint e_filter_rule_eq (EFilterRule *rule_a, EFilterRule *rule_b); xmlNodePtr e_filter_rule_xml_encode (EFilterRule *rule); diff --git a/filter/e-rule-context.c b/filter/e-rule-context.c index 67a1df2293..2ad1acc3c2 100644 --- a/filter/e-rule-context.c +++ b/filter/e-rule-context.c @@ -40,7 +40,7 @@ #include -#include "e-util/e-error.h" +#include "e-util/e-alert.h" #include "e-util/e-xml-utils.h" #include "e-filter-code.h" @@ -92,15 +92,15 @@ new_rule_response (GtkWidget *dialog, if (button == GTK_RESPONSE_OK) { EFilterRule *rule = g_object_get_data ((GObject *) dialog, "rule"); gchar *user = g_object_get_data ((GObject *) dialog, "path"); - EError *error = NULL; + EAlert *alert = NULL; - if (!e_filter_rule_validate (rule, &error)) { - e_error_run_dialog (GTK_WINDOW (dialog), error); - e_error_free (error); + if (!e_filter_rule_validate (rule, &alert)) { + e_alert_run_dialog (GTK_WINDOW (dialog), alert); + e_alert_free (alert); } if (e_rule_context_find_rule (context, rule->name, rule->source)) { - e_error_run_dialog_for_args ((GtkWindow *)dialog, + e_alert_run_dialog_for_args ((GtkWindow *)dialog, "filter:bad-name-notunique", rule->name, NULL); diff --git a/filter/e-rule-editor.c b/filter/e-rule-editor.c index a919fad7d0..c6170f09e8 100644 --- a/filter/e-rule-editor.c +++ b/filter/e-rule-editor.c @@ -31,7 +31,7 @@ #include -#include "e-util/e-error.h" +#include "e-util/e-alert.h" #include "e-util/e-util-private.h" #include "e-util/e-util.h" @@ -143,15 +143,15 @@ add_editor_response (GtkWidget *dialog, gint button, ERuleEditor *editor) GtkTreeIter iter; if (button == GTK_RESPONSE_OK) { - EError *error = NULL; - if (!e_filter_rule_validate (editor->edit, &error)) { - e_error_run_dialog (GTK_WINDOW (dialog), error); - e_error_free (error); + EAlert *alert = NULL; + if (!e_filter_rule_validate (editor->edit, &alert)) { + e_alert_run_dialog (GTK_WINDOW (dialog), alert); + e_alert_free (alert); return; } if (e_rule_context_find_rule (editor->context, editor->edit->name, editor->edit->source)) { - e_error_run_dialog_for_args ((GtkWindow *)dialog, + e_alert_run_dialog_for_args ((GtkWindow *)dialog, "filter:bad-name-notunique", editor->edit->name, NULL); return; @@ -291,16 +291,16 @@ edit_editor_response (GtkWidget *dialog, gint button, ERuleEditor *editor) gint pos; if (button == GTK_RESPONSE_OK) { - EError *error = NULL; - if (!e_filter_rule_validate (editor->edit, &error)) { - e_error_run_dialog (GTK_WINDOW (dialog), error); - e_error_free (error); + EAlert *alert = NULL; + if (!e_filter_rule_validate (editor->edit, &alert)) { + e_alert_run_dialog (GTK_WINDOW (dialog), alert); + e_alert_free (alert); return; } rule = e_rule_context_find_rule (editor->context, editor->edit->name, editor->edit->source); if (rule != NULL && rule != editor->current) { - e_error_run_dialog_for_args ((GtkWindow *)dialog, + e_alert_run_dialog_for_args ((GtkWindow *)dialog, "filter:bad-name-notunique", rule->name, NULL); -- cgit