aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2009-10-13 22:24:10 +0800
committerMilan Crha <mcrha@redhat.com>2009-10-13 22:24:10 +0800
commite06b88c4fda627599d7c1a33ddec0a35a4374e4f (patch)
treea862b4d3909923719ab03936ec60dfc00f185ba8 /mail
parentdc2953040b0fb9576411d2f145e7e6ff11dd989a (diff)
downloadgsoc2013-evolution-e06b88c4fda627599d7c1a33ddec0a35a4374e4f.tar
gsoc2013-evolution-e06b88c4fda627599d7c1a33ddec0a35a4374e4f.tar.gz
gsoc2013-evolution-e06b88c4fda627599d7c1a33ddec0a35a4374e4f.tar.bz2
gsoc2013-evolution-e06b88c4fda627599d7c1a33ddec0a35a4374e4f.tar.lz
gsoc2013-evolution-e06b88c4fda627599d7c1a33ddec0a35a4374e4f.tar.xz
gsoc2013-evolution-e06b88c4fda627599d7c1a33ddec0a35a4374e4f.tar.zst
gsoc2013-evolution-e06b88c4fda627599d7c1a33ddec0a35a4374e4f.zip
Bug #594471 - Shouldn't call e_error_new/run with NULL 'parent'
Diffstat (limited to 'mail')
-rw-r--r--mail/em-account-editor.c4
-rw-r--r--mail/em-composer-utils.c8
-rw-r--r--mail/em-filter-folder-element.c10
-rw-r--r--mail/em-filter-rule.c8
-rw-r--r--mail/em-folder-utils.c32
-rw-r--r--mail/em-vfolder-rule.c12
-rw-r--r--mail/mail-autofilter.c8
-rw-r--r--mail/mail-mt.c6
-rw-r--r--mail/mail-session.c9
-rw-r--r--mail/mail-vfolder.c21
10 files changed, 32 insertions, 86 deletions
diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c
index 8794c13a73..5b96a5f5b5 100644
--- a/mail/em-account-editor.c
+++ b/mail/em-account-editor.c
@@ -601,7 +601,7 @@ emae_display_license (EMAccountEditor *emae, CamelProvider *prov)
gtk_text_view_set_editable ((GtkTextView *)w, FALSE);
response = gtk_dialog_run ((GtkDialog *)dialog);
} else {
- e_error_run (emae->editor ? (GtkWindow *)gtk_widget_get_toplevel (emae->editor) : NULL,
+ e_error_run (emae->editor ? (GtkWindow *)gtk_widget_get_toplevel (emae->editor) : e_shell_get_active_window (NULL),
"mail:no-load-license", prov->license_file, NULL);
}
@@ -1947,7 +1947,7 @@ static void emae_check_authtype (GtkWidget *w, EMAccountEditorService *service)
uri = e_account_get_string (account, emae_service_info[service->type].account_uri_key);
g_object_ref (emae);
- service->check_dialog = e_error_new (emae->editor ? (GtkWindow *)gtk_widget_get_toplevel (emae->editor) : NULL,
+ service->check_dialog = e_error_new (emae->editor ? (GtkWindow *)gtk_widget_get_toplevel (emae->editor) : (GtkWindow *)gtk_widget_get_toplevel (w),
"mail:checking-service", NULL);
g_signal_connect (service->check_dialog, "response", G_CALLBACK(emae_check_authtype_response), service);
gtk_widget_show (service->check_dialog);
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index b5bef46383..615ead6b1b 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -28,7 +28,6 @@
#include <gtk/gtk.h>
#include <libedataserver/e-data-server-util.h>
-#include <e-util/e-util.h>
#include <glib/gi18n.h>
#include "mail-mt.h"
@@ -38,8 +37,11 @@
#include "mail-session.h"
#include "mail-send-recv.h"
-#include "e-util/e-error.h"
#include "e-util/e-account-utils.h"
+#include "e-util/e-error.h"
+#include "e-util/e-util.h"
+
+#include "shell/e-shell.h"
#include "e-mail-local.h"
#include "em-utils.h"
@@ -1406,7 +1408,7 @@ em_utils_handle_receipt (CamelFolder *folder, const gchar *uid, CamelMimeMessage
}
if (account && (account->receipt_policy == E_ACCOUNT_RECEIPT_ALWAYS || account->receipt_policy == E_ACCOUNT_RECEIPT_ASK)
- && e_error_run (NULL, "mail:ask-receipt", addr, camel_mime_message_get_subject(msg), NULL) == GTK_RESPONSE_YES)
+ && e_error_run (e_shell_get_active_window (NULL), "mail:ask-receipt", addr, camel_mime_message_get_subject(msg), NULL) == GTK_RESPONSE_YES)
em_utils_send_receipt(folder, msg);
}
diff --git a/mail/em-filter-folder-element.c b/mail/em-filter-folder-element.c
index 4af699d583..8e07ef9c8c 100644
--- a/mail/em-filter-folder-element.c
+++ b/mail/em-filter-folder-element.c
@@ -39,7 +39,7 @@
#define d(x)
-static gboolean validate(FilterElement *fe);
+static gboolean validate(FilterElement *fe, GtkWindow *error_parent);
static gint folder_eq(FilterElement *fe, FilterElement *cm);
static void xml_create(FilterElement *fe, xmlNodePtr node);
static xmlNodePtr xml_encode(FilterElement *fe);
@@ -138,18 +138,14 @@ em_filter_folder_element_set_value(EMFilterFolderElement *ff, const gchar *uri)
}
static gboolean
-validate(FilterElement *fe)
+validate(FilterElement *fe, GtkWindow *error_parent)
{
EMFilterFolderElement *ff = (EMFilterFolderElement *)fe;
if (ff->uri && *ff->uri) {
return TRUE;
} else {
- /* FIXME: FilterElement should probably have a
- GtkWidget member pointing to the value gotten with
- ::get_widget()so that we can get the parent window
- here. */
- e_error_run(NULL, "mail:no-folder", NULL);
+ e_error_run (error_parent, "mail:no-folder", NULL);
return FALSE;
}
diff --git a/mail/em-filter-rule.c b/mail/em-filter-rule.c
index 47c5e4d0d2..8e95800e7a 100644
--- a/mail/em-filter-rule.c
+++ b/mail/em-filter-rule.c
@@ -35,7 +35,7 @@
#define d(x)
-static gint validate(FilterRule *fr);
+static gint validate(FilterRule *fr, GtkWindow *error_parent);
static gint filter_eq(FilterRule *fr, FilterRule *cm);
static xmlNodePtr xml_encode(FilterRule *fr);
static gint xml_decode(FilterRule *fr, xmlNodePtr, RuleContext *rc);
@@ -172,18 +172,18 @@ em_filter_rule_build_action(EMFilterRule *fr, GString *out)
}
static gint
-validate(FilterRule *fr)
+validate(FilterRule *fr, GtkWindow *error_parent)
{
EMFilterRule *ff =(EMFilterRule *)fr;
GList *parts;
gint valid;
- valid = FILTER_RULE_CLASS(parent_class)->validate(fr);
+ valid = FILTER_RULE_CLASS(parent_class)->validate (fr, error_parent);
/* validate rule actions */
parts = ff->actions;
while (parts && valid) {
- valid = filter_part_validate((FilterPart *)parts->data);
+ valid = filter_part_validate ((FilterPart *)parts->data, error_parent);
parts = parts->next;
}
diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c
index 29272a415a..c2850daaf1 100644
--- a/mail/em-folder-utils.c
+++ b/mail/em-folder-utils.c
@@ -282,30 +282,23 @@ emfu_copy_folder_selected (const gchar *uri, gpointer data)
local_store = e_mail_local_get_store ();
if (!(fromstore = camel_session_get_store (session, cfd->fi->uri, &ex))) {
- e_error_run(NULL,
+ e_error_run (e_shell_get_active_window (NULL),
cfd->delete?"mail:no-move-folder-notexist":"mail:no-copy-folder-notexist", cfd->fi->full_name, uri, ex.desc, NULL);
goto fail;
}
if (cfd->delete && fromstore == local_store && emfu_is_special_local_folder (cfd->fi->full_name)) {
- EShell *shell;
- GtkWindow *parent;
GtkWidget *w;
- GList *windows;
-
- shell = e_shell_get_default ();
- windows = e_shell_get_watched_windows (shell);
- parent = (windows != NULL) ? GTK_WINDOW (windows->data) : NULL;
w = e_error_new (
- parent, "mail:no-rename-special-folder",
+ e_shell_get_active_window (NULL), "mail:no-rename-special-folder",
cfd->fi->full_name, NULL);
em_utils_show_error_silent (w);
goto fail;
}
if (!(tostore = camel_session_get_store (session, uri, &ex))) {
- e_error_run(NULL,
+ e_error_run (e_shell_get_active_window (NULL),
cfd->delete?"mail:no-move-folder-to-notexist":"mail:no-copy-folder-to-notexist", cfd->fi->full_name, uri, ex.desc, NULL);
goto fail;
}
@@ -410,17 +403,10 @@ emfu_delete_done (CamelFolder *folder, gboolean removed, CamelException *ex, gpo
GtkWidget *dialog = data;
if (ex && camel_exception_is_set (ex)) {
- EShell *shell;
- GtkWindow *parent;
GtkWidget *w;
- GList *windows;
-
- shell = e_shell_get_default ();
- windows = e_shell_get_watched_windows (shell);
- parent = (windows != NULL) ? GTK_WINDOW (windows->data) : NULL;
w = e_error_new (
- parent, "mail:no-delete-folder",
+ e_shell_get_active_window (NULL), "mail:no-delete-folder",
folder->full_name, camel_exception_get_description (ex), NULL);
em_utils_show_error_silent (w);
camel_exception_clear (ex);
@@ -447,17 +433,11 @@ emfu_delete_response (GtkWidget *dialog, gint response, gpointer data)
void
em_folder_utils_delete_folder (CamelFolder *folder)
{
- EShell *shell;
- GtkWindow *parent;
CamelStore *local_store;
+ GtkWindow *parent = e_shell_get_active_window (NULL);
GtkWidget *dialog;
- GList *windows;
gint flags = 0;
- shell = e_shell_get_default ();
- windows = e_shell_get_watched_windows (shell);
- parent = (windows != NULL) ? GTK_WINDOW (windows->data) : NULL;
-
local_store = e_mail_local_get_store ();
if (folder->parent_store == local_store && emfu_is_special_local_folder (folder->full_name)) {
@@ -470,7 +450,7 @@ em_folder_utils_delete_folder (CamelFolder *folder)
if (mail_folder_cache_get_folder_info_flags (folder, &flags) && (flags & CAMEL_FOLDER_SYSTEM))
{
- e_error_run(NULL,"mail:no-delete-special-folder", folder->name, NULL);
+ e_error_run (parent,"mail:no-delete-special-folder", folder->name, NULL);
return;
}
diff --git a/mail/em-vfolder-rule.c b/mail/em-vfolder-rule.c
index ea6b6f0b87..2ccbe1378d 100644
--- a/mail/em-vfolder-rule.c
+++ b/mail/em-vfolder-rule.c
@@ -43,7 +43,7 @@
#define d(x)
-static gint validate(FilterRule *);
+static gint validate(FilterRule *, GtkWindow *error_parent);
static gint vfolder_eq(FilterRule *fr, FilterRule *cm);
static xmlNodePtr xml_encode(FilterRule *);
static gint xml_decode(FilterRule *, xmlNodePtr, RuleContext *f);
@@ -207,25 +207,23 @@ em_vfolder_rule_next_source(EMVFolderRule *vr, const gchar *last)
}
static gint
-validate(FilterRule *fr)
+validate(FilterRule *fr, GtkWindow *error_parent)
{
g_return_val_if_fail(fr != NULL, 0);
if (!fr->name || !*fr->name) {
- /* FIXME: set a parent window? */
- e_error_run(NULL, "mail:no-name-vfolder", NULL);
+ e_error_run (error_parent, "mail:no-name-vfolder", NULL);
return 0;
}
/* We have to have at least one source set in the "specific" case.
Do not translate this string! */
if (((EMVFolderRule *)fr)->with == EM_VFOLDER_RULE_WITH_SPECIFIC && ((EMVFolderRule *)fr)->sources == NULL) {
- /* FIXME: set a parent window? */
- e_error_run(NULL, "mail:vfolder-no-source", NULL);
+ e_error_run (error_parent, "mail:vfolder-no-source", NULL);
return 0;
}
- return FILTER_RULE_CLASS(parent_class)->validate(fr);
+ return FILTER_RULE_CLASS(parent_class)->validate (fr, error_parent);
}
static gint
diff --git a/mail/mail-autofilter.c b/mail/mail-autofilter.c
index 02fbbfbbc7..cf6575d0c5 100644
--- a/mail/mail-autofilter.c
+++ b/mail/mail-autofilter.c
@@ -420,10 +420,7 @@ mail_filter_delete_uri(CamelStore *store, const gchar *uri)
deleted = rule_context_delete_uri ((RuleContext *) fc, euri, g_str_equal);
if (deleted) {
- EShell *shell;
- GtkWindow *parent;
GtkWidget *dialog;
- GList *windows;
GString *s;
GList *l;
@@ -434,10 +431,7 @@ mail_filter_delete_uri(CamelStore *store, const gchar *uri)
l = l->next;
}
- shell = e_shell_get_default ();
- windows = e_shell_get_watched_windows (shell);
- parent = (windows != NULL) ? GTK_WINDOW (windows->data) : NULL;
- dialog = e_error_new(parent, "mail:filter-updated", s->str, euri, NULL);
+ dialog = e_error_new (e_shell_get_active_window (NULL), "mail:filter-updated", s->str, euri, NULL);
g_string_free(s, TRUE);
em_utils_show_info_silent (dialog);
diff --git a/mail/mail-mt.c b/mail/mail-mt.c
index 011697b76a..16d593c0f3 100644
--- a/mail/mail-mt.c
+++ b/mail/mail-mt.c
@@ -292,12 +292,10 @@ static void error_response(GtkObject *o, gint button, gpointer data)
void
mail_msg_check_error (gpointer msg)
{
- EShell *shell;
GtkWindow *parent;
MailMsg *m = msg;
gchar *what;
GtkDialog *gd;
- GList *windows;
#ifdef MALLOC_CHECK
checkmem(m);
@@ -325,9 +323,7 @@ mail_msg_check_error (gpointer msg)
return;
}
- shell = e_shell_get_default ();
- windows = e_shell_get_watched_windows (shell);
- parent = (windows != NULL) ? GTK_WINDOW (windows->data) : NULL;
+ parent = e_shell_get_active_window (NULL);
if (m->info->desc
&& (what = m->info->desc (m))) {
diff --git a/mail/mail-session.c b/mail/mail-session.c
index 2d1a1ff1c1..2b6f902a20 100644
--- a/mail/mail-session.c
+++ b/mail/mail-session.c
@@ -322,9 +322,6 @@ user_message_response (GtkDialog *dialog, gint button, struct _user_message_msg
static void
user_message_exec (struct _user_message_msg *m)
{
- EShell *shell;
- GtkWindow *parent;
- GList *windows;
const gchar *error_type;
if (!m->ismain && user_message_dialog != NULL) {
@@ -353,12 +350,8 @@ user_message_exec (struct _user_message_msg *m)
g_return_if_reached ();
}
- shell = e_shell_get_default ();
- windows = e_shell_get_watched_windows (shell);
- parent = (windows != NULL) ? GTK_WINDOW (windows->data) : NULL;
-
user_message_dialog = e_error_new (
- parent, error_type, m->prompt, NULL);
+ e_shell_get_active_window (NULL), error_type, m->prompt, NULL);
g_object_set (
user_message_dialog, "allow_shrink", TRUE,
"allow_grow", TRUE, NULL);
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c
index 69ba7d4d98..b20cc266f2 100644
--- a/mail/mail-vfolder.c
+++ b/mail/mail-vfolder.c
@@ -600,17 +600,11 @@ done:
UNLOCK();
if (changed->str[0]) {
- EShell *shell;
- GtkWindow *parent;
GtkWidget *dialog;
- GList *windows;
const gchar *data_dir;
gchar *user;
- shell = e_shell_get_default ();
- windows = e_shell_get_watched_windows (shell);
- parent = (windows != NULL) ? GTK_WINDOW (windows->data) : NULL;
- dialog = e_error_new (parent, "mail:vfolder-updated", changed->str, uri, NULL);
+ dialog = e_error_new (e_shell_get_active_window (NULL), "mail:vfolder-updated", changed->str, uri, NULL);
em_utils_show_info_silent (dialog);
data_dir = em_utils_get_data_dir ();
@@ -1101,17 +1095,10 @@ vfolder_edit_rule(const gchar *uri)
g_signal_connect(gd, "response", G_CALLBACK(edit_rule_response), NULL);
gtk_widget_show((GtkWidget *)gd);
} else {
- EShell *shell;
- GtkWindow *parent;
GtkWidget *w;
- GList *windows;
-
- shell = e_shell_get_default ();
- windows = e_shell_get_watched_windows (shell);
- parent = (windows != NULL) ? GTK_WINDOW (windows->data) : NULL;
/* TODO: we should probably just create it ... */
- w = e_error_new(parent, "mail:vfolder-notexist", uri, NULL);
+ w = e_error_new (e_shell_get_active_window (NULL), "mail:vfolder-notexist", uri, NULL);
em_utils_show_error_silent (w);
}
@@ -1127,13 +1114,13 @@ new_rule_clicked(GtkWidget *w, gint button, gpointer data)
gchar *user;
FilterRule *rule = g_object_get_data((GObject *)w, "rule");
- if (!filter_rule_validate(rule)) {
+ if (!filter_rule_validate (rule, GTK_WINDOW (w))) {
/* no need to popup a dialog because the validate code does that. */
return;
}
if (rule_context_find_rule ((RuleContext *)context, rule->name, rule->source)) {
- e_error_run((GtkWindow *)w, "mail:vfolder-notunique", rule->name, NULL);
+ e_error_run ((GtkWindow *)w, "mail:vfolder-notunique", rule->name, NULL);
return;
}