aboutsummaryrefslogtreecommitdiffstats
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
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'
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c2
-rw-r--r--addressbook/gui/contact-editor/e-contact-quick-add.c23
-rw-r--r--addressbook/gui/contact-list-editor/e-contact-list-editor.c3
-rw-r--r--addressbook/gui/contact-list-editor/e-contact-list-model.c3
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c2
-rw-r--r--addressbook/gui/widgets/eab-gui-util.c3
-rw-r--r--addressbook/util/Makefile.am4
-rw-r--r--addressbook/util/addressbook.c3
-rw-r--r--calendar/gui/gnome-cal.c2
-rw-r--r--filter/filter-datespec.c10
-rw-r--r--filter/filter-element.c8
-rw-r--r--filter/filter-element.h4
-rw-r--r--filter/filter-file.c16
-rw-r--r--filter/filter-input.c10
-rw-r--r--filter/filter-part.c4
-rw-r--r--filter/filter-part.h3
-rw-r--r--filter/filter-rule.c18
-rw-r--r--filter/filter-rule.h4
-rw-r--r--filter/rule-context.c4
-rw-r--r--filter/rule-editor.c8
-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
-rw-r--r--modules/mail/e-mail-junk-hook.c11
-rw-r--r--modules/mail/e-mail-shell-backend.c17
-rw-r--r--modules/mail/e-mail-shell-migrate.c3
-rw-r--r--plugins/backup-restore/backup-restore.c2
-rw-r--r--plugins/external-editor/external-editor.c38
-rw-r--r--plugins/face/face.c6
-rw-r--r--plugins/groupwise-features/camel-gw-listener.c5
-rw-r--r--plugins/groupwise-features/mail-retract.c4
-rw-r--r--plugins/groupwise-features/process-meeting.c7
-rw-r--r--plugins/groupwise-features/proxy-login.c15
-rw-r--r--plugins/groupwise-features/proxy-login.h3
-rw-r--r--plugins/groupwise-features/proxy.c14
-rw-r--r--plugins/groupwise-features/share-folder.c4
-rw-r--r--plugins/itip-formatter/itip-formatter.c6
-rw-r--r--plugins/startup-wizard/startup-wizard.c7
-rw-r--r--shell/e-shell-content.c4
-rw-r--r--shell/e-shell-migrate.c8
-rw-r--r--shell/e-shell.c27
-rw-r--r--shell/e-shell.h1
49 files changed, 188 insertions, 246 deletions
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index 007436e7da..6fab3cb75e 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -2769,7 +2769,7 @@ categories_clicked (GtkWidget *button, EContactEditor *editor)
g_free (categories);
return;
}else if (!(dialog = GTK_DIALOG (e_categories_dialog_new (categories)))) {
- e_error_run (NULL, "addressbook:edit-categories", NULL);
+ e_error_run (GTK_WINDOW (editor->app), "addressbook:edit-categories", NULL);
g_free (categories);
return;
}
diff --git a/addressbook/gui/contact-editor/e-contact-quick-add.c b/addressbook/gui/contact-editor/e-contact-quick-add.c
index 1e287d8516..5288ab009d 100644
--- a/addressbook/gui/contact-editor/e-contact-quick-add.c
+++ b/addressbook/gui/contact-editor/e-contact-quick-add.c
@@ -35,25 +35,6 @@
#include "eab-contact-merging.h"
#include "e-util/e-error.h"
-static GtkWindow *
-get_dlg_parent_window (void)
-{
- GList *windows;
- GtkWindow *parent = NULL;
- EShell *shell = e_shell_get_default ();
-
- g_return_val_if_fail (shell != NULL, NULL);
-
- for (windows = e_shell_get_watched_windows (shell); windows && !parent; windows = windows->next) {
- if (GTK_IS_WINDOW (windows->data))
- parent = windows->data;
- }
-
- g_return_val_if_fail (parent != NULL, NULL);
-
- return parent;
-}
-
typedef struct _QuickAdd QuickAdd;
struct _QuickAdd {
gchar *name;
@@ -148,7 +129,7 @@ merge_cb (EBook *book, EBookStatus status, gpointer closure)
if (e_book_is_writable (book))
eab_merging_book_add_contact (book, qa->contact, NULL, NULL);
else
- e_error_run (get_dlg_parent_window (), "addressbook:error-read-only", e_source_peek_name (e_book_get_source (book)), NULL);
+ e_error_run (e_shell_get_active_window (NULL), "addressbook:error-read-only", e_source_peek_name (e_book_get_source (book)), NULL);
if (qa->cb)
qa->cb (qa->contact, qa->closure);
@@ -345,7 +326,7 @@ build_quick_add_dialog (QuickAdd *qa)
g_return_val_if_fail (qa != NULL, NULL);
dialog = gtk_dialog_new_with_buttons (_("Contact Quick-Add"),
- get_dlg_parent_window (),
+ e_shell_get_active_window (NULL),
GTK_DIALOG_NO_SEPARATOR,
_("_Edit Full"), QUICK_ADD_RESPONSE_EDIT_FULL,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor.c b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
index 77d91357c5..73b5dcd7cf 100644
--- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c
+++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
@@ -25,6 +25,7 @@
#include "e-contact-list-editor.h"
#include <e-util/e-util-private.h>
#include <e-util/e-error.h>
+#include "shell/e-shell.h"
#include <string.h>
@@ -259,7 +260,7 @@ contact_list_editor_contact_exists (EContactListModel *model,
if (!e_contact_list_model_has_email (model, email))
return FALSE;
- return (e_error_run (NULL, tag, email, NULL) != GTK_RESPONSE_YES);
+ return (e_error_run (e_shell_get_active_window (NULL), tag, email, NULL) != GTK_RESPONSE_YES);
}
static void
diff --git a/addressbook/gui/contact-list-editor/e-contact-list-model.c b/addressbook/gui/contact-list-editor/e-contact-list-model.c
index d43e895570..a5fc9937ac 100644
--- a/addressbook/gui/contact-list-editor/e-contact-list-model.c
+++ b/addressbook/gui/contact-list-editor/e-contact-list-model.c
@@ -24,6 +24,7 @@
#include "e-contact-list-model.h"
#include "e-util/e-error.h"
+#include "shell/e-shell.h"
static gpointer parent_class;
@@ -152,7 +153,7 @@ e_contact_list_model_add_email (EContactListModel *model,
g_return_if_fail (email != NULL);
if (e_contact_list_model_has_email (model, email))
- if (e_error_run (NULL, tag, email, NULL) != GTK_RESPONSE_YES)
+ if (e_error_run (e_shell_get_active_window (NULL), tag, email, NULL) != GTK_RESPONSE_YES)
return;
destination = e_destination_new ();
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
index c606530594..8d07a8007a 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -1109,7 +1109,7 @@ delete_contacts_cb (EBook *book, EBookStatus status, gpointer closure)
case E_BOOK_ERROR_CANCELLED :
break;
case E_BOOK_ERROR_PERMISSION_DENIED :
- e_error_run (NULL, "addressbook:contact-delete-error-perm", NULL);
+ e_error_run (e_shell_get_active_window (NULL), "addressbook:contact-delete-error-perm", NULL);
break;
default :
/* Unknown error */
diff --git a/addressbook/gui/widgets/eab-gui-util.c b/addressbook/gui/widgets/eab-gui-util.c
index effea132c3..0aa63850a2 100644
--- a/addressbook/gui/widgets/eab-gui-util.c
+++ b/addressbook/gui/widgets/eab-gui-util.c
@@ -37,6 +37,7 @@
#include <libebook/e-destination.h>
#include "e-util/e-error.h"
#include "e-util/e-html-utils.h"
+#include "shell/e-shell.h"
#include "misc/e-image-chooser.h"
#include <e-util/e-icon-factory.h>
#include "eab-contact-merging.h"
@@ -85,7 +86,7 @@ eab_error_dialog (const gchar *msg, EBookStatus status)
status_str = status_to_string [status];
if (status_str)
- e_error_run (NULL, "addressbook:generic-error", msg, _(status_str), NULL);
+ e_error_run (e_shell_get_active_window (NULL), "addressbook:generic-error", msg, _(status_str), NULL);
}
void
diff --git a/addressbook/util/Makefile.am b/addressbook/util/Makefile.am
index c5afbaf84f..f777f3c940 100644
--- a/addressbook/util/Makefile.am
+++ b/addressbook/util/Makefile.am
@@ -10,6 +10,7 @@ libeabutil_la_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_builddir)/shell \
-I$(top_srcdir)/shell \
+ -I$(top_srcdir)/widgets \
$(EVOLUTION_ADDRESSBOOK_CFLAGS)
libeabutil_la_SOURCES = \
@@ -23,7 +24,8 @@ libeabutil_la_LDFLAGS = $(NO_UNDEFINED)
libeabutil_la_LIBADD = \
$(EVOLUTION_ADDRESSBOOK_LIBS) \
$(top_builddir)/widgets/misc/libemiscwidgets.la \
- $(top_builddir)/e-util/libeutil.la
+ $(top_builddir)/e-util/libeutil.la \
+ $(top_builddir)/shell/libeshell.la
dist-hook:
cd $(distdir); rm -f $(BUILT_SOURCES)
diff --git a/addressbook/util/addressbook.c b/addressbook/util/addressbook.c
index 7caa545059..59d87659c7 100644
--- a/addressbook/util/addressbook.c
+++ b/addressbook/util/addressbook.c
@@ -31,6 +31,7 @@
#include <libedataserverui/e-passwords.h>
#include "e-util/e-error.h"
+#include "shell/e-shell.h"
#include "addressbook.h"
#define d(x)
@@ -107,7 +108,7 @@ load_source_auth_cb (EBook *book, EBookStatus status, gpointer closure)
goto done;
}
} else if (status == E_BOOK_ERROR_INVALID_SERVER_VERSION) {
- e_error_run (NULL, "addressbook:server-version", NULL);
+ e_error_run (e_shell_get_active_window (NULL), "addressbook:server-version", NULL);
status = E_BOOK_ERROR_OK;
goto done;
} else if (status == E_BOOK_ERROR_UNSUPPORTED_AUTHENTICATION_METHOD) {
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 51ef08aa77..4a8c5c4f68 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -1989,7 +1989,7 @@ default_client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar
e_cal_open_async (ecal, FALSE);
return;
case E_CALENDAR_STATUS_INVALID_SERVER_VERSION:
- e_error_run (NULL, "calendar:server-version", NULL);
+ e_error_run (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gcal))), "calendar:server-version", NULL);
default:
/* Make sure the source doesn't disappear on us */
g_object_ref (source);
diff --git a/filter/filter-datespec.c b/filter/filter-datespec.c
index fcfc877dc0..dcd3078ec1 100644
--- a/filter/filter-datespec.c
+++ b/filter/filter-datespec.c
@@ -45,7 +45,7 @@
#define d(x)
-static gboolean validate (FilterElement *fe);
+static gboolean validate (FilterElement *fe, GtkWindow *error_parent);
static gint date_eq (FilterElement *fe, FilterElement *cm);
static void xml_create (FilterElement *fe, xmlNodePtr node);
static xmlNodePtr xml_encode (FilterElement *fe);
@@ -178,18 +178,14 @@ filter_datespec_new (void)
}
static gboolean
-validate (FilterElement *fe)
+validate (FilterElement *fe, GtkWindow *error_parent)
{
FilterDatespec *fds = (FilterDatespec *) fe;
gboolean valid;
valid = fds->type != FDST_UNKNOWN;
if (!valid) {
- /* 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, "filter:no-date", NULL);
+ e_error_run (error_parent, "filter:no-date", NULL);
}
return valid;
diff --git a/filter/filter-element.c b/filter/filter-element.c
index 7eb898f025..952805e48b 100644
--- a/filter/filter-element.c
+++ b/filter/filter-element.c
@@ -37,7 +37,7 @@ struct _element_type {
gpointer data;
};
-static gboolean validate (FilterElement *fe);
+static gboolean validate (FilterElement *fe, GtkWindow *error_parent);
static gint element_eq(FilterElement *fe, FilterElement *cm);
static void xml_create(FilterElement *fe, xmlNodePtr node);
static FilterElement *clone(FilterElement *fe);
@@ -117,9 +117,9 @@ filter_element_new (void)
}
gboolean
-filter_element_validate (FilterElement *fe)
+filter_element_validate (FilterElement *fe, GtkWindow *error_parent)
{
- return FILTER_ELEMENT_GET_CLASS (fe)->validate (fe);
+ return FILTER_ELEMENT_GET_CLASS (fe)->validate (fe, error_parent);
}
gint
@@ -239,7 +239,7 @@ filter_element_set_data (FilterElement *fe, gpointer data)
/* default implementations */
static gboolean
-validate (FilterElement *fe)
+validate (FilterElement *fe, GtkWindow *error_parent)
{
return TRUE;
}
diff --git a/filter/filter-element.h b/filter/filter-element.h
index 5a78c98980..9bcb3f98df 100644
--- a/filter/filter-element.h
+++ b/filter/filter-element.h
@@ -53,7 +53,7 @@ struct _FilterElementClass {
GObjectClass parent_class;
/* virtual methods */
- gboolean (*validate) (FilterElement *fe);
+ gboolean (*validate) (FilterElement *fe, GtkWindow *error_parent);
gint (*eq) (FilterElement *fe, FilterElement *cm);
void (*xml_create) (FilterElement *, xmlNodePtr);
@@ -76,7 +76,7 @@ FilterElement *filter_element_new (void);
void filter_element_set_data (FilterElement *fe, gpointer data);
/* methods */
-gboolean filter_element_validate (FilterElement *fe);
+gboolean filter_element_validate (FilterElement *fe, GtkWindow *error_parent);
gint filter_element_eq (FilterElement *fe, FilterElement *cm);
void filter_element_xml_create (FilterElement *fe, xmlNodePtr node);
diff --git a/filter/filter-file.c b/filter/filter-file.c
index 72d7bac458..b541022554 100644
--- a/filter/filter-file.c
+++ b/filter/filter-file.c
@@ -37,7 +37,7 @@
#define d(x)
-static gboolean validate (FilterElement *fe);
+static gboolean validate (FilterElement *fe, GtkWindow *error_parent);
static gint file_eq (FilterElement *fe, FilterElement *cm);
static void xml_create (FilterElement *fe, xmlNodePtr node);
static xmlNodePtr xml_encode (FilterElement *fe);
@@ -146,16 +146,12 @@ filter_file_set_path (FilterFile *file, const gchar *path)
}
static gboolean
-validate (FilterElement *fe)
+validate (FilterElement *fe, GtkWindow *error_parent)
{
FilterFile *file = (FilterFile *) fe;
if (!file->path) {
- /* 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, "filter:no-file", NULL);
+ e_error_run (error_parent, "filter:no-file", NULL);
return FALSE;
}
@@ -164,11 +160,7 @@ validate (FilterElement *fe)
if (strcmp (file->type, "file") == 0) {
if (!g_file_test (file->path, G_FILE_TEST_IS_REGULAR)) {
- /* 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, "filter:bad-file", file->path, NULL);
+ e_error_run (error_parent, "filter:bad-file", file->path, NULL);
return FALSE;
}
diff --git a/filter/filter-input.c b/filter/filter-input.c
index ad22dd6846..31f74d991f 100644
--- a/filter/filter-input.c
+++ b/filter/filter-input.c
@@ -38,7 +38,7 @@
#define d(x)
-static gboolean validate (FilterElement *fe);
+static gboolean validate (FilterElement *fe, GtkWindow *error_parent);
static gint input_eq (FilterElement *fe, FilterElement *cm);
static void xml_create (FilterElement *fe, xmlNodePtr node);
static xmlNodePtr xml_encode (FilterElement *fe);
@@ -160,7 +160,7 @@ filter_input_set_value (FilterInput *fi, const gchar *value)
}
static gboolean
-validate (FilterElement *fe)
+validate (FilterElement *fe, GtkWindow *error_parent)
{
FilterInput *fi = (FilterInput *)fe;
gboolean valid = TRUE;
@@ -182,11 +182,7 @@ validate (FilterElement *fe)
regmsg = g_malloc0 (reglen + 1);
regerror (regerr, &regexpat, regmsg, reglen);
- /* 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, "filter:bad-regexp", pattern, regmsg, NULL);
+ e_error_run (error_parent, "filter:bad-regexp", pattern, regmsg, NULL);
g_free (regmsg);
valid = FALSE;
diff --git a/filter/filter-part.c b/filter/filter-part.c
index 2e74f9c926..d59796a2cc 100644
--- a/filter/filter-part.c
+++ b/filter/filter-part.c
@@ -117,7 +117,7 @@ filter_part_new (void)
}
gboolean
-filter_part_validate (FilterPart *fp)
+filter_part_validate (FilterPart *fp, GtkWindow *error_parent)
{
gboolean correct = TRUE;
GList *l;
@@ -126,7 +126,7 @@ filter_part_validate (FilterPart *fp)
while (l && correct) {
FilterElement *fe = l->data;
- correct = filter_element_validate (fe);
+ correct = filter_element_validate (fe, error_parent);
l = l->next;
}
diff --git a/filter/filter-part.h b/filter/filter-part.h
index 10337b95df..10e58979e7 100644
--- a/filter/filter-part.h
+++ b/filter/filter-part.h
@@ -26,6 +26,7 @@
#include <glib.h>
#include <glib-object.h>
+#include <gtk/gtk.h>
#include "filter-input.h"
@@ -63,7 +64,7 @@ GType filter_part_get_type (void);
FilterPart *filter_part_new (void);
/* methods */
-gboolean filter_part_validate (FilterPart *fp);
+gboolean filter_part_validate (FilterPart *fp, GtkWindow *error_parent);
gint filter_part_eq (FilterPart *fp, FilterPart *fc);
gint filter_part_xml_create (FilterPart *ff, xmlNodePtr node, struct _RuleContext *rc);
diff --git a/filter/filter-rule.c b/filter/filter-rule.c
index 8c4d2bbffd..28cf83cb8a 100644
--- a/filter/filter-rule.c
+++ b/filter/filter-rule.c
@@ -36,7 +36,7 @@
#define d(x)
-static gint validate(FilterRule *);
+static gint validate(FilterRule *, GtkWindow *error_parent);
static gint rule_eq(FilterRule *fr, FilterRule *cm);
static xmlNodePtr xml_encode (FilterRule *);
static gint xml_decode (FilterRule *, xmlNodePtr, RuleContext *);
@@ -196,25 +196,21 @@ filter_rule_set_source (FilterRule *fr, const gchar *source)
}
gint
-filter_rule_validate (FilterRule *fr)
+filter_rule_validate (FilterRule *fr, GtkWindow *error_parent)
{
g_return_val_if_fail (IS_FILTER_RULE (fr), 0);
- return FILTER_RULE_GET_CLASS (fr)->validate (fr);
+ return FILTER_RULE_GET_CLASS (fr)->validate (fr, error_parent);
}
static gint
-validate (FilterRule *fr)
+validate (FilterRule *fr, GtkWindow *error_parent)
{
gint valid = TRUE;
GList *parts;
if (!fr->name || !*fr->name) {
- /* 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, "filter:no-name", NULL);
+ e_error_run (error_parent, "filter:no-name", NULL);
return FALSE;
}
@@ -223,7 +219,7 @@ validate (FilterRule *fr)
parts = fr->parts;
valid = parts != NULL;
while (parts && valid) {
- valid = filter_part_validate ((FilterPart *) parts->data);
+ valid = filter_part_validate ((FilterPart *) parts->data, error_parent);
parts = parts->next;
}
@@ -780,7 +776,7 @@ more_parts (GtkWidget *button, struct _rule_data *data)
l = g_list_last (data->fr->parts);
part = l->data;
- if (!filter_part_validate (part))
+ if (!filter_part_validate (part, GTK_WINDOW (gtk_widget_get_toplevel (button))))
return;
}
diff --git a/filter/filter-rule.h b/filter/filter-rule.h
index 94e80695bd..113026fce9 100644
--- a/filter/filter-rule.h
+++ b/filter/filter-rule.h
@@ -81,7 +81,7 @@ struct _FilterRuleClass {
GObjectClass parent_class;
/* virtual methods */
- gint (*validate) (FilterRule *);
+ gint (*validate) (FilterRule *, GtkWindow *error_parent);
gint (*eq) (FilterRule *fr, FilterRule *cm);
xmlNodePtr (*xml_encode) (FilterRule *);
@@ -106,7 +106,7 @@ FilterRule *filter_rule_clone (FilterRule *base);
void filter_rule_set_name (FilterRule *fr, const gchar *name);
void filter_rule_set_source (FilterRule *fr, const gchar *source);
-gint filter_rule_validate (FilterRule *fr);
+gint filter_rule_validate (FilterRule *fr, GtkWindow *error_parent);
gint filter_rule_eq (FilterRule *fr, FilterRule *cm);
xmlNodePtr filter_rule_xml_encode (FilterRule *fr);
diff --git a/filter/rule-context.c b/filter/rule-context.c
index b6e7df47de..45f495e37e 100644
--- a/filter/rule-context.c
+++ b/filter/rule-context.c
@@ -685,13 +685,13 @@ new_rule_response(GtkWidget *dialog, gint button, RuleContext *context)
FilterRule *rule = g_object_get_data((GObject *) dialog, "rule");
gchar *user = g_object_get_data((GObject *) dialog, "path");
- if (!filter_rule_validate(rule)) {
+ if (!filter_rule_validate (rule, GTK_WINDOW (dialog))) {
/* no need to popup a dialog because the validate code does that. */
return;
}
if (rule_context_find_rule (context, rule->name, rule->source)) {
- e_error_run((GtkWindow *)dialog, "filter:bad-name-notunique", rule->name, NULL);
+ 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 7a9335990f..edda65e116 100644
--- a/filter/rule-editor.c
+++ b/filter/rule-editor.c
@@ -326,13 +326,13 @@ add_editor_response (GtkWidget *dialog, gint button, RuleEditor *re)
GtkTreeIter iter;
if (button == GTK_RESPONSE_OK) {
- if (!filter_rule_validate (re->edit)) {
+ if (!filter_rule_validate (re->edit, GTK_WINDOW (dialog))) {
/* no need to popup a dialog because the validate code does that. */
return;
}
if (rule_context_find_rule (re->context, re->edit->name, re->edit->source)) {
- e_error_run((GtkWindow *)dialog, "filter:bad-name-notunique", re->edit->name, NULL);
+ e_error_run ((GtkWindow *)dialog, "filter:bad-name-notunique", re->edit->name, NULL);
return;
}
@@ -408,14 +408,14 @@ edit_editor_response (GtkWidget *dialog, gint button, RuleEditor *re)
gint pos;
if (button == GTK_RESPONSE_OK) {
- if (!filter_rule_validate (re->edit)) {
+ if (!filter_rule_validate (re->edit, GTK_WINDOW (dialog))) {
/* no need to popup a dialog because the validate code does that. */
return;
}
rule = rule_context_find_rule (re->context, re->edit->name, re->edit->source);
if (rule != NULL && rule != re->current) {
- e_error_run((GtkWindow *)dialog, "filter:bad-name-notunique", rule->name, NULL);
+ e_error_run ((GtkWindow *)dialog, "filter:bad-name-notunique", rule->name, NULL);
return;
}
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;
}
diff --git a/modules/mail/e-mail-junk-hook.c b/modules/mail/e-mail-junk-hook.c
index f19b502f69..870ffe8377 100644
--- a/modules/mail/e-mail-junk-hook.c
+++ b/modules/mail/e-mail-junk-hook.c
@@ -50,17 +50,10 @@ static GType mail_junk_hook_type;
static gboolean
mail_junk_hook_idle_cb (struct ErrorData *data)
{
- EShell *shell;
- GtkWindow *parent;
GtkWidget *widget;
- GList *windows;
- shell = e_shell_get_default ();
- windows = e_shell_get_watched_windows (shell);
- parent = (windows != NULL) ? GTK_WINDOW (windows->data) : NULL;
-
- widget = e_error_new (
- parent, data->error_message, data->error->message, NULL);
+ widget = e_error_new (e_shell_get_active_window (NULL),
+ data->error_message, data->error->message, NULL);
em_utils_show_error_silent (widget);
g_error_free (data->error);
diff --git a/modules/mail/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c
index c178e6d020..bad0a1a84d 100644
--- a/modules/mail/e-mail-shell-backend.c
+++ b/modules/mail/e-mail-shell-backend.c
@@ -410,17 +410,11 @@ mail_shell_backend_prepare_for_offline_cb (EShell *shell,
EActivity *activity,
EMailShellBackend *mail_shell_backend)
{
- GList *watched_windows;
- GtkWidget *parent = NULL;
gboolean synchronize = FALSE;
- watched_windows = e_shell_get_watched_windows (shell);
- if (watched_windows != NULL)
- parent = GTK_WIDGET (watched_windows->data);
-
if (e_shell_get_network_available (shell))
synchronize = em_utils_prompt_user (
- GTK_WINDOW (parent), NULL,
+ e_shell_get_active_window (shell), NULL,
"mail:ask-quick-offline", NULL);
if (!synchronize) {
@@ -658,8 +652,6 @@ mail_shell_backend_quit_requested_cb (EShell *shell,
EShellBackend *shell_backend)
{
CamelFolder *folder;
- GList *watched_windows;
- GtkWindow *parent = NULL;
guint32 unsent;
gint response;
@@ -680,12 +672,7 @@ mail_shell_backend_quit_requested_cb (EShell *shell,
if (unsent == 0)
return;
- /* Try to find a parent window for the dialog.
- * First list item is what's currently focused. */
- watched_windows = e_shell_get_watched_windows (shell);
- if (watched_windows != NULL)
- parent = GTK_WINDOW (watched_windows->data);
- response = e_error_run (parent, "mail:exit-unsaved", NULL);
+ response = e_error_run (e_shell_get_active_window (shell), "mail:exit-unsaved", NULL);
if (response == GTK_RESPONSE_YES)
return;
diff --git a/modules/mail/e-mail-shell-migrate.c b/modules/mail/e-mail-shell-migrate.c
index 7176d4fba7..967f80053f 100644
--- a/modules/mail/e-mail-shell-migrate.c
+++ b/modules/mail/e-mail-shell-migrate.c
@@ -64,6 +64,7 @@
#include "e-util/e-signature-utils.h"
#include "e-mail-shell-backend.h"
+#include "shell/e-shell.h"
#include "shell/e-shell-migrate.h"
#include "e-mail-store.h"
@@ -1597,7 +1598,7 @@ em_migrate_folder(EMMigrateSession *session, const gchar *dirname, const gchar *
if (errno == EEXIST) {
gint save = errno;
- switch (e_error_run(NULL, "mail:ask-migrate-existing", src->str, dest->str, NULL)) {
+ switch (e_error_run (e_shell_get_active_window (NULL), "mail:ask-migrate-existing", src->str, dest->str, NULL)) {
case GTK_RESPONSE_ACCEPT:
mode = CP_OVERWRITE;
goto retry_copy;
diff --git a/plugins/backup-restore/backup-restore.c b/plugins/backup-restore/backup-restore.c
index 6df2763698..82309a787f 100644
--- a/plugins/backup-restore/backup-restore.c
+++ b/plugins/backup-restore/backup-restore.c
@@ -170,7 +170,7 @@ action_settings_backup_cb (GtkAction *action,
if (mask & BR_OK)
backup (filename, (mask & BR_START) ? TRUE: FALSE);
} else {
- e_error_run (NULL, "org.gnome.backup-restore:insufficient-permissions", NULL);
+ e_error_run (parent, "org.gnome.backup-restore:insufficient-permissions", NULL);
}
g_free (filename);
diff --git a/plugins/external-editor/external-editor.c b/plugins/external-editor/external-editor.c
index 88858c0211..adc9678550 100644
--- a/plugins/external-editor/external-editor.c
+++ b/plugins/external-editor/external-editor.c
@@ -196,11 +196,23 @@ update_composer_text (GArray *array)
return FALSE;
}
+struct run_error_dialog_data
+{
+ EMsgComposer *composer;
+ const gchar *text;
+};
+
/* needed because the new thread needs to call g_idle_add () */
static gboolean
-run_error_dialog (gchar *text)
+run_error_dialog (struct run_error_dialog_data *data)
{
- e_error_run (NULL, text, NULL);
+ g_return_val_if_fail (data != NULL, FALSE);
+
+ e_error_run (GTK_WINDOW (data->composer), data->text, NULL);
+ enable_composer (data->composer);
+
+ g_free (data);
+
return FALSE;
}
@@ -246,10 +258,15 @@ async_external_editor (EMsgComposer *composer)
content = gtkhtml_editor_get_text_plain (GTKHTML_EDITOR (composer), &length);
g_file_set_contents (filename, content, length, NULL);
} else {
+ struct run_error_dialog_data *data = g_new0 (struct run_error_dialog_data, 1);
+
+ data->composer = composer;
+ data->text = "org.gnome.evolution.plugins.external-editor:no-temp-file";
+
g_warning ("Temporary file fd is null");
- g_idle_add ((GSourceFunc) run_error_dialog,
- (gpointer)"org.gnome.evolution.plugins.external-editor:no-temp-file");
- g_idle_add ((GSourceFunc) enable_composer, composer);
+
+ /* run_error_dialog also calls enable_composer */
+ g_idle_add ((GSourceFunc) run_error_dialog, data);
return;
}
@@ -289,10 +306,15 @@ async_external_editor (EMsgComposer *composer)
editor_cmd_line = g_strconcat (editor_cmd, " ", filename, NULL);
if (!g_spawn_command_line_sync (editor_cmd_line, NULL, NULL, &status, NULL)) {
+ struct run_error_dialog_data *data = g_new0 (struct run_error_dialog_data, 1);
+
g_warning ("Unable to launch %s: ", editor_cmd_line);
- g_idle_add ((GSourceFunc) run_error_dialog,
- (gpointer)"org.gnome.evolution.plugins.external-editor:editor-not-launchable");
- g_idle_add ((GSourceFunc) enable_composer, composer);
+
+ data->composer = composer;
+ data->text = "org.gnome.evolution.plugins.external-editor:editor-not-launchable";
+
+ /* run_error_dialog also calls enable_composer */
+ g_idle_add ((GSourceFunc) run_error_dialog, data);
g_free (filename);
g_free (editor_cmd_line);
diff --git a/plugins/face/face.c b/plugins/face/face.c
index 1bb56c2bff..3e462da5b1 100644
--- a/plugins/face/face.c
+++ b/plugins/face/face.c
@@ -97,7 +97,7 @@ action_face_cb (GtkAction *action,
if (height != 48 || width != 48) {
d (printf ("\n\a Invalid Image Size. Please choose a 48*48 image\n\a"));
- e_error_run (NULL, "org.gnome.evolution.plugins.face:invalid-image-size", NULL, NULL);
+ e_error_run (GTK_WINDOW (filesel), "org.gnome.evolution.plugins.face:invalid-image-size", NULL, NULL);
} else {
file_contents = g_base64_encode ((guchar *) file_contents, length);
g_file_set_contents (filename, file_contents, -1, &error);
@@ -105,12 +105,12 @@ action_face_cb (GtkAction *action,
}
} else {
d (printf ("File too big"));
- e_error_run (NULL, "org.gnome.evolution.plugins.face:invalid-file-size", NULL, NULL);
+ e_error_run (GTK_WINDOW (filesel), "org.gnome.evolution.plugins.face:invalid-file-size", NULL, NULL);
}
} else {
d (printf ("\n\a File cannot be read\n\a"));
- e_error_run (NULL, "org.gnome.evolution.plugins.face:file-not-found", NULL, NULL);
+ e_error_run (GTK_WINDOW (filesel), "org.gnome.evolution.plugins.face:file-not-found", NULL, NULL);
}
}
gtk_widget_destroy (filesel);
diff --git a/plugins/groupwise-features/camel-gw-listener.c b/plugins/groupwise-features/camel-gw-listener.c
index 72b810feea..52b37fc92a 100644
--- a/plugins/groupwise-features/camel-gw-listener.c
+++ b/plugins/groupwise-features/camel-gw-listener.c
@@ -32,6 +32,7 @@
#include "e-util/e-error.h"
#include <libedataserver/e-account.h>
#include <libecal/e-cal.h>
+#include <shell/e-shell.h>
/*stores some info about all currently existing groupwise accounts
list of GwAccountInfo structures */
@@ -541,7 +542,7 @@ get_addressbook_names_from_server (gchar *source_url)
/*FIXME: This error message should be relocated to addressbook and should reflect
* that it actually failed to get the addressbooks*/
- e_error_run (NULL, "mail:gw-accountsetup-error", poa_address, NULL);
+ e_error_run (e_shell_get_active_window (NULL), "mail:gw-accountsetup-error", poa_address, NULL);
return NULL;
}
@@ -653,7 +654,7 @@ add_addressbook_sources (EAccount *account)
if (!is_frequent_contacts) {
/* display warning message */
- e_error_run (NULL, "addressbook:gw-book-list-init", NULL);
+ e_error_run (e_shell_get_active_window (NULL), "addressbook:gw-book-list-init", NULL);
}
return TRUE;
}
diff --git a/plugins/groupwise-features/mail-retract.c b/plugins/groupwise-features/mail-retract.c
index 9581c0132b..1de2dfdead 100644
--- a/plugins/groupwise-features/mail-retract.c
+++ b/plugins/groupwise-features/mail-retract.c
@@ -79,7 +79,7 @@ gw_retract_mail_cb (GtkAction *action, EShellView *shell_view)
cnc = get_cnc (store);
if (cnc && E_IS_GW_CONNECTION(cnc)) {
- confirm_dialog = gtk_dialog_new_with_buttons (_("Message Retract"), NULL,
+ confirm_dialog = gtk_dialog_new_with_buttons (_("Message Retract"), GTK_WINDOW (e_shell_view_get_shell_window (shell_view)),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_YES, GTK_RESPONSE_YES,
GTK_STOCK_NO, GTK_RESPONSE_NO, NULL);
@@ -100,7 +100,7 @@ gw_retract_mail_cb (GtkAction *action, EShellView *shell_view)
if (n == GTK_RESPONSE_YES) {
if (e_gw_connection_retract_request (cnc, id, NULL, FALSE, FALSE) != E_GW_CONNECTION_STATUS_OK )
- e_error_run (NULL, "org.gnome.evolution.message.retract:retract-failure", NULL);
+ e_error_run (GTK_WINDOW (e_shell_view_get_shell_window (shell_view)), "org.gnome.evolution.message.retract:retract-failure", NULL);
else {
GtkWidget *dialog;
dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, _("Message retracted successfully"));
diff --git a/plugins/groupwise-features/process-meeting.c b/plugins/groupwise-features/process-meeting.c
index 90ac465a43..e1e5e185ee 100644
--- a/plugins/groupwise-features/process-meeting.c
+++ b/plugins/groupwise-features/process-meeting.c
@@ -31,6 +31,7 @@
#include <libecal/e-cal.h>
#include <e-util/e-error.h>
+#include <shell/e-shell-view.h>
#include <calendar/gui/e-calendar-view.h>
#include <calendar/gui/itip-utils.h>
@@ -175,7 +176,7 @@ process_meeting (ECalendarView *cal_view, icalparameter_partstat status)
else
msg = "org.gnome.evolution.process_meeting:recurrence-decline";
- response = e_error_run (NULL, msg, NULL);
+ response = e_error_run (GTK_WINDOW (gtk_widget_get_toplevel ((GtkWidget *)cal_view)), msg, NULL);
if (response == GTK_RESPONSE_YES) {
icalproperty *prop;
const gchar *uid = icalcomponent_get_uid (r_data->icalcomp);
@@ -345,7 +346,7 @@ object_created_cb (CompEditor *ce, gpointer data)
gtk_widget_hide (GTK_WIDGET (ce));
- response = e_error_run (NULL, "org.gnome.evolution.process_meeting:resend-retract", NULL);
+ response = e_error_run (GTK_WINDOW (gtk_widget_get_toplevel ((GtkWidget *)ce)), "org.gnome.evolution.process_meeting:resend-retract", NULL);
if (response == GTK_RESPONSE_NO) {
free_thread_data (data);
return;
@@ -388,7 +389,7 @@ gw_resend_meeting_cb (GtkAction *action, EShellView *shell_view)
else
msg = "org.gnome.evolution.process_meeting:resend";
- response = e_error_run (NULL, msg, NULL);
+ response = e_error_run (GTK_WINDOW (e_shell_view_get_shell_window (shell_view)), msg, NULL);
if (response == GTK_RESPONSE_YES) {
mod = CALOBJ_MOD_ALL;
} else if (response == GTK_RESPONSE_CANCEL) {
diff --git a/plugins/groupwise-features/proxy-login.c b/plugins/groupwise-features/proxy-login.c
index f230a880d3..d4a4475a61 100644
--- a/plugins/groupwise-features/proxy-login.c
+++ b/plugins/groupwise-features/proxy-login.c
@@ -42,6 +42,7 @@
#include <e-util/e-icon-factory.h>
#include <e-util/e-util-private.h>
#include <e-util/e-account-utils.h>
+#include <shell/e-shell-view.h>
#include <e-gw-container.h>
#include <e-gw-connection.h>
@@ -274,7 +275,7 @@ proxy_login_get_cnc (EAccount *account, GtkWindow *password_dlg_parrent)
}
static void
-proxy_login_cb (GtkDialog *dialog, gint state)
+proxy_login_cb (GtkDialog *dialog, gint state, GtkWindow *parent)
{
GtkWidget *account_name_tbox;
proxyLoginPrivate *priv;
@@ -287,7 +288,7 @@ proxy_login_cb (GtkDialog *dialog, gint state)
switch (state) {
case GTK_RESPONSE_OK:
gtk_widget_destroy (priv->main);
- proxy_soap_login (proxy_name);
+ proxy_soap_login (proxy_name, parent);
g_object_unref (pld);
break;
case GTK_RESPONSE_CANCEL:
@@ -302,7 +303,7 @@ proxy_login_cb (GtkDialog *dialog, gint state)
}
static void
-proxy_soap_login (gchar *email)
+proxy_soap_login (gchar *email, GtkWindow *error_parent)
{
EAccountList *accounts = e_get_account_list ();
EAccount *srcAccount;
@@ -319,7 +320,7 @@ proxy_soap_login (gchar *email)
if (email[i]=='@')
name = g_strndup(email, i);
else {
- e_error_run (NULL, "org.gnome.evolution.proxy-login:invalid-user",email ,NULL);
+ e_error_run (error_parent, "org.gnome.evolution.proxy-login:invalid-user",email ,NULL);
return;
}
@@ -327,7 +328,7 @@ proxy_soap_login (gchar *email)
If so, it is violating the (li)unix philosophy of User creation. So dont care about that scenario*/
if (e_account_list_find (accounts, E_ACCOUNT_FIND_ID_ADDRESS, email) != NULL) {
- e_error_run (NULL, "org.gnome.evolution.proxy-login:already-loggedin", email, NULL);
+ e_error_run (error_parent, "org.gnome.evolution.proxy-login:already-loggedin", email, NULL);
g_free (name);
return;
}
@@ -362,7 +363,7 @@ proxy_soap_login (gchar *email)
g_free (parent_source_url);
camel_url_free (parent);
} else {
- e_error_run (NULL, "org.gnome.evolution.proxy-login:invalid-user",email ,NULL);
+ e_error_run (error_parent, "org.gnome.evolution.proxy-login:invalid-user",email ,NULL);
return;
}
@@ -524,7 +525,7 @@ gw_proxy_login_cb (GtkAction *action, EShellView *shell_view)
);
proxy_login_setup_tree_view ();
proxy_login_update_tree ();
- g_signal_connect (GTK_DIALOG (priv->main), "response", G_CALLBACK(proxy_login_cb), NULL);
+ g_signal_connect (GTK_DIALOG (priv->main), "response", G_CALLBACK(proxy_login_cb), e_shell_view_get_shell_window (shell_view));
gtk_widget_show (GTK_WIDGET (priv->main));
g_free (uri);
diff --git a/plugins/groupwise-features/proxy-login.h b/plugins/groupwise-features/proxy-login.h
index 150684c140..65e28cdf78 100644
--- a/plugins/groupwise-features/proxy-login.h
+++ b/plugins/groupwise-features/proxy-login.h
@@ -52,11 +52,10 @@ struct _proxyLoginClass {
GType proxy_login_get_type (void);
proxyLogin * proxy_login_new (void);
-static void proxy_login_cb (GtkDialog *dialog, gint state);
static void proxy_login_add_new_store (gchar *uri, CamelStore *store, gpointer user_data);
static void proxy_login_setup_tree_view (void);
proxyLogin* proxy_dialog_new (void);
-static void proxy_soap_login (gchar *email);
+static void proxy_soap_login (gchar *email, GtkWindow *error_parent);
gchar *parse_email_for_name (gchar *email);
static void proxy_login_update_tree (void);
static void proxy_login_tree_view_changed_cb(GtkDialog *dialog);
diff --git a/plugins/groupwise-features/proxy.c b/plugins/groupwise-features/proxy.c
index a31b49112b..545e98787d 100644
--- a/plugins/groupwise-features/proxy.c
+++ b/plugins/groupwise-features/proxy.c
@@ -301,7 +301,7 @@ proxy_get_permissions_from_dialog (EAccount *account)
}
static gint
-proxy_dialog_store_widgets_data (EAccount *account, gint32 dialog)
+proxy_dialog_store_widgets_data (EAccount *account, gint32 dialog, GtkWindow *parent)
{
GtkTreeIter iter;
GtkTreeSelection* account_select;
@@ -330,7 +330,7 @@ proxy_dialog_store_widgets_data (EAccount *account, gint32 dialog)
tmp = destinations;
if (!tmp) {
- e_error_run (NULL, "org.gnome.evolution.proxy:no-user",NULL ,NULL);
+ e_error_run (parent, "org.gnome.evolution.proxy:no-user",NULL ,NULL);
return -1;
}
@@ -342,11 +342,11 @@ proxy_dialog_store_widgets_data (EAccount *account, gint32 dialog)
continue;
if (g_strrstr (email, "@") == NULL) {
- e_error_run (NULL, "org.gnome.evolution.proxy:invalid-user", email, NULL);
+ e_error_run (parent, "org.gnome.evolution.proxy:invalid-user", email, NULL);
return -1;
}
if (! g_ascii_strcasecmp(e_gw_connection_get_user_email (prd->cnc), email)) {
- e_error_run (NULL, "org.gnome.evolution.proxy:invalid-user", email, NULL);
+ e_error_run (parent, "org.gnome.evolution.proxy:invalid-user", email, NULL);
return -1;
}
@@ -365,7 +365,7 @@ proxy_dialog_store_widgets_data (EAccount *account, gint32 dialog)
return 0;
}
- e_error_run (NULL, "org.gnome.evolution.proxy:user-is-proxy",email ,NULL);
+ e_error_run (parent, "org.gnome.evolution.proxy:user-is-proxy",email ,NULL);
return -1;
}
}
@@ -792,7 +792,7 @@ proxy_add_ok (GtkWidget *button, EAccount *account)
prd = g_object_get_data ((GObject *)account, "prd");
priv = prd->priv;
- if (proxy_dialog_store_widgets_data (account, PROXY_ADD_DIALOG) < 0)
+ if (proxy_dialog_store_widgets_data (account, PROXY_ADD_DIALOG, GTK_WINDOW (gtk_widget_get_toplevel (button))) < 0)
return;
proxy_update_tree_view (account);
@@ -809,7 +809,7 @@ proxy_edit_ok (GtkWidget *button, EAccount *account)
prd = g_object_get_data ((GObject *)account, "prd");
priv = prd->priv;
- if ( proxy_dialog_store_widgets_data (account, PROXY_EDIT_DIALOG) < 0)
+ if ( proxy_dialog_store_widgets_data (account, PROXY_EDIT_DIALOG, GTK_WINDOW (gtk_widget_get_toplevel (button))) < 0)
return;
proxy_update_tree_view (account);
diff --git a/plugins/groupwise-features/share-folder.c b/plugins/groupwise-features/share-folder.c
index 67c58f05fd..62a832be0d 100644
--- a/plugins/groupwise-features/share-folder.c
+++ b/plugins/groupwise-features/share-folder.c
@@ -339,10 +339,10 @@ add_clicked(GtkButton *button, ShareFolder *sf)
email = e_destination_get_email (tmp->data);
/* You can't share a folder with yourself*/
if (g_strrstr (email, "@") == NULL || (!g_ascii_strcasecmp (email , self_email)))
- e_error_run (NULL, "org.gnome.evolution.mail_shared_folder:invalid-user",email ,NULL);
+ e_error_run (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (button))), "org.gnome.evolution.mail_shared_folder:invalid-user",email ,NULL);
else {
if (!g_ascii_strcasecmp (email, "" )) {
- e_error_run (NULL, "org.gnome.evolution.mail_shared_folder:no-user",NULL);
+ e_error_run (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (button))), "org.gnome.evolution.mail_shared_folder:no-user",NULL);
return;
}
diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c
index 94f9081ecd..a0daa6f156 100644
--- a/plugins/itip-formatter/itip-formatter.c
+++ b/plugins/itip-formatter/itip-formatter.c
@@ -1307,7 +1307,7 @@ update_attendee_status (struct _itip_puri *pitip)
if ((a->status == ICAL_PARTSTAT_DELEGATED) && (del_prop = find_attendee (org_icalcomp, itip_strip_mailto (a->delto))) && !(find_attendee (icalcomp, itip_strip_mailto (a->delto)))) {
gint response;
delegate = icalproperty_get_attendee (del_prop);
- response = e_error_run (NULL, "org.gnome.itip-formatter:add-delegate",
+ response = e_error_run (GTK_WINDOW (gtk_widget_get_toplevel (pitip->view)), "org.gnome.itip-formatter:add-delegate",
itip_strip_mailto (a->value),
itip_strip_mailto (delegate), NULL);
if (response == GTK_RESPONSE_YES) {
@@ -1325,7 +1325,7 @@ update_attendee_status (struct _itip_puri *pitip)
gint response;
if (a->delfrom && *a->delfrom) {
- response = e_error_run (NULL, "org.gnome.itip-formatter:add-delegate",
+ response = e_error_run (GTK_WINDOW (gtk_widget_get_toplevel (pitip->view)), "org.gnome.itip-formatter:add-delegate",
itip_strip_mailto (a->delfrom),
itip_strip_mailto (a->value), NULL);
if (response == GTK_RESPONSE_YES) {
@@ -1344,7 +1344,7 @@ update_attendee_status (struct _itip_puri *pitip)
}
}
- response = e_error_run (NULL, "org.gnome.itip-formatter:add-unknown-attendee", NULL);
+ response = e_error_run (GTK_WINDOW (gtk_widget_get_toplevel (pitip->view)), "org.gnome.itip-formatter:add-unknown-attendee", NULL);
if (response == GTK_RESPONSE_YES) {
change_status (icalcomp, itip_strip_mailto (a->value), a->status);
diff --git a/plugins/startup-wizard/startup-wizard.c b/plugins/startup-wizard/startup-wizard.c
index e04a005206..7b691853fd 100644
--- a/plugins/startup-wizard/startup-wizard.c
+++ b/plugins/startup-wizard/startup-wizard.c
@@ -210,16 +210,11 @@ startup_wizard_commit (EPlugin *ep, EMConfigTargetAccount *target)
{
EShell *shell;
EShellSettings *shell_settings;
- GtkWindow *parent;
- GList *windows;
gchar *location;
shell = e_shell_get_default ();
shell_settings = e_shell_get_shell_settings (shell);
- windows = e_shell_get_watched_windows (shell);
- parent = (windows != NULL) ? GTK_WINDOW (windows->data) : NULL;
-
/* Use System Timezone by default */
e_shell_settings_set_boolean (
shell_settings, "cal-use-system-timezone", TRUE);
@@ -232,7 +227,7 @@ startup_wizard_commit (EPlugin *ep, EMConfigTargetAccount *target)
import_iterator = import_importers;
import_importer = import_iterator->data;
- import_dialog = e_error_new(parent, "shell:importing", _("Importing data."), NULL);
+ import_dialog = e_error_new (e_shell_get_active_window (shell), "shell:importing", _("Importing data."), NULL);
g_signal_connect(import_dialog, "response", G_CALLBACK(import_dialog_response), NULL);
import_label = gtk_label_new(_("Please wait"));
import_progress = gtk_progress_bar_new();
diff --git a/shell/e-shell-content.c b/shell/e-shell-content.c
index 821f683d96..6761af7296 100644
--- a/shell/e-shell-content.c
+++ b/shell/e-shell-content.c
@@ -1384,7 +1384,7 @@ run:
if (response != GTK_RESPONSE_OK && response != GTK_RESPONSE_APPLY)
goto exit;
- if (!filter_rule_validate (rule))
+ if (!filter_rule_validate (rule, GTK_WINDOW (dialog)))
goto run;
e_shell_content_set_search_rule (shell_content, rule);
@@ -1486,7 +1486,7 @@ run:
if (response != GTK_RESPONSE_OK)
goto exit;
- if (!filter_rule_validate (rule))
+ if (!filter_rule_validate (rule, GTK_WINDOW (dialog)))
goto run;
rule_context_add_rule (context, rule);
diff --git a/shell/e-shell-migrate.c b/shell/e-shell-migrate.c
index 10cea586b6..a330d9d1a5 100644
--- a/shell/e-shell-migrate.c
+++ b/shell/e-shell-migrate.c
@@ -71,7 +71,7 @@ shell_migrate_attempt (EShell *shell,
gint response;
response = e_error_run (
- NULL, "shell:upgrade-failed",
+ e_shell_get_active_window (shell), "shell:upgrade-failed",
error->message, NULL);
if (response == GTK_RESPONSE_CANCEL)
@@ -243,7 +243,7 @@ e_shell_migrate_attempt (EShell *shell)
have = g_strdup_printf (_("%ld KB"), avail);
e_error_run (
- NULL, "shell:upgrade-nospace",
+ e_shell_get_active_window (shell), "shell:upgrade-nospace",
need, have, NULL);
g_free (need);
@@ -286,13 +286,13 @@ check_old:
string = g_strdup_printf (
"%d.%d.%d", last_major, last_minor, last_micro);
response = e_error_run (
- NULL, "shell:upgrade-remove-1-4", string, NULL);
+ e_shell_get_active_window (shell), "shell:upgrade-remove-1-4", string, NULL);
g_free (string);
switch (response) {
case GTK_RESPONSE_OK: /* delete */
response = e_error_run (
- NULL,
+ e_shell_get_active_window (shell),
"shell:upgrade-remove-1-4-confirm",
NULL);
if (response == GTK_RESPONSE_OK)
diff --git a/shell/e-shell.c b/shell/e-shell.c
index bf664649fc..924441fa56 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -1348,6 +1348,33 @@ e_shell_get_watched_windows (EShell *shell)
}
/**
+ * e_shell_get_active_window:
+ * @shell: an #EShell; can be NULL, in that case is used
+ * result of @e_shell_get_default
+ *
+ * Returns: an active, the most recently focused, window.
+ **/
+GtkWindow *
+e_shell_get_active_window (EShell *shell)
+{
+ GList *w;
+ GtkWindow *window = NULL;
+
+ if (!shell)
+ shell = e_shell_get_default ();
+
+ g_return_val_if_fail (shell != NULL, NULL);
+
+ for (w = e_shell_get_watched_windows (shell); w && !window; w = w->next) {
+ window = GTK_WINDOW (w->data);
+ }
+
+ g_return_val_if_fail (window != NULL, NULL);
+
+ return window;
+}
+
+/**
* e_shell_send_receive:
* @shell: an #EShell
* @parent: the parent #GtkWindow
diff --git a/shell/e-shell.h b/shell/e-shell.h
index 818607e1fb..2872608809 100644
--- a/shell/e-shell.h
+++ b/shell/e-shell.h
@@ -92,6 +92,7 @@ guint e_shell_handle_uris (EShell *shell,
void e_shell_watch_window (EShell *shell,
GtkWindow *window);
GList * e_shell_get_watched_windows (EShell *shell);
+GtkWindow * e_shell_get_active_window (EShell *shell);
void e_shell_send_receive (EShell *shell,
GtkWindow *parent);
gboolean e_shell_get_network_available (EShell *shell);