aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-09-05 05:07:15 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-09-05 05:07:15 +0800
commit983fce5e535e4e203815767cf6899f6dc8c5242a (patch)
treed6ca3538c046798597275132c66be6da18733d7f /mail
parentc95a226217a68703c48397c23ea8accc491d44e4 (diff)
downloadgsoc2013-evolution-983fce5e535e4e203815767cf6899f6dc8c5242a.tar
gsoc2013-evolution-983fce5e535e4e203815767cf6899f6dc8c5242a.tar.gz
gsoc2013-evolution-983fce5e535e4e203815767cf6899f6dc8c5242a.tar.bz2
gsoc2013-evolution-983fce5e535e4e203815767cf6899f6dc8c5242a.tar.lz
gsoc2013-evolution-983fce5e535e4e203815767cf6899f6dc8c5242a.tar.xz
gsoc2013-evolution-983fce5e535e4e203815767cf6899f6dc8c5242a.tar.zst
gsoc2013-evolution-983fce5e535e4e203815767cf6899f6dc8c5242a.zip
Kill the default parent window hack in e-error.c.
Fix as many cases that relied on it as I could find, but there may be more cases out there. They should be fixed too. Passing a NULL parent window to e_error_new() is illegal and will emit a runtime warning.
Diffstat (limited to 'mail')
-rw-r--r--mail/em-folder-utils.c41
-rw-r--r--mail/mail-autofilter.c8
-rw-r--r--mail/mail-mt.c11
-rw-r--r--mail/mail-session.c10
-rw-r--r--mail/mail-vfolder.c18
5 files changed, 76 insertions, 12 deletions
diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c
index 700e445beb..0379607bc0 100644
--- a/mail/em-folder-utils.c
+++ b/mail/em-folder-utils.c
@@ -290,8 +290,18 @@ emfu_copy_folder_selected (const gchar *uri, gpointer data)
}
if (cfd->delete && fromstore == local_store && emfu_is_special_local_folder (cfd->fi->full_name)) {
- GtkWidget *w = e_error_new (NULL,
- "mail:no-rename-special-folder", cfd->fi->full_name, NULL);
+ 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",
+ cfd->fi->full_name, NULL);
em_utils_show_error_silent (w);
goto fail;
}
@@ -379,8 +389,18 @@ emfu_delete_done (CamelFolder *folder, gboolean removed, CamelException *ex, gpo
GtkWidget *dialog = data;
if (ex && camel_exception_is_set (ex)) {
- GtkWidget *w = e_error_new (NULL,
- "mail:no-delete-folder", folder->full_name, camel_exception_get_description (ex), NULL);
+ 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",
+ folder->full_name, camel_exception_get_description (ex), NULL);
em_utils_show_error_silent (w);
camel_exception_clear (ex);
}
@@ -406,14 +426,23 @@ emfu_delete_response (GtkWidget *dialog, gint response, gpointer data)
void
em_folder_utils_delete_folder (CamelFolder *folder)
{
+ EShell *shell;
+ GtkWindow *parent;
CamelStore *local_store;
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)) {
- dialog = e_error_new (NULL, "mail:no-delete-special-folder", folder->full_name, NULL);
+ dialog = e_error_new (
+ parent, "mail:no-delete-special-folder",
+ folder->full_name, NULL);
em_utils_show_error_silent (dialog);
return;
}
@@ -426,7 +455,7 @@ em_folder_utils_delete_folder (CamelFolder *folder)
camel_object_ref (folder);
- dialog = e_error_new(NULL,
+ dialog = e_error_new (parent,
(folder->parent_store && CAMEL_IS_VEE_STORE(folder->parent_store))?"mail:ask-delete-vfolder":"mail:ask-delete-folder",
folder->full_name, NULL);
g_object_set_data_full ((GObject *) dialog, "folder", folder, camel_object_unref);
diff --git a/mail/mail-autofilter.c b/mail/mail-autofilter.c
index ece7e75ca5..02fbbfbbc7 100644
--- a/mail/mail-autofilter.c
+++ b/mail/mail-autofilter.c
@@ -420,7 +420,10 @@ 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;
@@ -431,7 +434,10 @@ mail_filter_delete_uri(CamelStore *store, const gchar *uri)
l = l->next;
}
- dialog = e_error_new(NULL, "mail:filter-updated", s->str, euri, NULL);
+ 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);
g_string_free(s, TRUE);
em_utils_show_info_silent (dialog);
diff --git a/mail/mail-mt.c b/mail/mail-mt.c
index 7281ce63a4..6c25d7ab8e 100644
--- a/mail/mail-mt.c
+++ b/mail/mail-mt.c
@@ -292,9 +292,12 @@ 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);
@@ -322,12 +325,16 @@ 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;
+
if (m->info->desc
&& (what = m->info->desc (m))) {
- gd = (GtkDialog *)e_error_new(NULL, "mail:async-error", what, camel_exception_get_description(&m->ex), NULL);
+ gd = (GtkDialog *)e_error_new(parent, "mail:async-error", what, camel_exception_get_description(&m->ex), NULL);
g_free(what);
} else
- gd = (GtkDialog *)e_error_new(NULL, "mail:async-error-nodescribe", camel_exception_get_description(&m->ex), NULL);
+ gd = (GtkDialog *)e_error_new(parent, "mail:async-error-nodescribe", camel_exception_get_description(&m->ex), NULL);
g_hash_table_insert(active_errors, m->info, gd);
g_signal_connect(gd, "response", G_CALLBACK(error_response), m->info);
diff --git a/mail/mail-session.c b/mail/mail-session.c
index 27fdaf9942..2d1a1ff1c1 100644
--- a/mail/mail-session.c
+++ b/mail/mail-session.c
@@ -322,6 +322,9 @@ 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) {
@@ -350,7 +353,12 @@ user_message_exec (struct _user_message_msg *m)
g_return_if_reached ();
}
- user_message_dialog = e_error_new (NULL, error_type, m->prompt, NULL);
+ 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);
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 96d60ab5f0..69ba7d4d98 100644
--- a/mail/mail-vfolder.c
+++ b/mail/mail-vfolder.c
@@ -600,11 +600,17 @@ done:
UNLOCK();
if (changed->str[0]) {
+ EShell *shell;
+ GtkWindow *parent;
GtkWidget *dialog;
+ GList *windows;
const gchar *data_dir;
gchar *user;
- dialog = e_error_new(NULL, "mail:vfolder-updated", changed->str, uri, NULL);
+ 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);
em_utils_show_info_silent (dialog);
data_dir = em_utils_get_data_dir ();
@@ -1095,9 +1101,17 @@ 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(NULL, "mail:vfolder-notexist", uri, NULL);
+ w = e_error_new(parent, "mail:vfolder-notexist", uri, NULL);
em_utils_show_error_silent (w);
}